UncommentSelection = "uncommentSelection",
PrepareCallHierarchy = "prepareCallHierarchy",
ProvideCallHierarchyIncomingCalls = "provideCallHierarchyIncomingCalls",
- ProvideCallHierarchyOutgoingCalls = "provideCallHierarchyOutgoingCalls"
+ ProvideCallHierarchyOutgoingCalls = "provideCallHierarchyOutgoingCalls",
+ ProvideInlayHints = "provideInlayHints"
}
/**
* A TypeScript Server message
type OrganizeImportsScope = GetCombinedCodeFixScope;
interface OrganizeImportsRequestArgs {
scope: OrganizeImportsScope;
+ skipDestructiveCodeActions?: boolean;
}
interface OrganizeImportsResponse extends Response {
body: readonly FileCodeEdits[];
*/
file: string;
}
+ interface JSDocTagInfo {
+ /** Name of the JSDoc tag */
+ name: string;
+ /**
+ * Comment text after the JSDoc tag -- the text after the tag name until the next tag or end of comment
+ * Display parts when UserPreferences.displayPartsForJSDoc is true, flattened to string otherwise.
+ */
+ text?: string | SymbolDisplayPart[];
+ }
interface TextSpanWithContext extends TextSpan {
contextStart?: Location;
contextEnd?: Location;
}
interface FileSpanWithContext extends FileSpan, TextSpanWithContext {
}
+ interface DefinitionInfo extends FileSpanWithContext {
+ /**
+ * When true, the file may or may not exist.
+ */
+ unverified?: boolean;
+ }
interface DefinitionInfoAndBoundSpan {
- definitions: readonly FileSpanWithContext[];
+ definitions: readonly DefinitionInfo[];
textSpan: TextSpan;
}
/**
* Definition response message. Gives text range for definition.
*/
interface DefinitionResponse extends Response {
- body?: FileSpanWithContext[];
+ body?: DefinitionInfo[];
}
interface DefinitionInfoAndBoundSpanResponse extends Response {
body?: DefinitionInfoAndBoundSpan;
FixedPollingInterval = "FixedPollingInterval",
PriorityPollingInterval = "PriorityPollingInterval",
DynamicPriorityPolling = "DynamicPriorityPolling",
+ FixedChunkSizePolling = "FixedChunkSizePolling",
UseFsEvents = "UseFsEvents",
UseFsEventsOnParentDirectory = "UseFsEventsOnParentDirectory"
}
const enum WatchDirectoryKind {
UseFsEvents = "UseFsEvents",
FixedPollingInterval = "FixedPollingInterval",
- DynamicPriorityPolling = "DynamicPriorityPolling"
+ DynamicPriorityPolling = "DynamicPriorityPolling",
+ FixedChunkSizePolling = "FixedChunkSizePolling"
}
const enum PollingWatchKind {
FixedInterval = "FixedInterval",
PriorityInterval = "PriorityInterval",
- DynamicPriority = "DynamicPriority"
+ DynamicPriority = "DynamicPriority",
+ FixedChunkSize = "FixedChunkSize"
}
interface WatchOptions {
watchFile?: WatchFileKind | ts.WatchFileKind;
*/
interface QuickInfoRequest extends FileLocationRequest {
command: CommandTypes.Quickinfo;
+ arguments: FileLocationRequestArgs;
}
/**
* Body of QuickInfoResponse.
displayString: string;
/**
* Documentation associated with symbol.
+ * Display parts when UserPreferences.displayPartsForJSDoc is true, flattened to string otherwise.
*/
- documentation: string;
+ documentation: string | SymbolDisplayPart[];
/**
* JSDoc tags associated with symbol.
*/
command: CommandTypes.Formatonkey;
arguments: FormatOnKeyRequestArgs;
}
- type CompletionsTriggerCharacter = "." | '"' | "'" | "`" | "/" | "@" | "<" | "#";
+ type CompletionsTriggerCharacter = "." | '"' | "'" | "`" | "/" | "@" | "<" | "#" | " ";
+ const enum CompletionTriggerKind {
+ /** Completion was triggered by typing an identifier, manual invocation (e.g Ctrl+Space) or via API. */
+ Invoked = 1,
+ /** Completion was triggered by a trigger character. */
+ TriggerCharacter = 2,
+ /** Completion was re-triggered as the current completion list is incomplete. */
+ TriggerForIncompleteCompletions = 3
+ }
/**
* Arguments for completions messages.
*/
* Should be `undefined` if a user manually requested completion.
*/
triggerCharacter?: CompletionsTriggerCharacter;
+ triggerKind?: CompletionTriggerKind;
/**
* @deprecated Use UserPreferences.includeCompletionsForModuleExports
*/
interface CompletionEntryIdentifier {
name: string;
source?: string;
+ data?: unknown;
}
/**
* Completion entry details request; value of command field is
*/
kind: string;
}
+ /** A part of a symbol description that links from a jsdoc @link tag to a declaration */
+ interface JSDocLinkDisplayPart extends SymbolDisplayPart {
+ /** The location of the declaration that the @link tag links to. */
+ target: FileSpan;
+ }
/**
* An item found in a completion response.
*/
* 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.
* 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.
isFromUncheckedFile?: true;
/**
* If true, this completion was for an auto-import of a module not yet in the program, but listed
- * in the project package.json.
+ * in the project package.json. Used for telemetry reporting.
*/
isPackageJsonImport?: true;
+ /**
+ * If true, this completion was an auto-import-style completion of an import statement (i.e., the
+ * module specifier was inserted along with the imported identifier). Used for telemetry reporting.
+ */
+ isImportStatementCompletion?: true;
+ /**
+ * A property to be sent back to TS Server in the CompletionDetailsRequest, along with `name`,
+ * that allows TS Server to look up the symbol represented by the completion item, disambiguating
+ * items with the same name.
+ */
+ data?: unknown;
}
/**
* Additional completion entry details, available on demand
*/
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[];
}
/** @deprecated Prefer CompletionInfoResponse, which supports several top-level fields in addition to the array of entries. */
interface CompletionsResponse extends Response {
* must be used to commit that completion entry.
*/
readonly optionalReplacementSpan?: TextSpan;
+ readonly isIncomplete?: boolean;
readonly entries: readonly CompletionEntry[];
}
interface CompletionDetailsResponse extends Response {
interface SignatureHelpResponse extends Response {
body?: SignatureHelpItems;
}
+ type InlayHintKind = "Type" | "Parameter" | "Enum";
+ interface InlayHintsRequestArgs extends FileRequestArgs {
+ /**
+ * Start position of the span.
+ */
+ start: number;
+ /**
+ * Length of the span.
+ */
+ length: number;
+ }
+ interface InlayHintsRequest extends Request {
+ command: CommandTypes.ProvideInlayHints;
+ arguments: InlayHintsRequestArgs;
+ }
+ interface InlayHintItem {
+ text: string;
+ position: Location;
+ kind: InlayHintKind;
+ whitespaceBefore?: boolean;
+ whitespaceAfter?: boolean;
+ }
+ interface InlayHintsResponse extends Response {
+ body?: InlayHintItem[];
+ }
/**
* Synchronous request for semantic diagnostics of one file.
*/
* 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;
+ /**
+ * Allows completions to be formatted with snippet text, indicated by `CompletionItem["isSnippet"]`.
+ */
+ readonly includeCompletionsWithSnippetText?: 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"]`.
* values, with insertion text to replace preceding `.` tokens with `?.`.
*/
readonly includeAutomaticOptionalChainCompletions?: boolean;
+ /**
+ * If enabled, completions for class members (e.g. methods and properties) will include
+ * a whole declaration for the member.
+ * E.g., `class A { f| }` could be completed to `class A { foo(): number {} }`, instead of
+ * `class A { foo }`.
+ */
+ readonly includeCompletionsWithClassMemberSnippets?: boolean;
+ readonly allowIncompleteCompletions?: boolean;
readonly importModuleSpecifierPreference?: "shortest" | "project-relative" | "relative" | "non-relative";
/** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */
readonly importModuleSpecifierEnding?: "auto" | "minimal" | "index" | "js";
readonly provideRefactorNotApplicableReason?: boolean;
readonly allowRenameOfImportPath?: boolean;
readonly includePackageJsonAutoImports?: "auto" | "on" | "off";
+ readonly jsxAttributeCompletionStyle?: "auto" | "braces" | "none";
+ readonly displayPartsForJSDoc?: boolean;
readonly generateReturnInDocTemplate?: boolean;
}
interface CompilerOptions {
ES2018 = "ES2018",
ES2019 = "ES2019",
ES2020 = "ES2020",
+ ES2021 = "ES2021",
ESNext = "ESNext"
}
const enum ClassificationType {
* interface Y { foo:number; }
*/
memberVariableElement = "property",
- /** class X { constructor() { } } */
+ /**
+ * class X { constructor() { } }
+ * class X { static { } }
+ */
constructorImplementationElement = "constructor",
/** interface Y { ():number; } */
callSignatureElement = "call",
*/
jsxAttribute = "JSX attribute",
/** String literal */
- string = "string"
+ string = "string",
+ /** Jsdoc @link: in `{@link C link text}`, the before and after text "{@link " and "}" */
+ link = "link",
+ /** Jsdoc @link: in `{@link C link text}`, the entity name "C" */
+ linkName = "link name",
+ /** Jsdoc @link: in `{@link C link text}`, the link text "link text" */
+ linkText = "link text"
}
export interface TypeAcquisition {
scriptKind?: ScriptKind;
}
- interface JSDocTagInfo {
- name: string;
- text?: string;
- }
-
/**
* Type of objects whose values are all of the same type.
* The `in` and `for-in` operators can *not* be safely used,