Skip to content

Commit

Permalink
Merge pull request #256 from llllvvuu/fix/initializeoptions
Browse files Browse the repository at this point in the history
fix: restore serverCapabilities inference
  • Loading branch information
mattn authored Aug 30, 2023
2 parents 437c94a + 5fd5183 commit 5ca4b86
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions langserver/handle_initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ func (h *langHandler) handleInitialize(_ context.Context, conn *jsonrpc2.Conn, r
var hasRangeFormatCommand bool
var hasDefinitionCommand bool

if params.InitializationOptions != nil {
hasCompletionCommand = params.InitializationOptions.Completion
hasHoverCommand = params.InitializationOptions.Hover
hasCodeActionCommand = params.InitializationOptions.CodeAction
hasSymbolCommand = params.InitializationOptions.DocumentSymbol
hasFormatCommand = params.InitializationOptions.DocumentFormatting
hasRangeFormatCommand = params.InitializationOptions.RangeFormatting
}

if len(h.commands) > 0 {
hasCodeActionCommand = true
}
Expand All @@ -49,6 +58,7 @@ func (h *langHandler) handleInitialize(_ context.Context, conn *jsonrpc2.Conn, r
hasDefinitionCommand = true
}
}

for _, config := range h.configs {
for _, v := range config {
if v.CompletionCommand != "" {
Expand All @@ -69,15 +79,6 @@ func (h *langHandler) handleInitialize(_ context.Context, conn *jsonrpc2.Conn, r
}
}

if params.InitializationOptions != nil {
hasCompletionCommand = params.InitializationOptions.Completion
hasHoverCommand = params.InitializationOptions.Hover
hasCodeActionCommand = params.InitializationOptions.CodeAction
hasSymbolCommand = params.InitializationOptions.DocumentSymbol
hasFormatCommand = params.InitializationOptions.DocumentFormatting
hasRangeFormatCommand = params.InitializationOptions.RangeFormatting
}

if hasCompletionCommand {
chars := []string{"."}
if len(h.triggerChars) > 0 {
Expand Down

0 comments on commit 5ca4b86

Please sign in to comment.