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

Use insertText to add string literal completions #21408

Closed
ghost opened this issue Jan 25, 2018 · 2 comments
Closed

Use insertText to add string literal completions #21408

ghost opened this issue Jan 25, 2018 · 2 comments
Labels
Experience Enhancement Noncontroversial enhancements In Discussion Not yet reached consensus Suggestion An idea for TypeScript
Milestone

Comments

@ghost
Copy link

ghost commented Jan 25, 2018

TypeScript Version: 2.8.0-dev.20180125

Code

const x: "a" | "b" = /**/

Expected behavior:

Get "a" and "b" as completions (in addition to global symbols).

Actual behavior:

No useful completions.

Issue from #21372 (comment)

@ghost ghost added the Suggestion An idea for TypeScript label Jan 25, 2018
@RyanCavanaugh RyanCavanaugh added the Experience Enhancement Noncontroversial enhancements label Aug 22, 2018
@weswigham weswigham added the In Discussion Not yet reached consensus label Nov 6, 2018
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Aug 16, 2019
@zardoy
Copy link
Contributor

zardoy commented Feb 8, 2023

@RyanCavanaugh I guess it is not valid anymore?

https://www.typescriptlang.org/play?#code/MYewdgzgLgBAhgLhgcjsmBeFyg

const literals = mapDefined(
contextualType && (contextualType.isUnion() ? contextualType.types : [contextualType]),
t => t.isLiteral() && !(t.flags & TypeFlags.EnumLiteral) ? t.value : undefined);

@jakebailey
Copy link
Member

Yeah, this has been supported since at least TS 3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Experience Enhancement Noncontroversial enhancements In Discussion Not yet reached consensus Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants