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)
I got same issue.
I accidentally posted the same issue here: https://github.com/Microsoft/vscode/issues/56077
I case you need another example.
Could it be related to this line:
https://github.com/angular/vscode-ng-language-service/blob/f0d3e2a48e05f2bca854b2109f11250feed8aa2d/server/src/server.ts#L91
No updates on this?
I have the exact same issue.
On the template, the properties with underscore don't get suggested.
I have same issue. I tried to investigate.
Problem is probably caused by using deprecated field CompletionItem.textEdit
https://code.visualstudio.com/api/references/vscode-api#CompletionItem
The commit https://github.com/angular/vscode-ng-language-service/commit/63db79256e69e4fe0d2db22b621cd54795134523 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 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.
..."improve text insertion for attributes"
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 https://github.com/angular/vscode-ng-language-service/issues/258#issuecomment-412037859 , 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!
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: https://github.com/angular/vscode-ng-language-service/blob/f5e23171bcfad1d3af55164f9a1ea57f5aa2e0f3/server/src/server.ts#L97
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.
Same issue here
It's really all about commenting out this line:
vscode-ng-language-service/server/src/server.ts
Line 97 in f5e2317
return TextEdit.replace(range, insertText);
Based on that file, it might also be correct that the actual fix is removing _ from:
It's really all about commenting out this line:
vscode-ng-language-service/server/src/server.ts
Line 97 in f5e2317return TextEdit.replace(range, insertText);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
const special = /(|)|[|]|*|-|_|./;
It seems like the logical place to make the change, but for whatever reason this did not fix it for me, I tried.
Same issue here
Same issue here
Same issue here! Any workaround to resolve this?
Same
@ayazhafiz fixed this in https://github.com/angular/angular/pull/33091
For reference, this is how the word boundary was determined before:
https://github.com/angular/vscode-ng-language-service/blob/a9f4440d671600ea32fb300478744dc5ede4c7ed/server/src/server.ts#L90-L107
Starting from v0.900.0, the replacement span is determined by looking at the proper AST.
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._
Most helpful comment
I got same issue.