Open WayneCYChang opened 1 year ago
Please share a minimal, self-contained code example that demonstrates this issue
Please share a minimal, self-contained code example that demonstrates this issue
Thanks for the quick reply. Here is the code example. https://github.com/WayneCYChang/vscode-autocomplete-wrong
Thanks. Minimal repo:
class Foo {
bar = this.foo // Type . here
constructor(private foo: Foo) { }
}
Suggestions do start working after the first letter is typed. It's likely they are just broken while the file is in an invalid syntax state
Yes, you're right. An invalid syntax state is broken Suggestions. But I also found that is only broken before the constructor(). The suggestions will work normally if you have some words between '.' and the constructor().
I have committed a new code to the repo. You can try it out.
The issue is not specific to the constructor
. The same happens here:
class Foo {
bar = this.
other;
}
The parser continues to parse this as a property access so it doesn't parse other
(or constructor
in the other example) as a class member (or constructor). Thus the symbols for those members are not created.
In its essence the issue is very very similar to the one reported here
TS Template added by @mjbvz
TypeScript Version: 5.0.1
Search Terms
See https://github.com/microsoft/TypeScript/issues/53124#issuecomment-1457338704 for minimal repo
Does this issue occur when all extensions are disabled?: Yes
Description
Autocompletion did not work when the cursor was placed before the constructor()
Reproduction
Steps to reproduce the behavior:
Expected behavior
Show method of service.
Screenshots
If applicable, add screenshots to help explain your problem.
Anything else relevant?
https://github.com/angular/vscode-ng-language-service/issues/1866#issue-1596155750