diff --git a/langserver/handle_initialize.go b/langserver/handle_initialize.go index f464fad..09556d4 100644 --- a/langserver/handle_initialize.go +++ b/langserver/handle_initialize.go @@ -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 } @@ -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 != "" { @@ -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 {