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

Renaming Tags with namespaces duplicates namespace #621

Closed
luechtdev opened this issue Nov 24, 2021 · 2 comments · Fixed by eclipse-lemminx/lemminx#1135
Closed

Renaming Tags with namespaces duplicates namespace #621

luechtdev opened this issue Nov 24, 2021 · 2 comments · Fixed by eclipse-lemminx/lemminx#1135
Assignees
Labels
bug Something isn't working rename
Milestone

Comments

@luechtdev
Copy link

Version: 0.18.1

When renaming a namespaced XML-Tag - the namespace is duplicated.

Steps to reproduce:

  1. Create a namespaced tag like <ns:tagname>
  2. Put the cursor on top and press "F2" to rename
  3. Change the name (for example ns:tagname2)

Expected Result:
Tag is renamed to <ns:tagname2>

Actual result
Tag is renamed to <ns:ns:tagname2>

@angelozerr angelozerr added bug Something isn't working rename labels Nov 24, 2021
@AlexXuChen
Copy link
Contributor

AlexXuChen commented Dec 7, 2021

This bug seems deeper than just <ns:..> tags, but actually persists on any tag containing ::
e.g. If you rename <xs:schema> to something, say foo, you will get <xs:foo>.

It also depends on where your cursor is during rename:
e.g. If you rename <ns:tag1> to ns:tag2 and your cursor is hovering ns, the result will be <ns:tag2:tag1>

@rgrunber
Copy link
Member

rgrunber commented Dec 7, 2021

I think the part that is confusing for users is the fact that when you activate rename, the proposed text is ns:foo. Implicitly, this makes someone assume they are renaming the entire tag name (including namespace). If we want to preserve this behaviour of only renaming the left/right component of the :, then we should modify the text that appears in the rename popup.

(| for the cursor position)
In other words : <ns:fo|o> suggests renaming foo & <n|s:foo> suggests renaming ns.

@angelozerr does this make sense ? If so, then I'm guessing we need to change the symbol provider to consider this 2 separate tokens ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working rename
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants