-
-
Notifications
You must be signed in to change notification settings - Fork 594
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
Auto-suggest should never pop up after case statements #705
Comments
Sadly vscode only supports one set of completion trigger: https://github.com/vuejs/vetur/blob/master/server/src/vueServerMain.ts#L58 We need to add |
@HerringtonDarkholme I don't understand. This autocompletion for case statements doesn't happen in regular JS files. Could you elaborate on why this happens in Vetur? |
This happens because we use a superset of completion triggers for html/css/js in Vetur. Completion triggers are like I'll open an upstream issue to track this. |
Thanks! Makes sense that the |
That's not possible in VSCode now. And it is not supported in most editors as far as I know. Few editors place mixed language file in the first place. On the other hand, dynamically changing completion triggers isn't the most sensible choice. The only use case I can see is mixed language. So the problem is better modeled as how to support mixed language in editors. Say, JS in HTML, SQL in PHP. Other than triggering completion, there are other issues related to mixed language. For example, how to count consecutive characters as one word, and emmet expansion in JS/html/css, comment toggling. One direct way to detect language is by syntax highlighting. For @ffxsam 's issue, I suggest you to separate another file for media processing, if they are not involved in UI logic. If they are, a hash table is probably better than switch case. Prior art: https://github.com/purcell/mmm-mode |
Umm this naive way of doing it seems to be working: connection.onCompletion(textDocumentPosition => {
const document = documents.get(textDocumentPosition.textDocument.uri);
const offset = document.offsetAt(
Position.create(textDocumentPosition.position.line, textDocumentPosition.position.character - 1)
);
const triggerChar = document.getText()[offset];
if (triggerChar === ':') {
return { isIncomplete: false, items: [] };
}
return vls.doComplete(document, textDocumentPosition.position);
}); I can put it in js/ts mode to return empty suggestions when trigger characters aren't js/ts trigger characters. |
fix #705, skip template completion trigger in script
When we upgrade to LS 4.0 we can use the |
Info
Problem
Auto suggest pops up every time after case (and
default
) statements. This is highly annoying as we have to hit ESC after every single case statement.Reproducible Case
case
statementsThe text was updated successfully, but these errors were encountered: