indent snippets to line indent instead of completion start #6263
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #6255
The way multi-line snippet indentation was implemented in #5864 was incorrect. Lines inserted in snippets were indented to align with the start of the snippet. However, snippets are supposed to be indented to match the indentation level of the line they are on, see vscode: https://github.com/microsoft/vscode/blob/1d0175478873e6ad29033d84925ce5d936032b3c/src/vs/editor/contrib/snippet/browser/snippetSession.ts#L404
This makes a lot more sense as this basically just ensures that snippet newlines are identical to hitting tab manually. Note that I opted not to run indentation queries here. The LS should be aware of any language specific indentation needs and wouldn't expect the client to do this for him (the standard also specifies that snippets should be adjusted to the indentation of the insert line)