Skip to content

Provide a way to let embedded language have its own completionTriggers #44379

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

Closed
octref opened this issue Feb 26, 2018 · 3 comments
Closed

Provide a way to let embedded language have its own completionTriggers #44379

octref opened this issue Feb 26, 2018 · 3 comments
Assignees
Labels
*as-designed Described behavior is as designed suggest IntelliSense, Auto Complete

Comments

@octref
Copy link
Contributor

octref commented Feb 26, 2018

Context: vuejs/vetur#705

Vue language server uses : to suggest Vue html properties, such as <div :foo="bar">. However, this can cause : to trigger completions in the <script> section, which is not what the user want.

The only way to achieve it today seems to be splitting the server into two servers, which seem to be a huge amount of work.

I don't know if it's possible to provide a way to let embedded language have its own completionTriggers, but one alternative I can think of is to allow server to say "provide no suggestion on client side" in LSP. Currently returning empty array of CompletionItem still trigger word-based completion.

@octref octref added the suggest IntelliSense, Auto Complete label Feb 26, 2018
@dbaeumer
Copy link
Member

@octref I don't actually understand what you mean by provide no suggestion on client side. Can you make a more concrete example ?

@jrieken
Copy link
Member

jrieken commented Feb 26, 2018

I don't know if it's possible to provide a way to let embedded language have its own completionTriggers, but

The concept of an embedded language doesn't exist in API-terms. It's always the "outer languages" that is in charge of decision making. So, it should register : as completion character but then it must decide if that occurrence of the character is valid. Even "simple" languages must do this, e.g the . isn't always a valid trigger character for TypeScript et al.

@jrieken jrieken added the *as-designed Described behavior is as designed label Feb 26, 2018
@octref
Copy link
Contributor Author

octref commented Feb 26, 2018

@dbaeumer
Sorry I had an incomplete understanding of word based suggestions. I thought for each completion trigger, when nothing is being returned VS Code would fallback to word-based suggestions. Turned out it's only when completions are triggered by non-symbol characters.

@jrieken
OK. I'll use completion's position to find character to the left of cursor and determine if it's a valid completion trigger in its embedded context.

@octref octref closed this as completed Feb 26, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Apr 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*as-designed Described behavior is as designed suggest IntelliSense, Auto Complete
Projects
None yet
Development

No branches or pull requests

3 participants