-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add support for SnippetTextEdit
vscode API
#12047
Add support for SnippetTextEdit
vscode API
#12047
Conversation
SnippetTextEdit
vscode API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CI fails with the current changes.
includiing support in WorkspaceEdit Signed-off-by: Jonah Iden <[email protected]>
when not inserting as SnippetTextEdit Signed-off-by: Jonah Iden <[email protected]>
Signed-off-by: Jonah Iden <[email protected]>
Signed-off-by: Jonah Iden <[email protected]>
d897fea
to
85c4cc3
Compare
Signed-off-by: Jonah Iden <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test extension seems to work well 👍 Just a few comments, see below.
Signed-off-by: Jonah Iden <[email protected]>
Co-authored-by: Mark Sujew <[email protected]>
Signed-off-by: Jonah Iden <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍
@msujew Do you want to merge this? |
What it does
Closes: #12022
as described here this PR implements SnippetTextEdits the same way they are implemented in vscode. This adds the api to set them on Workspaceedits and sends them as TextEdits with the insertAsSnippet flag to the monaco editor.
Through the snippetController2 class those Edits can be applied to the current editor.
Should SnippetTextEdits be done on a file which editor is not currently active, they are transformed to just the text and applied as normal TextEdits.
It sadly seems both in vscode and theia this snippetTextEdit/SnippetController2 only supports snippets with a single tabstop. So tabbing through seems to not work yet in both IDEs.
How to test
I built a tiny vscode extension which is downloadable from here
snippet-text-edit-test-0.0.1.zip
or buildable from here https://github.com/jonah-iden/snippet-text-edit-test.
This just inserts a test snippetTextEdit at the start of the currently open file and a file called file2.json in the workspace root (this file needs to be created manually first).
you should see the snippet is inserted correctly at the start of the file and the cursor is moved to the tabstop and in file2.json its also inserted at the start of the file without moving the cursor.
Review checklist
Reminder for reviewers