Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

editing html tags automatically adds attributes to the closing html tag (which should never happen) #114

Open
r6squeegee opened this issue Apr 14, 2022 · 10 comments

Comments

@r6squeegee
Copy link

r6squeegee commented Apr 14, 2022

this has been happening to me for a while now, but specifically right now I'm on eclipse build 20220310-1457
with "Wild Web Developer HTML, CSS, JSON, Yaml, JavaScript, TypeScript, Node tools 0.10.13.202204031849"

I'm on a blank line in an html file, and i type the following :
<div></div>

What I really want is
<div class="foo"></div>
though so I use the arrow keys to move back behind to the letter "v" and I press "space" and start typing the word "class".

The editor starts adding that to the closing tag, i.e. I end up with
<div class="foo"></div class="foo">
then I hit ctrl-z to undo and the editor completely screws up. i.e. it seems to randomly delete some characters and makes a complete mess of the surrounding lines of code. Basically I have to close the file with out saving and re-open it to get back to a sane state.

@nitind
Copy link
Member

nitind commented Apr 27, 2022

I'm also seeing this in the updated Maven POM Editor if I just wait for a few moments with the cursor at the end of the start tag's name.

@angelozerr
Copy link
Contributor

angelozerr commented Apr 27, 2022

I'm also seeing this in the updated Maven POM Editor if I just wait for a few moments with the cursor at the end of the start tag's name.

It is a problem with linked editing range. For XML (LemMinx it should be fixed with eclipse/lemminx#1188) Once WWD will use last version of lemMinx, this error should disapear.

For HTML, it requires that vscode html language server written in TypeScript do the same fix than XML.

@vrubezhny
Copy link
Contributor

@r6squeegee Could you please try updating LSP4E from a latest snapshot - http://download.eclipse.org/lsp4e/snapshots/ - this should allow the linked editing to happen only for the element names, not the following attributes.

@mickaelistria
Copy link
Contributor

mickaelistria commented May 3, 2022

Could not reproduce with latest snapshots of LSP4E. Please reopen with details to reproduce if issue persists on your end.

@mickaelistria
Copy link
Contributor

Fix is a427c47

@mickaelistria mickaelistria transferred this issue from eclipse-wildwebdeveloper/wildwebdeveloper May 3, 2022
@angelozerr
Copy link
Contributor

Are you sure that it is fixed for HTML? If yes it means HTML LS generate the same linked editing range than XML (which is fixed).

@r6squeegee
Copy link
Author

it works for me
thanks!

@r6squeegee
Copy link
Author

I think there might be a missed case in this fix.

It still happens on paste, i.e.
type:
<div></div>

and have
style="text-align:left"

in your clipboard, move the cursor back to the div tag and press paste, causes
<div style="text-align:left"></div style="text-align:left">

@vrubezhny
Copy link
Contributor

Re-opened due to the copy-paste case - #114 (comment)

@vrubezhny vrubezhny reopened this May 11, 2022
@vrubezhny
Copy link
Contributor

The upstream issue is opened eclipse-platform/eclipse.platform.text#33 in order to track the copy-paste issue. The current API doesn't allow for adopters to exit the Linked Editing operation in case of pasting text that contains "stop" characters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants