Skip to content

Commit b9644a2

Browse files
authored
fix: incorrect initialization for initializationOptions, remove unused documentationFormat field (fix #145) (#146)
1 parent bc2aa29 commit b9644a2

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

src/lsp/completion.v

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ pub mut:
99
pub struct CompletionItemSettings {
1010
snippet_support bool @[json: snippetSupport]
1111
commit_characters_support bool @[json: commitCharactersSupport]
12-
documentation_format bool @[json: documentationFormat]
1312
preselect_support bool @[json: preselectSupport]
1413
deprecated_support bool @[json: deprecatedSupport]
1514
tag_support ValueSet @[json: tag_support]

src/lsp/initialize.v

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
module lsp
22

3+
// TODO: These LSPAny need to change to `?LSPAny` too.
4+
type LSPAny = []LSPAny | map[string]LSPAny | f64 | bool | string
5+
36
// method: ‘initialize’
47
// response: InitializeResult
58
pub struct InitializeParams {
69
pub mut:
7-
process_id int = -2 @[json: processId]
8-
client_info ClientInfo @[json: clientInfo]
9-
root_uri DocumentUri @[json: rootUri]
10-
root_path DocumentUri @[json: rootPath]
11-
initialization_options string @[json: initializationOptions]
10+
process_id int = -2 @[json: processId]
11+
client_info ClientInfo @[json: clientInfo]
12+
root_uri DocumentUri @[json: rootUri]
13+
root_path DocumentUri @[json: rootPath]
14+
// TODO: Change this to `?LSPAny` once V fixed its JSON decoder codegen. (or shall we use json2?)
15+
initialization_options LSPAny @[json: initializationOptions]
1216
capabilities ClientCapabilities
1317
trace string
1418
workspace_folders []WorkspaceFolder @[skip]

src/server/general.v

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ pub fn (mut ls LanguageServer) initialize(params lsp.InitializeParams, mut wr Re
2525
ls.status = .initialized
2626

2727
ls.progress.support_work_done_progress = params.capabilities.window.work_done_progress
28-
ls.initialization_options = params.initialization_options.fields()
28+
options := params.initialization_options
29+
if options is string {
30+
ls.initialization_options = options.fields()
31+
}
2932

3033
ls.print_info(params.process_id, params.client_info)
3134
ls.setup()

0 commit comments

Comments
 (0)