microsoft / microsoft/TypeScript
Should intellisense suggest block scoped values before they are declared?
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
Currently intellisense suggests every block scoped declaration in scope, even if the suggestion is located within the TDZ. When accepting that suggestion, TypeScript issue an used before its declaration error:
new /**/; // suggests 'Clazz', which results in an error
class Clazz {}
function test(
foo = /**/, // suggests `foo`, `bar` and `baz`, all of them result in an error
bar = /**/, // suggests `bar` and `baz`, both result in an error
) {
let baz = 1;
}
Should intellisense filter out suggestions that would result in an error? If so, it should probably use the same condition as the checker.
Related: #28472 #28471
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Start by locating the IntelliSense completion logic for block-scoped declarations and compare its filtering with the checker's used-before-declaration condition; done means TDZ-invalid suggestions such as Clazz, foo, bar, and baz are excluded while valid suggestions remain available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100