-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Import statement completions #43149
Import statement completions #43149
Changes from 18 commits
60422cb
081f564
48bfb22
9e456b5
89dba08
3a4e275
12bb1fe
0ae905c
e9f3ec1
b5b58f8
c7e9bc7
393fce5
8999db9
6c8457b
db75d56
6e6c8ff
6382ece
409fa90
2ae85af
77b6e3d
5388b30
99ec664
630f200
f60ac89
32fccbb
eb421c0
2506173
cdb7efd
9976d3f
d1afa7a
8550be7
66caaf2
d10aa0c
5e868e3
9ea1bd4
eb52faa
f7028f6
f5df94b
badcd83
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 |
---|---|---|
|
@@ -2127,7 +2127,7 @@ namespace ts.server.protocol { | |
arguments: FormatOnKeyRequestArgs; | ||
} | ||
|
||
export type CompletionsTriggerCharacter = "." | '"' | "'" | "`" | "/" | "@" | "<" | "#"; | ||
export type CompletionsTriggerCharacter = "." | '"' | "'" | "`" | "/" | "@" | "<" | "#" | " "; | ||
|
||
/** | ||
* Arguments for completions messages. | ||
|
@@ -2232,6 +2232,10 @@ namespace ts.server.protocol { | |
* coupled with `replacementSpan` to replace a dotted access with a bracket access. | ||
*/ | ||
insertText?: string; | ||
/** | ||
* `insertText` should be interpreted as a snippet if true. | ||
*/ | ||
isSnippet?: true; | ||
/** | ||
* An optional span that indicates the text to be replaced by this completion item. | ||
* If present, this span should be used instead of the default one. | ||
|
@@ -2247,6 +2251,10 @@ namespace ts.server.protocol { | |
* Identifier (not necessarily human-readable) identifying where this completion came from. | ||
*/ | ||
source?: string; | ||
/** | ||
* Human-readable description of the `source`. | ||
*/ | ||
sourceDisplay?: SymbolDisplayPart[]; | ||
/** | ||
* If true, this completion should be highlighted as recommended. There will only be one of these. | ||
* This will be set when we know the user should write an expression with a certain type and that type is an enum or constructable class. | ||
|
@@ -2308,9 +2316,14 @@ namespace ts.server.protocol { | |
codeActions?: CodeAction[]; | ||
|
||
/** | ||
* Human-readable description of the `source` from the CompletionEntry. | ||
* @deprecated Use `sourceDisplay` instead. | ||
*/ | ||
source?: SymbolDisplayPart[]; | ||
|
||
/** | ||
* Human-readable description of the `source` from the CompletionEntry. | ||
*/ | ||
sourceDisplay?: SymbolDisplayPart[]; | ||
Comment on lines
-2332
to
+2347
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. Aiming to stop overloading the meaning of 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. The editor only pulls on these one at a time right? |
||
} | ||
|
||
/** @deprecated Prefer CompletionInfoResponse, which supports several top-level fields in addition to the array of entries. */ | ||
|
@@ -2332,6 +2345,7 @@ namespace ts.server.protocol { | |
* must be used to commit that completion entry. | ||
*/ | ||
readonly optionalReplacementSpan?: TextSpan; | ||
readonly isIncomplete?: boolean; | ||
readonly entries: readonly CompletionEntry[]; | ||
} | ||
|
||
|
@@ -3277,6 +3291,11 @@ namespace ts.server.protocol { | |
* This affects lone identifier completions but not completions on the right hand side of `obj.`. | ||
*/ | ||
readonly includeCompletionsForModuleExports?: boolean; | ||
/** | ||
* Enables auto-import-style completions on partially-typed import statements. E.g., allows | ||
* `import write|` to be completed to `import { writeFile } from "fs"`. | ||
*/ | ||
readonly includeCompletionsForImportStatements?: boolean; | ||
/** | ||
* If enabled, the completion list will include completions with invalid identifier names. | ||
* For those entries, The `insertText` and `replacementSpan` properties will be set to change from `.x` property access to `["x"]`. | ||
|
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.
The space, in combination with the
isIncomplete
property added, is a targeted fix for the problem described at #31658 (comment).