You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Completion does not trigger automatically when typing inside an string interpolation expression #4808
I presume the issue here is that it's not automatically triggering completion when you type a after the dot (and triggering it manually gives the expected result)?
Triggering on alphanumerics is handled by VS Code, not Dart. We set explicit triggering on dot (which seems to work in your video).
What's odd, is I can reproduce the issue with Dart:
classA {
finalList<String> allowedPrefixes = [];
}
voidf(A a) {
return'${a.}'; // Type 'a' after the dot
}
But I can't repro with TypeScript:
classA{publicallowedPrefixes=[];}functionf(a: A){return`${a.}`;// Type 'a' after the dot}
Yet TypeScripts trigger characters look mostly the same as ours (specifically, 'a' is not listed):
I've verified in the logs that VS Code doesn't seem to send the request to the server, so it's not that the server is filtering it our (or returning no results).
You could check (Cmd+Space / Ctrl+Space), though I suspect it'll work fine and the issue here is just triggering, since I can repro what I described above reliably. I suspect it'll require digging through the VS Code source to understand what's happening.
changed the title [-]Completion stops working inside an interpolation[/-][+]Completion stops automatically showing when typing inside an interpolation[/+]on Oct 23, 2023
Yeah, ctrl space changes current language for me (you probably don't have this at all), so I assume OS intercepts it. Cmd + I worked and can confirm that it works inside the interpolation.
Seems to be related to this code here. When you press a, it's asking whether quick-suggestions are enabled before triggering completion. By default (or at least for me), it's disabled for strings+comments but enabled for other. For TS, this expression is "other" but for Dart it's "string", which is why in TS it triggers and for Dart it doesn't.
So, we'll need to do some investigation into the tokens being produced here.
By "it", we probably mean the Dart textmate grammar or semantic tokens, and it could just be that our names don't match what it expects (the method is called getStandardTokenType so it might be doing some guesswork to understand which tokens are strings/comments/code for each language).
I'll have to do some more digging, will come back to this soon :)
changed the title [-]Completion stops automatically showing when typing inside an interpolation[/-][+]Completion does not trigger automatically when typing inside an string interpolation expression[/+]on Oct 26, 2023
Activity
DanTup commentedon Oct 23, 2023
I presume the issue here is that it's not automatically triggering completion when you type
aafter the dot (and triggering it manually gives the expected result)?Triggering on alphanumerics is handled by VS Code, not Dart. We set explicit triggering on dot (which seems to work in your video).
What's odd, is I can reproduce the issue with Dart:
But I can't repro with TypeScript:
Yet TypeScripts trigger characters look mostly the same as ours (specifically, 'a' is not listed):
https://github.com/microsoft/vscode/blob/c6dcdc753ba263e321e907eb92270ea18ef19ee8/extensions/typescript-language-features/src/languageFeatures/completions.ts#L660
I've verified in the logs that VS Code doesn't seem to send the request to the server, so it's not that the server is filtering it our (or returning no results).
Needs some digging!
DanTup commentedon Oct 23, 2023
The plot thickens... if you use backticks instead of single quotes in Dart, it also works (ofcourse this is invalid dart).
incendial commentedon Oct 23, 2023
Do we need a proposal to make it valid Dart then? 😁 (sorry).
How to NOT solve issues properly 😁.
incendial commentedon Oct 23, 2023
On a serious note, I didn't try to invoke this menu manually. Let me know if you need me to check this.
DanTup commentedon Oct 23, 2023
You could check (Cmd+Space / Ctrl+Space), though I suspect it'll work fine and the issue here is just triggering, since I can repro what I described above reliably. I suspect it'll require digging through the VS Code source to understand what's happening.
incendial commentedon Oct 23, 2023
Neither Cmd nor ctrl work for me (probably there is another shortcut for mac). Do you how it's called?
Would be kinda funny if they left a hack for TS or something 😅
[-]Completion stops working inside an interpolation[/-][+]Completion stops automatically showing when typing inside an interpolation[/+]DanTup commentedon Oct 23, 2023
If you find the "Trigger Suggest" command in the palette, that should show the key binding.
To confirm - you're pressing it after typing the
a?incendial commentedon Oct 23, 2023
Yeah, ctrl space changes current language for me (you probably don't have this at all), so I assume OS intercepts it. Cmd + I worked and can confirm that it works inside the interpolation.
DanTup commentedon Oct 23, 2023
Seems to be related to this code here. When you press
a, it's asking whether quick-suggestions are enabled before triggering completion. By default (or at least for me), it's disabled for strings+comments but enabled for other. For TS, this expression is "other" but for Dart it's "string", which is why in TS it triggers and for Dart it doesn't.So, we'll need to do some investigation into the tokens being produced here.
incendial commentedon Oct 23, 2023
So it basically fails to recognise that it's an interpolation? Interesting.
DanTup commentedon Oct 23, 2023
By "it", we probably mean the Dart textmate grammar or semantic tokens, and it could just be that our names don't match what it expects (the method is called
getStandardTokenTypeso it might be doing some guesswork to understand which tokens are strings/comments/code for each language).I'll have to do some more digging, will come back to this soon :)
DanTup commentedon Oct 26, 2023
I wonder if it's because these start with
string.For TypeScript there is still a string prefix, but there's also
metaandpunctuation. "Standard token type" is "other".DanTup commentedon Oct 26, 2023
I can't figure out how this works - even using the same TS scope name produces "String". I've filed an issue asking for some docs:
microsoft/vscode#196725
[-]Completion stops automatically showing when typing inside an interpolation[/-][+]Completion does not trigger automatically when typing inside an string interpolation expression[/+]Fix automatic triggering of code completion in interpolation expressions