-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.ts
115 lines (91 loc) · 4.54 KB
/
main.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/* --------------------------------------------------------------------------------------------
* Copyright (c) Remy Suen. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
import {
TextDocument, Position, CompletionItem, Range, CodeActionContext, Command, TextDocumentIdentifier, WorkspaceEdit, Location, DocumentHighlight, SymbolInformation, SignatureHelp, TextEdit, DocumentLink, Hover, FormattingOptions, Diagnostic, MarkupKind
} from 'vscode-languageserver-types';
import { ValidatorSettings } from 'dockerfile-utils';
import { LanguageService } from './languageService';
/**
* An interface for logging errors encountered in the language service.
*/
export interface ILogger {
log(message: string): void;
}
export enum CommandIds {
LOWERCASE = "docker.command.convertToLowercase",
UPPERCASE = "docker.command.convertToUppercase",
EXTRA_ARGUMENT = "docker.command.removeExtraArgument",
DIRECTIVE_TO_BACKTICK = "docker.command.directiveToBacktick",
DIRECTIVE_TO_BACKSLASH = "docker.command.directiveToBackslash",
FLAG_TO_CHOWN = "docker.command.flagToChown",
FLAG_TO_COPY_FROM = "docker.command.flagToCopyFrom",
FLAG_TO_HEALTHCHECK_INTERVAL = "docker.command.flagToHealthcheckInterval",
FLAG_TO_HEALTHCHECK_RETRIES = "docker.command.flagToHealthcheckRetries",
FLAG_TO_HEALTHCHECK_START_PERIOD = "docker.command.flagToHealthcheckStartPeriod",
FLAG_TO_HEALTHCHECK_TIMEOUT = "docker.command.flagToHealthcheckTimeout",
REMOVE_EMPTY_CONTINUATION_LINE = "docker.command.removeEmptyContinuationLine",
CONVERT_TO_AS = "docker.command.convertToAS"
}
export namespace DockerfileLanguageServiceFactory {
export function createLanguageService(): DockerfileLanguageService {
return new LanguageService();
}
}
export interface Capabilities {
/**
* Capabilities related to completion requests.
*/
completion?: {
/**
* Capabilities related to completion items.
*/
completionItem?: {
/**
* Indicates whether completion items for deprecated
* entries should be explicitly flagged in the item.
*/
deprecatedSupport?: boolean;
/**
* Describes the supported content types that can be used
* for a CompletionItem's documentation field.
*/
documentationFormat?: MarkupKind[];
/**
* Indicates whether the snippet syntax should be used in
* returned completion items.
*/
snippetSupport?: boolean;
}
};
/**
* Capabilities related to hover requests.
*/
hover?: {
/**
* Describes the content type that should be returned for hovers.
*/
contentFormat?: MarkupKind[];
}
}
export interface DockerfileLanguageService {
setCapabilities(capabilities: Capabilities);
computeCodeActions(textDocument: TextDocumentIdentifier, range: Range, context: CodeActionContext): Command[];
computeCommandEdits(content: string, command: string, args: any[]): TextEdit[];
computeCompletionItems(content: string, position: Position): CompletionItem[] | PromiseLike<CompletionItem[]>;
resolveCompletionItem(item: CompletionItem): CompletionItem;
computeDefinition(textDocument: TextDocumentIdentifier, content: string, position: Position): Location;
computeHighlightRanges(content: string, position: Position): DocumentHighlight[];
computeHover(content: string, position: Position): Hover | null;
computeSymbols(textDocument: TextDocumentIdentifier, content: string): SymbolInformation[];
computeSignatureHelp(content: string, position: Position): SignatureHelp;
computeRename(textDocument: TextDocumentIdentifier, content: string, position: Position, newName: string): TextEdit[];
computeLinks(content: string): DocumentLink[];
resolveLink(link: DocumentLink): DocumentLink;
validate(content: string, settings?: ValidatorSettings): Diagnostic[];
format(content: string, options: FormattingOptions): TextEdit[];
formatRange(content: string, range: Range, options: FormattingOptions): TextEdit[];
formatOnType(content: string, position: Position, ch: string, options: FormattingOptions): TextEdit[];
setLogger(logger: ILogger): void;
}