You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add support for SnippetString in TextEdit and WorkspaceEdit #145374
The TextEdit and WorkspaceEdit APIs are used to apply refactorings. Those will benefit from being able to place the cursor and add placeholders, like add a placeholder for the suggested name of an extracted vairable
Reacted by Vitaly, Babak K. Shandiz, caucbianca and heartacker
Inserting/replacing content with snippets would require additional command execution for these cases. I can imagine cases, where it could be handly to replace a few lines with some snippet on completion accepted.
For me, these approaches to insert snippet seemed equal, but they actually insert different text (vscode.SnippetTextEdit.insert doesn't do space adjusting like editor.insertSnippet).
Fair question and something I didn't consider yet. Don't know yet what the design should be but looking at the sources they should behave the same: both should default to adjusting whitespace. I will investigate
Fair question and something I didn't consider yet. I will investigate
If I lived in ideal world I'd see an option to also disable this behavior :) IMO these two cases I described above should be aligned with what accepting completion does. e.g. ok if it does space adjusting by default, but there also should be away to disable that, like we can disable it with keepWhitespace=false for suggestions. Hope you will consider that 🙏
I will investigate
Thank you so much, I really appreciate the work you're doing here! Let me know how it goes!
Activity
jrieken commentedon Apr 7, 2022
For April I have enabled this (for editor dnd) and for May we can make this more prominent. Questions
11 remaining items
jrieken commentedon Aug 24, 2022
Plan to finalize this API for September
have an explicit `SnippetTextEdit` and all to set them onto a workspa…
Add `replace` and `insert` factory functions for `SnippetTextEdit`, a…
move `SnippetTextEdit` into vscode-dts
jrieken commentedon Sep 13, 2022
This is now done via
SnippetTextEditandWorkspaceEdit.set(Uri, SnippetTextEdit[])jrieken commentedon Sep 13, 2022
fyi Alex Kladov (@matklad)
zardoy commentedon Sep 13, 2022
Johannes Rieken (@jrieken) as I understand,
CompletionItem.additionalTextEditswon't receive snippets support, right?Inserting/replacing content with snippets would require additional command execution for these cases. I can imagine cases, where it could be handly to replace a few lines with some snippet on completion accepted.
jrieken commentedon Sep 13, 2022
As for this issue no and it needs thinking if it can be done, esp since they can come late and since the main edit can already be a snippet
zardoy commentedon Sep 22, 2022
Johannes Rieken (@jrieken) I also want to ask you about white space normalization. It'd much easier to describe the issue with the following code:
For me, these approaches to insert snippet seemed equal, but they actually insert different text (
vscode.SnippetTextEdit.insertdoesn't do space adjusting likeeditor.insertSnippet).Is that also by design?
jrieken commentedon Sep 26, 2022
Fair question and something I didn't consider yet. Don't know yet what the design should be but looking at the sources they should behave the same: both should default to adjusting whitespace. I will investigate
zardoy commentedon Sep 26, 2022
If I lived in ideal world I'd see an option to also disable this behavior :) IMO these two cases I described above should be aligned with what accepting completion does. e.g. ok if it does space adjusting by default, but there also should be away to disable that, like we can disable it with
keepWhitespace=falsefor suggestions. Hope you will consider that 🙏Thank you so much, I really appreciate the work you're doing here! Let me know how it goes!