fix(sshd_config): Fix hover for match blocks

This commit is contained in:
Myzel394 2024-09-15 15:53:16 +02:00
parent 9b1a5af2d0
commit 1bda1f76e0
No known key found for this signature in database
GPG Key ID: DEC4AAB876F73185
5 changed files with 10 additions and 28 deletions

View File

@ -12,11 +12,13 @@ import (
func GetHoverInfoForOption(
option *ast.SSHOption,
matchBlock *ast.SSHMatchBlock,
line uint32,
cursor uint32,
) (*protocol.Hover, error) {
var docValue *docvalues.DocumentationValue
if matchBlock == nil {
// Either root level or in the line of a match block
if matchBlock == nil || matchBlock.Start.Line == line {
val := fields.Options[option.Key.Value]
docValue = &val
} else {

View File

@ -1,14 +0,0 @@
package lsp
import (
"github.com/tliron/glsp"
protocol "github.com/tliron/glsp/protocol_3_16"
)
func TextDocumentCodeAction(context *glsp.Context, params *protocol.CodeActionParams) ([]protocol.CodeAction, error) {
// document := hosts.DocumentParserMap[params.TextDocument.URI]
//
// actions := make([]protocol.CodeAction, 0, 1)
return nil, nil
}

View File

@ -24,5 +24,10 @@ func TextDocumentHover(
return nil, nil
}
return handlers.GetHoverInfoForOption(option, matchBlock, cursor)
return handlers.GetHoverInfoForOption(
option,
matchBlock,
line,
cursor,
)
}

View File

@ -1,10 +0,0 @@
package lsp
import (
"github.com/tliron/glsp"
protocol "github.com/tliron/glsp/protocol_3_16"
)
func WorkspaceExecuteCommand(context *glsp.Context, params *protocol.ExecuteCommandParams) (*protocol.ApplyWorkspaceEditParams, error) {
return nil, nil
}

View File

@ -3,7 +3,6 @@ package roothandler
import (
aliases "config-lsp/handlers/aliases/lsp"
hosts "config-lsp/handlers/hosts/lsp"
sshdconfig "config-lsp/handlers/sshd_config/lsp"
wireguard "config-lsp/handlers/wireguard/lsp"
"github.com/tliron/glsp"
@ -29,7 +28,7 @@ func TextDocumentCodeAction(context *glsp.Context, params *protocol.CodeActionPa
case LanguageHosts:
return hosts.TextDocumentCodeAction(context, params)
case LanguageSSHDConfig:
return sshdconfig.TextDocumentCodeAction(context, params)
return nil, nil
case LanguageWireguard:
return wireguard.TextDocumentCodeAction(context, params)
case LanguageAliases: