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 }}
This repository was archived by the owner on Nov 21, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 21, 2025. It is now read-only.
autocomplete doesnot work for variable with underscore(_) inside interface #258
I am using Visual Studio Code for Angular 5 project I have converted my post JSON data into typeScript file like
//interface class of post data
export interface Client {
ctm_id: number;
firstname: string;
middlename: string;
}
//interface class of post data
export interface ClientContact {
phone: number;
alternate_phone: number;
}
//interface class of post data
export interface ClientPostData {
client: Client;
clientContacts: ClientContact;
clientMedical_info:Clientmedicalinfo;
}
// and declared in component class like
export class FormComponent implements OnInit {
public model: ClientPostData = {};
public ffirst_name:string;
}
I have installed Angular language service to get suggestions for variables from the interface.
When I type f it suggests firstname in html.but it doesn't suggest clientMedical_info when I type model.(dot).It suggests model.clients and model.clientContacts
How can I get suggestion of client_contact when I type model.(dot)
Reacted by minomikula, Abderrahim Digourdi, Lars and olivermuc
I tried to find workaround, but in fact I don't know what exactly was use case for that commit. Only comment there is "improve text insertion for attributes". It tries somehow improve insertion of suggestions with special characters, and if it detects special char, it will use deprecated textEdit and suggestion will not appear.
If someone could clarify the meaning on this commit, I could prepare PR. But right now possible solution could also be to remove this commit.
First if the disclaimer: THIS IS THE UGLIEST HACK POSSIBLE, now on the bright side, it brings back all attributes, including ones with underscores and dashes.
The any|void I simply added to appease TS lint during the vsix compilation.
// Convert attribute names with non-\w chracters into a text edit.
function insertionToEdit(range: Range, insertText: string): any | void {
if (insertText.match(special) && range) {
// return TextEdit.replace(range, insertText);
}
}
PS: Thanks @minomikula for making take another stab at it.
Activity
ndtien84 commentedon Jul 14, 2018
I got same issue.
olivermuc commentedon Aug 10, 2018
I accidentally posted the same issue here: microsoft/vscode#56077
I case you need another example.
olivermuc commentedon Aug 10, 2018
Could it be related to this line:
vscode-ng-language-service/server/src/server.ts
Line 91 in f0d3e2a
olivermuc commentedon Aug 14, 2018
No updates on this?
NitashEU commentedon Jan 15, 2019
I have the exact same issue.
On the template, the properties with underscore don't get suggested.
minomikula commentedon Jan 16, 2019
I have same issue. I tried to investigate.
Problem is probably caused by using deprecated field
CompletionItem.textEdithttps://code.visualstudio.com/api/references/vscode-api#CompletionItem
The commit 63db792 introduced using
textEdit.I tried to find workaround, but in fact I don't know what exactly was use case for that commit. Only comment there is "improve text insertion for attributes". It tries somehow improve insertion of suggestions with special characters, and if it detects special char, it will use deprecated
textEditand suggestion will not appear.If someone could clarify the meaning on this commit, I could prepare PR. But right now possible solution could also be to remove this commit.
olivermuc commentedon Jan 16, 2019
Well, I guess the intent was to provide some sanity checking to the auto completion logic.
Unfortunately, it appears they went too restrictive.
As I wrote above #258 (comment) , I tinkered with that expression a bit but really couldn't make it work at all.
Rolling back the entire commit sounds harsh, but if that fixes it (or puts it back in a state that works for us) why not?!
Let me know if there is anything I can help with re: Pull Request - QA / test etc.
I can't own the PR but happy to support this!
olivermuc commentedon Jan 16, 2019
Addendum: I found a workaround to make it work.
First if the disclaimer: THIS IS THE UGLIEST HACK POSSIBLE, now on the bright side, it brings back all attributes, including ones with underscores and dashes.
It's really all about commenting out this line:
vscode-ng-language-service/server/src/server.ts
Line 97 in f5e2317
The
any|voidI simply added to appease TS lint during the vsix compilation.PS: Thanks @minomikula for making take another stab at it.
ednjv commentedon Jan 31, 2019
Same issue here
Meligy commentedon Feb 27, 2019
Based on that file, it might also be correct that the actual fix is removing
_from:vscode-ng-language-service/server/src/server.ts
Line 92 in f5e2317
olivermuc commentedon Mar 6, 2019
It seems like the logical place to make the change, but for whatever reason this did not fix it for me, I tried.
myml commentedon Mar 6, 2019
Same issue here
afonsoma9 commentedon May 23, 2019
Same issue here
jgraffin commentedon Jun 26, 2019
Same issue here! Any workaround to resolve this?
viiskies commentedon Jul 22, 2019
Same
kyliau commentedon Nov 8, 2019
@ayazhafiz fixed this in angular/angular#33091
For reference, this is how the word boundary was determined before:
vscode-ng-language-service/server/src/server.ts
Lines 90 to 107 in a9f4440
Starting from v0.900.0, the replacement span is determined by looking at the proper AST.
angular-automatic-lock-bot commentedon Feb 17, 2020
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.