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

Completion snippet support #668

Merged
merged 7 commits into from
Dec 29, 2022
Merged

Completion snippet support #668

merged 7 commits into from
Dec 29, 2022

Conversation

zth
Copy link
Collaborator

@zth zth commented Dec 29, 2022

This adds support for snippets in completion. Snippets lets us tell the editor where we want the cursor to move as the user tabs its way through the newly inserted text.

  • Add snippet support
  • Implement snippets for a few existing things like completion options, variant constructor arguments, etc
  • Implement very basic completion for tuples, including with snippet support

@zth zth requested a review from cristianoc December 29, 2022 13:37
Copy link
Collaborator

@cristianoc cristianoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the support for snippets something configured from the server?
Not sure how that's supposed to work in practice. If it's a server side config or something else.

@zth zth mentioned this pull request Dec 29, 2022
24 tasks
@zth
Copy link
Collaborator Author

zth commented Dec 29, 2022

Is the support for snippets something configured from the server? Not sure how that's supposed to work in practice. If it's a server side config or something else.

Basically, the client hooking up the server says whether it supports snippets or not. If it supports snippets, we're allowed to use the snippet syntax in insertText for our completion items.

So, in practice, this is progressive enhancement. If the client using the LSP supports snippets we'll send them if wanted, and if not, we won't.

@cristianoc
Copy link
Collaborator

Do we support clients that don't support snippets? Just wondering whether we should just have this on.

@zth
Copy link
Collaborator Author

zth commented Dec 29, 2022

Do we support clients that don't support snippets? Just wondering whether we should just have this on.

I'm pretty sure there are variants of vim people are using that at least requires extra configuration to support snippets. I think it's safer to leave it turned off unless the client asks for it. Which reminds me I need to actually hook things up properly here to what the client says, I always send true now.

@zth
Copy link
Collaborator Author

zth commented Dec 29, 2022

@cristianoc fixed in the last commit.

@zth zth force-pushed the completion-snippet-support branch from 2c4f080 to 2da1313 Compare December 29, 2022 17:47
Copy link
Collaborator

@cristianoc cristianoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good as long as snippet support is hooked up from the .ts side.

@zth zth merged commit b4ffaa3 into master Dec 29, 2022
@zth zth deleted the completion-snippet-support branch December 29, 2022 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants