-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathserver-extended.ts
125 lines (107 loc) · 3.42 KB
/
server-extended.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
116
117
118
119
120
121
122
123
124
125
// tslint:disable:interface-name
import { RequestType } from 'vscode-jsonrpc';
import {
CodeActionContext, Location, NotificationType,
Position, Range, TextDocumentIdentifier, TextDocumentPositionParams,
WorkspaceEdit
} from 'vscode-languageserver';
export interface ExtendedServerCapabilities {
extended: {
getCodeActionsProvider?: boolean;
runCodeActionProvider?: boolean;
implementationProvider?: boolean;
navigateProvider?: boolean;
highlightProvider?: boolean;
};
}
export interface ClientCapabilities {
highlightProvider?: boolean;
enablePackageRestore?: boolean;
}
export interface GetCodeActionsParams {
/**
* The document in which the command was invoked.
*/
textDocument: TextDocumentIdentifier;
/**
* The range for which the command was invoked.
*/
range: Range;
/**
* Context carrying additional information.
*/
context: CodeActionContext;
}
export interface NavigateParams extends TextDocumentPositionParams {
direction: 'up' | 'down';
}
export interface CodeActionList {
codeActions: CodeAction[];
}
export interface CodeAction {
name: string;
identifier: string;
}
export interface PublishHighlightParams {
uri: string;
added: Highlight[];
removed: string[];
}
export interface Highlight {
id: string;
range: Range;
kind: string;
// projects: string[];
}
export type Implementation = Location | Location[];
export interface RunCodeActionParams extends GetCodeActionsParams {
/**
* The identifier of the code action to execute
*/
identifier: string;
}
// tslint:disable:no-mergeable-namespace
export namespace Methods {
export namespace Extended {
// tslint:disable:variable-name
// tslint:disable:no-shadowed-variable
export const GetCodeActionsRequest = '__extended/textDocument/getCodeActions';
export const RunCodeActionRequest = '__extended/textDocument/runCodeAction';
export const ImplementationRequest = '__extended/textDocument/implementation';
export const NavigateRequest = '__extended/textDocument/navigate';
export const PublishHighlightNotification = '__extended/textDocument/publishHighlight';
// tslint:enable:no-shadowed-variable
// tslint:enable:variable-name
}
}
/**
* A request to rename a symbol.
*/
export namespace GetCodeActionsRequest {
export const type = new RequestType<GetCodeActionsParams, CodeActionList, void, void>(Methods.Extended.GetCodeActionsRequest);
}
/**
* A request to rename a symbol.
*/
export namespace RunCodeActionRequest {
export const type = new RequestType<RunCodeActionParams, WorkspaceEdit, void, void>(Methods.Extended.RunCodeActionRequest);
}
/**
* A request to find implementation
*/
export namespace ImplementationRequest {
export const type = new RequestType<TextDocumentPositionParams, Implementation, void, void>(Methods.Extended.ImplementationRequest);
}
/**
* A request to find implementation
*/
export namespace NavigateRequest {
export const type = new RequestType<NavigateParams, Position, void, void>(Methods.Extended.NavigateRequest);
}
/**
* Diagnostics notification are sent from the server to the client to signal
* results of validation runs.
*/
export namespace HighlightNotification {
export const type = new NotificationType<PublishHighlightParams, void>(Methods.Extended.PublishHighlightNotification);
}