Skip to content

Commit

Permalink
fix: incorrect initialization for initializationOptions, remove unu…
Browse files Browse the repository at this point in the history
…sed `documentationFormat` field (fix #145) (#146)
  • Loading branch information
onion108 authored Dec 22, 2024
1 parent bc2aa29 commit b9644a2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/lsp/completion.v
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ pub mut:
pub struct CompletionItemSettings {
snippet_support bool @[json: snippetSupport]
commit_characters_support bool @[json: commitCharactersSupport]
documentation_format bool @[json: documentationFormat]
preselect_support bool @[json: preselectSupport]
deprecated_support bool @[json: deprecatedSupport]
tag_support ValueSet @[json: tag_support]
Expand Down
14 changes: 9 additions & 5 deletions src/lsp/initialize.v
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
module lsp

// TODO: These LSPAny need to change to `?LSPAny` too.
type LSPAny = []LSPAny | map[string]LSPAny | f64 | bool | string

// method: ‘initialize’
// response: InitializeResult
pub struct InitializeParams {
pub mut:
process_id int = -2 @[json: processId]
client_info ClientInfo @[json: clientInfo]
root_uri DocumentUri @[json: rootUri]
root_path DocumentUri @[json: rootPath]
initialization_options string @[json: initializationOptions]
process_id int = -2 @[json: processId]
client_info ClientInfo @[json: clientInfo]
root_uri DocumentUri @[json: rootUri]
root_path DocumentUri @[json: rootPath]
// TODO: Change this to `?LSPAny` once V fixed its JSON decoder codegen. (or shall we use json2?)
initialization_options LSPAny @[json: initializationOptions]
capabilities ClientCapabilities
trace string
workspace_folders []WorkspaceFolder @[skip]
Expand Down
5 changes: 4 additions & 1 deletion src/server/general.v
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ pub fn (mut ls LanguageServer) initialize(params lsp.InitializeParams, mut wr Re
ls.status = .initialized

ls.progress.support_work_done_progress = params.capabilities.window.work_done_progress
ls.initialization_options = params.initialization_options.fields()
options := params.initialization_options
if options is string {
ls.initialization_options = options.fields()
}

ls.print_info(params.process_id, params.client_info)
ls.setup()
Expand Down

0 comments on commit b9644a2

Please sign in to comment.