Skip to content

Object literal completions in declaration initializer include declared variable #41731

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
andrewbranch opened this issue Nov 30, 2020 · 1 comment · Fixed by #42087
Closed
Labels
Bug A bug in TypeScript Domain: Completion Lists The issue relates to showing completion lists in an editor Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Help Wanted You can do this
Milestone

Comments

@andrewbranch
Copy link
Member

TypeScript Version: 4.1.2

Search Terms: object literal completions

Code

const obj = { prop: o/**/ };

Expected behavior: No completion for obj, because that would be a used-before-declared error

Actual behavior: Completion for obj offered

Playground Link: https://www.typescriptlang.org/play?#code/MYewdgzgLgBCBGArGBeGBvGAHATiLAXHDAL4DcQA

Related Issues: #41539

@andrewbranch andrewbranch added Bug A bug in TypeScript Help Wanted You can do this Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Domain: Completion Lists The issue relates to showing completion lists in an editor labels Nov 30, 2020
@andrewbranch andrewbranch added this to the Backlog milestone Nov 30, 2020
@chenjigeng
Copy link
Contributor

I have found a method, which is to find the literal object declaration of the current node and then go through the symbols to determine whether it contains the declaration. If it does, remove the symbol. please help CR @andrewbranch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Completion Lists The issue relates to showing completion lists in an editor Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Help Wanted You can do this
Projects
None yet
2 participants