Skip to content

Suggest completions for newline-delimited type argument properties #62175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/services/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5757,6 +5757,7 @@ function tryGetTypeLiteralNode(node: Node): TypeLiteralNode | undefined {
case SyntaxKind.SemicolonToken:
case SyntaxKind.CommaToken:
case SyntaxKind.Identifier:
case SyntaxKind.StringKeyword:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me this PR focuses on StringKeyword but what about other tokens? Like even the NumberKeyword? And doesn't this change mean that now completions would be suggested at the same line too (like at five: string /*marker*/)?

Copy link
Contributor Author

@mkantor mkantor Aug 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, you're right. I must've had a brain fart this morning; I think I read StringKeyword as StringKey and thought it referred to property names, but in retrospect that obviously doesn't make sense. I'll close this for now and reopen with a more general fix when I have a chance. Thanks for the comments.

if (parent.kind === SyntaxKind.PropertySignature && isTypeLiteralNode(parent.parent)) {
return parent.parent;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
////var foobar: Bar<{
//// two: {
//// three: {
//// five: string,
//// five: string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add a new test case instead of removing the comma from the old one. The old test case is different and it's still worth testing it.

//// /*4*/
//// },
//// /*0*/
Expand Down
Loading