-
Notifications
You must be signed in to change notification settings - Fork 97
/
Copy pathcapabilities.R
88 lines (76 loc) · 2.27 KB
/
capabilities.R
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
SaveOptions <- list(
includeText = TRUE
)
TextDocumentSyncKind <- list(
None = 0,
Full = 1,
Incremental = 2
)
TextDocumentSyncOptions <- list(
openClose = TRUE,
change = TextDocumentSyncKind$Full,
willSave = FALSE,
willSaveWaitUntil = FALSE,
save = SaveOptions
)
CompletionOptions <- list(
resolveProvider = TRUE,
triggerCharacters = list(".", ":")
)
SignatureHelpOptions <- list(
triggerCharacters = list("(", ",")
)
CodeLensOptions <- list(
resolveProvider = FALSE
)
DocumentOnTypeFormattingOptions <- list(
firstTriggerCharacter = "\n",
moreTriggerCharacter = list(")", "]", "}")
)
DocumentLinkOptions <- list(
resolveProvider = TRUE
)
RenameOptions <- list(
prepareProvider = TRUE
)
ExecuteCommandOptions <- list(
commands = NULL
)
ServerCapabilities <- list(
textDocumentSync = TextDocumentSyncOptions,
hoverProvider = TRUE,
completionProvider = CompletionOptions,
signatureHelpProvider = SignatureHelpOptions,
# typeDefinitionProvider = FALSE,
# implementationProvider = FALSE,
definitionProvider = TRUE,
referencesProvider = TRUE,
documentHighlightProvider = TRUE,
documentSymbolProvider = TRUE,
workspaceSymbolProvider = TRUE,
codeActionProvider = TRUE,
# codeLensProvider = CodeLensOptions,
documentFormattingProvider = TRUE,
documentRangeFormattingProvider = TRUE,
documentOnTypeFormattingProvider = DocumentOnTypeFormattingOptions,
renameProvider = TRUE,
documentLinkProvider = DocumentLinkOptions,
colorProvider = TRUE,
foldingRangeProvider = TRUE,
selectionRangeProvider = TRUE,
callHierarchyProvider = TRUE
# linkedEditingRangeProvider = FALSE,
# semanticTokensProvider = FALSE,
# monikerProvider = FALSE,
# executeCommandProvider = ExecuteCommandOptions,
# workspace = list()
)
update_server_capabilities <- function(server_capabilities, client_capabilities) {
# RenameOptions may only be specified if the client states that
# it supports prepareSupport in its initial initialize request
if (isTRUE(server_capabilities$renameProvider) &&
isTRUE(client_capabilities$textDocument$rename$prepareSupport)) {
server_capabilities$renameProvider <- RenameOptions
}
server_capabilities
}