mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-18 23:15:26 +02:00
42 lines
1.0 KiB
Go
42 lines
1.0 KiB
Go
package roothandler
|
|
|
|
import (
|
|
aliases "config-lsp/handlers/aliases/lsp"
|
|
sshconfig "config-lsp/handlers/ssh_config/lsp"
|
|
sshdconfig "config-lsp/handlers/sshd_config/lsp"
|
|
|
|
"github.com/tliron/glsp"
|
|
protocol "github.com/tliron/glsp/protocol_3_16"
|
|
)
|
|
|
|
func TextDocumentDefinition(context *glsp.Context, params *protocol.DefinitionParams) (any, error) {
|
|
language := rootHandler.GetLanguageForDocument(params.TextDocument.URI)
|
|
|
|
if language == nil {
|
|
showParseError(
|
|
context,
|
|
params.TextDocument.URI,
|
|
undetectableError,
|
|
)
|
|
|
|
return nil, undetectableError.Err
|
|
}
|
|
|
|
switch *language {
|
|
case LanguageHosts:
|
|
return nil, nil
|
|
case LanguageSSHDConfig:
|
|
return sshdconfig.TextDocumentDefinition(context, params)
|
|
case LanguageSSHConfig:
|
|
return sshconfig.TextDocumentDefinition(context, params)
|
|
case LanguageFstab:
|
|
return nil, nil
|
|
case LanguageWireguard:
|
|
return nil, nil
|
|
case LanguageAliases:
|
|
return aliases.TextDocumentDefinition(context, params)
|
|
}
|
|
|
|
panic("root-handler/TextDocumentDefinition: unexpected language" + *language)
|
|
}
|