Return string completions for indexed access types#20941
Conversation
DanielRosenwasser
left a comment
There was a problem hiding this comment.
Looks good! Though I would also rename the test completionForStringLiteral14.ts to completionForStringLiteralInIndexedAccess01.ts
| return undefined; | ||
| } | ||
|
|
||
| function getStringLiteralCompletionsFromIndexedAccess(node: IndexedAccessTypeNode, typeChecker: TypeChecker, target: ScriptTarget, log: Log): CompletionInfo | undefined { |
There was a problem hiding this comment.
Since this is mostly the same as getStringLiteralCompletionEntriesFromElementAccess, I would combine them into getStringLiteralCompletionEntriesFromElementAccessOrIndexedAccess, and call them with the appropriate type and stringLiteralNode.
There was a problem hiding this comment.
That definitely makes sense. Would you be okay with stringLiteralNode: Node as a parameter, or would you prefer stringLiteralNode: StringLiteral | NoSubstitutionTemplateLiteral?
613f15d to
73d4461
Compare
|
@DanielRosenwasser I've updated the PR based on your feedback. Instead of doing manual |
|
@mariusschulz can you please refresh the PR and address the merge conflicts |
73d4461 to
be0c57d
Compare
be0c57d to
25c5e57
Compare
|
@mhegazy Sure, done! |
|
Thanks Marius! |
Fixes #20938
This PR provides string literal completions within indexed access types.
Does this look good to you, @DanielRosenwasser? Let me know if you need me to add anything else.