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

indent snippets to line indent instead of completion start #6263

Merged
merged 1 commit into from
Mar 11, 2023

Conversation

pascalkuthe
Copy link
Member

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)

@pascalkuthe pascalkuthe added E-easy Call for participation: Experience needed to fix: Easy / not much A-language-server Area: Language server client S-waiting-on-review Status: Awaiting review from a maintainer. labels Mar 11, 2023
@archseer archseer merged commit 171d28d into helix-editor:master Mar 11, 2023
@pascalkuthe pascalkuthe deleted the snippet_indent branch March 11, 2023 02:35
sagnibak pushed a commit to sagnibak/helix that referenced this pull request Mar 21, 2023
wes-adams pushed a commit to wes-adams/helix that referenced this pull request Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-language-server Area: Language server client E-easy Call for participation: Experience needed to fix: Easy / not much S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ElixirLS do-completion inserts wrong indentation
2 participants