Skip to content

Commit

Permalink
fix: parse initializationOptions even more correctly
Browse files Browse the repository at this point in the history
But because of some problem within the V's json decode generator it's
not possible to handle it prefectly with V's json module yet (optional
type not handled correctly for sumtype & other types except struct)
  • Loading branch information
onion108 committed Dec 14, 2024
1 parent 98700e2 commit c17cc35
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/lsp/initialize.v
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
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 {
Expand All @@ -8,7 +16,8 @@ pub mut:
client_info ClientInfo @[json: clientInfo]
root_uri DocumentUri @[json: rootUri]
root_path DocumentUri @[json: rootPath]
initialization_options string @[json: initializationOptions; skip]
// 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 c17cc35

Please sign in to comment.