-
Notifications
You must be signed in to change notification settings - Fork 0
/
vscode.proposed.inlineCompletionsAdditions.d.ts
89 lines (77 loc) · 3.38 KB
/
vscode.proposed.inlineCompletionsAdditions.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare module 'vscode' {
// https://github.com/microsoft/vscode/issues/124024 @hediet
export namespace languages {
/**
* Registers an inline completion provider.
*
* Multiple providers can be registered for a language. In that case providers are asked in
* parallel and the results are merged. A failing provider (rejected promise or exception) will
* not cause a failure of the whole operation.
*
* @param selector A selector that defines the documents this provider is applicable to.
* @param provider An inline completion provider.
* @param metadata Metadata about the provider.
* @return A {@link Disposable} that unregisters this provider when being disposed.
*/
export function registerInlineCompletionItemProvider(selector: DocumentSelector, provider: InlineCompletionItemProvider, metadata: InlineCompletionItemProviderMetadata): Disposable;
}
export interface InlineCompletionItem {
/**
* If set to `true`, unopened closing brackets are removed and unclosed opening brackets are closed.
* Defaults to `false`.
*/
completeBracketPairs?: boolean;
}
export interface InlineCompletionItemProviderMetadata {
/**
* Specifies a list of extension ids that this provider yields to if they return a result.
* If some inline completion provider registered by such an extension returns a result, this provider is not asked.
*/
yieldTo: string[];
}
export interface InlineCompletionItemProvider {
/**
* @param completionItem The completion item that was shown.
* @param updatedInsertText The actual insert text (after brackets were fixed).
*/
// eslint-disable-next-line local/vscode-dts-provider-naming
handleDidShowCompletionItem?(completionItem: InlineCompletionItem, updatedInsertText: string): void;
/**
* Is called when an inline completion item was accepted partially.
* @param acceptedLength The length of the substring of the inline completion that was accepted already.
*/
// eslint-disable-next-line local/vscode-dts-provider-naming
handleDidPartiallyAcceptCompletionItem?(completionItem: InlineCompletionItem, acceptedLength: number): void;
/**
* Is called when an inline completion item was accepted partially.
* @param info Additional info for the partial accepted trigger.
*/
// eslint-disable-next-line local/vscode-dts-provider-naming
handleDidPartiallyAcceptCompletionItem?(completionItem: InlineCompletionItem, info: PartialAcceptInfo): void;
}
export interface PartialAcceptInfo {
kind: PartialAcceptTriggerKind;
}
export enum PartialAcceptTriggerKind {
Unknown = 0,
Word = 1,
Line = 2,
Suggest = 3,
}
// When finalizing `commands`, make sure to add a corresponding constructor parameter.
export interface InlineCompletionList {
/**
* A list of commands associated with the inline completions of this list.
*/
commands?: Command[];
/**
* When set and the user types a suggestion without derivating from it, the inline suggestion is not updated.
* Defaults to false (might change).
*/
enableForwardStability?: boolean;
}
}