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

Should not block completions when let a on the previous line #54729

Closed
zardoy opened this issue Jun 21, 2023 · 6 comments Β· Fixed by #55061
Closed

Should not block completions when let a on the previous line #54729

zardoy opened this issue Jun 21, 2023 · 6 comments Β· Fixed by #55061
Labels
Domain: Completion Lists The issue relates to showing completion lists in an editor Experience Enhancement Noncontroversial enhancements Fix Available A PR has been opened for this issue Help Wanted You can do this Suggestion An idea for TypeScript

Comments

@zardoy
Copy link
Contributor

zardoy commented Jun 21, 2023

Bug Report

πŸ”Ž Search Terms

no let variable completions suggestions

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

let superLongVariable

// No completions here

πŸ™ Actual behavior

No completions

πŸ™‚ Expected behavior

Should not block completions

Note: it is different from #54654 as it is not regression, TypeScript was always blocking it as I remember, but I do not understand why e.g. we can have something like this:

let superLongVariable
superLongVariable = 5
@MartinJohns
Copy link
Contributor

but I do not understand why e.g. we can have something like this:

let superLongVariable
superLongVariable = 5

Because of ASI this is essentially:

let superLongVariable;
superLongVariable = 5;

And this is valid code.

@fatcerberus
Copy link

@MartinJohns I think that’s what OP meant - it is valid code, so TS should offer a completion for superLongVariable there, but doesn’t.

TypeScript was always blocking it as I remember, but I do not understand why [this is the case when] we can have something like this:

@RyanCavanaugh
Copy link
Member

The problem is that you could be writing

let superLongVariable
= 4;

and we have logic that basically says if you're possibly about to write that =, we shouldn't offer completions.

Seems tweakable though

@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript Help Wanted You can do this Domain: Completion Lists The issue relates to showing completion lists in an editor Experience Enhancement Noncontroversial enhancements labels Jun 22, 2023
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Jun 22, 2023
@fatcerberus
Copy link

Actually it looks like this does already work?

image

@gabritto
Copy link
Member

Actually it looks like this does already work?

image

That looks like a "word completion", not a TS completion.

@svipas
Copy link

svipas commented Jul 18, 2023

Same issue happens with this code:

const obj = {
  name: '',
} as const

// no completions of `obj`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: Completion Lists The issue relates to showing completion lists in an editor Experience Enhancement Noncontroversial enhancements Fix Available A PR has been opened for this issue Help Wanted You can do this Suggestion An idea for TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants