Skip to content
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

Improve contextual completions #53554

Merged

Conversation

Andarist
Copy link
Contributor

@Andarist Andarist commented Mar 28, 2023

This PR is meant to bring "regular" completions closer to how equivalent~ string completions work. To get a better grasp of what that means you can look into the changed tests that have ts (within string/quotes) and ts2 (at the same position but not within quotes) markers

fixes #53555

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Mar 28, 2023
@typescript-bot
Copy link
Collaborator

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

////
//// test({ foo: ['a', /*ts*/] })

verify.completions({ marker: ["ts"], includes: ['"a"', '"b"'], isNewIdentifierLocation: true });
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't exactly understand what isNewIdentifierLocation is about. It's true for most of the added test cases but false for object property values. Is this correct? What's the difference between an object property value and an array element's locations? 🤔

Copy link
Member

Choose a reason for hiding this comment

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

My guess is it's just a bad heuristic that could be patched up?

For reference, it's discussed a bit here: #42595 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can look into this in a separate PR - it would be cool to have this consistent.

@fatcerberus
Copy link

This PR: #53554
Fixes: #53555

How did that happen?

@Andarist
Copy link
Contributor Author

Andarist commented Mar 28, 2023

😅

I'm a fortune teller. Do you fancy a palm reading? I can do that for you.

@jgoux
Copy link

jgoux commented Mar 28, 2023

How did that happen?

I asked ChatGPT how to fix my issue but it was so late last night that I was in fact sending prompts to @Andarist in Discord DM. 😂

@typescript-bot typescript-bot added For Backlog Bug PRs that fix a backlog bug and removed For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Suggestions are not listed properly for arrays of generic type in function parameters (contextual completion)
7 participants