-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Update html-language-features to use doQuoteComplete #137080
Conversation
9ae9cfb
to
e31766b
Compare
Great stuff, thanks for taking the time! As you have seen, it's very similar to autoClose. Based on some typing that matches a pattern, the language server is asked for a smart completion. The server comes back with text edits (or in our case just a snippet) It would make sense to generalize the feature and merge what you added with We've come across the same need for other languages, C# or C++ have it too, if I'm, not mistaken Would you be interested in making that change? |
Hi @aeschli , |
Hi @aeschli, could you link me to the example you mentioned? I could find no mention of I had a think of the changes in the meantime, my proposed change would be:
let insertRequestor = (document: TextDocument, position: Position, requestType: RequestType<TextDocumentPositionParams, string, any>) => {
let param = client.code2ProtocolConverter.asTextDocumentPositionParams(document, position);
return client.sendRequest(requestType, param);
};
let disposable = activateAutoInsertion(insertRequestor, { html: true, handlebars: true }, runtime);
|
@dbaeumer reached out to the other team that we discussed I was thinking to do it with a single request |
3259728
to
ef8f278
Compare
@aeschli I have tried implementing the change as you wanted it. |
@jzyrobert Looks good, thanks! |
ef8f278
to
e173551
Compare
@aeschli you're right, I have refactored it further |
e173551
to
e6c9ee0
Compare
@aeschli I have resolved merge conflicts it with the recent changes you have done |
Thanks @jzyrobert. I wanted to push it all for November but time ran out. It will be in the December/January release. |
please merge it : ) |
Thanks a lot @jzyrobert for the nice work.
|
This PR fixes #18071
Adds the
html.autoCreateQuotes
function, using the existinghtml.completion.attributeDefaultValue
setting for quote choice.The corresponding extension PR is found at microsoft/vscode-html-languageservice#116
Setting disabled:
Setting enabled:
Changed to single quotes:
Valid completion examples from the tests:
Invalid completion examples from the tests:
The logic works something like:
Is there a valid
AttributeName
token before the=
?Is the token followed by a valid
DelimiterAssign
(=)?Is the next token NOT
AttributeValue
(value already exists) ORUnknown
(invalid syntax)?If yes, insert a quote pair and move the cursor one forward.
Additional things to consider: