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

Wrap selection in XML element #794

Closed
adunning opened this issue Oct 19, 2022 · 14 comments · Fixed by #813
Closed

Wrap selection in XML element #794

adunning opened this issue Oct 19, 2022 · 14 comments · Fixed by #813
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@adunning
Copy link

Most XML editors have a feature to wrap the current selection in an XML element, providing completion to suggest valid tags at that point in a file.

Within VS Code, the built-in 'Emmet: Wrap with Abbreviation' function provides part of this, but it is not XML-aware and does not give a list of the allowed tags in the current context. It would thus be brilliant if the XML extension could provide this.

There are at least two ways to implement this:

  1. Inline: TextMate allows the user to make a selection, then type Ctrl + < to insert open/close tags around it, balancing the element name as the user types. The VS Code XML plugin could use this approach to immediately provide a list of options identical to the current functionality when typing <.
  2. With a dialogue box: Similar to the existing Emmet function but with autocompletion. The Oxygen XML Editor, for example, provides such a dialogue with the shortcut Ctrl + E. The Scholarly XML extension for VS Code has an implementation of this, but it conflicts with this XML plugin.

Many thanks for your work on this project and considering this request!

@angelozerr
Copy link
Contributor

@adunning if I understand correctly, teh native emmet extension does the job, but you would like to just have completion for allowed XML tags in command palette, is that?

@adunning
Copy link
Author

Yes, exactly: giving users a list of available tags is an enormous help for beginners to a schema and prevents typos for everyone.

I prefer an inline interface along the lines of what the extension already provides, but it's likely a question of what is easier to implement.

Thank you again for your consideration!

@angelozerr
Copy link
Contributor

I fear it can be a long task, I'm not sure that we will implement that soon. If we see that we hav emore andmore user who want to have this feature, we could change the priority.

@adunning don't hesitate to create any issue that you think it is important for RelaxNG and TEI.

For instance I wonder if xml:id supports could help TEI users (having completion, definitin, validation for xml:id). If you think it is important please create the issue and another. Thanks!

@otichy
Copy link

otichy commented Nov 17, 2022

This similar to #605

I just want to add that this has been implemented both by the Scholarly XML (mentioned above) as well by TEI Publisher Extension for Visual Studio Code, but neither of them has the completion feature.

@angelozerr
Copy link
Contributor

Ok thanks @otichy for your feedback. I will see if it is easy to implement.

angelozerr added a commit to angelozerr/vscode-xml that referenced this issue Nov 17, 2022
Fixes redhat-developer#794

Signed-off-by: azerr <azerr@redhat.com>
angelozerr added a commit to angelozerr/vscode-xml that referenced this issue Nov 17, 2022
Fixes redhat-developer#794

Signed-off-by: azerr <azerr@redhat.com>
angelozerr added a commit to angelozerr/vscode-xml that referenced this issue Nov 18, 2022
Fixes redhat-developer#794

Signed-off-by: azerr <azerr@redhat.com>
@angelozerr
Copy link
Contributor

@adunning @otichy I have started to implement inline wrap element at #813 (comment) but it requires to do some more work.

@angelozerr angelozerr self-assigned this Nov 23, 2022
angelozerr added a commit to angelozerr/vscode-xml that referenced this issue Dec 1, 2022
Fixes redhat-developer#794

Signed-off-by: azerr <azerr@redhat.com>
angelozerr added a commit to angelozerr/vscode-xml that referenced this issue Dec 2, 2022
Fixes redhat-developer#794

Signed-off-by: azerr <azerr@redhat.com>
angelozerr added a commit to angelozerr/vscode-xml that referenced this issue Dec 3, 2022
Fixes redhat-developer#794

Signed-off-by: azerr <azerr@redhat.com>
angelozerr added a commit to angelozerr/vscode-xml that referenced this issue Dec 3, 2022
Fixes redhat-developer#794

Signed-off-by: azerr <azerr@redhat.com>
angelozerr added a commit to angelozerr/vscode-xml that referenced this issue Dec 3, 2022
Fixes redhat-developer#794

Signed-off-by: azerr <azerr@redhat.com>
angelozerr added a commit to angelozerr/vscode-xml that referenced this issue Dec 5, 2022
Fixes redhat-developer#794

Signed-off-by: azerr <azerr@redhat.com>
angelozerr added a commit to angelozerr/vscode-xml that referenced this issue Dec 5, 2022
Fixes redhat-developer#794

