feat(language-service): support autocomplete string literal union typ… #42729
Conversation
43fb8fe
to
cee87c2
I don't notice there have a pr for it. I think the reason is the vscode does not trigger suggest here |
ef9e809
to
57704fd
I add a new commit to fix a bug of #41456 |
Autocompleting string literal union types was already implemented in #41456. AFAIK, the current implementation works fine, except that is does not support string union types in binding without brackets. We could consolidate approaches to make this works for bindings without brackets. i imagine angular developers would find that helpful. Requesting changes because this feature should not be a special case at the completion builder level. we should first detect if we're completing the value of an attribute, then detect if we can complete a string literal value. |
|
a9c9318
to
a318416
1d15835
to
133fcaf
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the |
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the |
76810ba
to
350fa4a
Awesome work. the implementation looks good, couldn't find anything wrong with it. I left a few comments about the tests, and I did more testing of this on my machine. Are pipe arguments supposed to work, or is that out-of-scope? i couldn't get this to complete a pipe argument
|
…es in templates The native TS language service has the ability to provide autocompletions for string literal union types. This pr is for Angular to do the same in templates. Fixes angular/vscode-ng-language-service#1096
…ion types in templates
350fa4a
to
9fbd42b
it('should complete a string union types in pipe', () => { | ||
const {templateFile} = | ||
setup(`<input dir [myInput]="'foo'|unionTypePipe:'bar'">`, '', UNION_TYPE_PIPE); | ||
templateFile.moveCursorToText(`[myInput]="'foo'|unionTypePipe:'bar¦'"`); | ||
const completions = templateFile.getCompletionsAtPosition(); | ||
expectContain(completions, ts.ScriptElementKind.string, ['bar']); | ||
expectReplacementText(completions, templateFile.contents, 'bar'); | ||
}); |
The caretaker tool insists that because this has |
…es in templates
The native TS language service has the ability to provide autocompletions for
string literal union types. This pr is for Angular to do the same in templates.
Fixes angular/vscode-ng-language-service#1096
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information