Skip to content

Commit

Permalink
Export command names func to avoid mismatches initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
appilon committed Oct 21, 2020
1 parent 92128bd commit 0a4dce5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions langserver/handlers/execute_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ var executeCommandHandlers = map[string]executeCommandHandler{
"rootmodules": executeCommandRootModulesHandler,
}

func Commands() []string {
var commands []string
for command := range executeCommandHandlers {
commands = append(commands, command)
}
return commands
}

func (lh *logHandler) WorkspaceExecuteCommand(ctx context.Context, params lsp.ExecuteCommandParams) (interface{}, error) {
handler, ok := executeCommandHandlers[params.Command]
if !ok {
Expand Down
2 changes: 1 addition & 1 deletion langserver/handlers/handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const intializeResponse = `{
"documentSymbolProvider":true,
"documentFormattingProvider":true,
"executeCommandProvider": {
"commands": ["rootmodule"]
"commands": ["rootmodules"]
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion langserver/handlers/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (lh *logHandler) Initialize(ctx context.Context, params lsp.InitializeParam
DocumentFormattingProvider: true,
DocumentSymbolProvider: true,
ExecuteCommandProvider: &lsp.ExecuteCommandOptions{
Commands: []string{"rootmodule"},
Commands: Commands(),
},
},
}
Expand Down

0 comments on commit 0a4dce5

Please sign in to comment.