-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Provide string completions for in
keyword checks
#60272
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @target: esnext | ||
|
||
//// declare const obj: { | ||
//// a?: string; | ||
//// b: number; | ||
//// }; | ||
//// | ||
//// if ("/*1*/" in obj) {} | ||
//// if (((("/*2*/"))) in obj) {} | ||
//// if ("/*3*/" in (((obj)))) {} | ||
//// if (((("/*4*/"))) in (((obj)))) {} | ||
//// | ||
//// type MyUnion = { missing: true } | { result: string }; | ||
//// declare const u: MyUnion; | ||
//// if ("/*5*/" in u) {} | ||
//// | ||
//// class Cls1 { foo = ''; #bar = 0; } | ||
//// declare const c1: Cls1; | ||
//// if ("/*6*/" in c1) {} | ||
//// | ||
//// class Cls2 { foo = ''; private bar = 0; } | ||
//// declare const c2: Cls2; | ||
//// if ("/*7*/" in c2) {} | ||
|
||
verify.completions({ | ||
marker: ["1", "2", "3", "4"], | ||
exact: ["a", "b"], | ||
}); | ||
verify.completions({ | ||
marker: "5", | ||
exact: ["missing", "result"], | ||
}); | ||
verify.completions({ | ||
marker: "6", | ||
exact: ["foo"], | ||
}); | ||
verify.completions({ | ||
marker: "7", | ||
exact: ["bar", "foo"], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This includes a completion from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is cursed and I hate it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Amen. |
||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that we will aggressively complete in this position? Does this need to return true if any type has a string/number index signature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only used to return value for
isNewIdentifierLocation
and I don't quite understand what this is meant to represent. IIRC it, at times, works inconsistently anyway. I'd love to be able to tell what should be returned for it here but I simply just don't know ;p