Signed-off-by: azerr <azerr@redhat.com>
angelozerr added a commit to angelozerr/vscode-xml that referenced this issue Dec 5, 2022
Fixes redhat-developer#794

Signed-off-by: azerr <azerr@redhat.com>
angelozerr added a commit to angelozerr/vscode-xml that referenced this issue Dec 6, 2022
Fixes redhat-developer#794

Signed-off-by: azerr <azerr@redhat.com>
angelozerr added a commit to angelozerr/vscode-xml that referenced this issue Dec 6, 2022
Fixes redhat-developer#794

Signed-off-by: azerr <azerr@redhat.com>
angelozerr added a commit to angelozerr/vscode-xml that referenced this issue Dec 6, 2022
Fixes redhat-developer#794

Signed-off-by: azerr <azerr@redhat.com>
angelozerr added a commit to angelozerr/vscode-xml that referenced this issue Dec 6, 2022
Fixes redhat-developer#794

Signed-off-by: azerr <azerr@redhat.com>
angelozerr added a commit to angelozerr/vscode-xml that referenced this issue Dec 6, 2022
Fixes redhat-developer#794

Signed-off-by: azerr <azerr@redhat.com>
angelozerr added a commit to angelozerr/vscode-xml that referenced this issue Dec 6, 2022
Fixes redhat-developer#794

Signed-off-by: azerr <azerr@redhat.com>
angelozerr added a commit to angelozerr/vscode-xml that referenced this issue Dec 7, 2022
Fixes redhat-developer#794

Signed-off-by: azerr <azerr@redhat.com>
angelozerr added a commit to angelozerr/vscode-xml that referenced this issue Dec 7, 2022
Fixes redhat-developer#794

Signed-off-by: azerr <azerr@redhat.com>
angelozerr added a commit to angelozerr/vscode-xml that referenced this issue Dec 7, 2022
Fixes redhat-developer#794

Signed-off-by: azerr <azerr@redhat.com>
angelozerr added a commit to angelozerr/vscode-xml that referenced this issue Dec 7, 2022
Fixes redhat-developer#794

Signed-off-by: azerr <azerr@redhat.com>
angelozerr added a commit to angelozerr/vscode-xml that referenced this issue Dec 7, 2022
Fixes redhat-developer#794

Signed-off-by: azerr <azerr@redhat.com>
@datho7561 datho7561 added the enhancement New feature or request label Dec 8, 2022
@datho7561 datho7561 added this to the 0.23.0 milestone Dec 8, 2022
datho7561 pushed a commit that referenced this issue Dec 8, 2022
Fixes #794

Signed-off-by: azerr <azerr@redhat.com>
@datho7561
Copy link
Contributor

The prerelease containing this feature should be out December 9th. Please let us know if you run into any issues

@adunning
Copy link
Author

adunning commented Dec 8, 2022

Looking forward to seeing it – very many thanks for your work on this!

@angelozerr
Copy link
Contributor

Looking forward to seeing it – very many thanks for your work on this!

You are welcome!

Please install the prerelease https://github.com/redhat-developer/vscode-xml#contributing to try the wrap element feature (see https://github.com/redhat-developer/vscode-xml/blob/main/docs/Refactor.md#surround-with-tags-wrap) and give us feedback

@otichy
Copy link

otichy commented Dec 9, 2022

Just tested this, very cool, thank you all very much!

I have one very minor comment: when I select the action, the first item from the completion is selected and inserted automatically. When I decide to cancel the action e.g. using escape, the wrapping tag remains. I can of course undo, so no big deal.

@angelozerr
Copy link
Contributor

Just tested this, very cool, thank you all very much!

Thanks for your feedback! And we are glad that it pleases you.

I have one very minor comment: when I select the action, the first item from the completion is selected and inserted automatically. When I decide to cancel the action e.g. using escape, the wrapping tag remains. I can of course undo, so no big deal.

I don't know how to cancel snippet mode. Could you create an issue for that just to invesitgate this improvement.Thanks.

@otichy
Copy link

otichy commented Dec 9, 2022

OK, will do.

Is it also a good idea to start a new issue about possibly having the choice between documentation and multiline as discussed in #813 (comment) ?

@angelozerr
Copy link
Contributor

Is it also a good idea to start a new issue about possibly having the choice between documentation and multiline as discussed in #813 (comment) ?

Yes please. In otherwords please create an issue per improvement to investiagte.

@angelozerr
Copy link
Contributor

And please create any issues if you think an important features from Oxygen is provided but not in vscode-xml.

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

Successfully merging a pull request may close this issue.

4 participants