mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-18 15:05:28 +02:00
26 lines
695 B
Go
26 lines
695 B
Go
package lsp
|
|
|
|
import (
|
|
"config-lsp/handlers/wireguard"
|
|
"config-lsp/handlers/wireguard/handlers"
|
|
|
|
"github.com/tliron/glsp"
|
|
protocol "github.com/tliron/glsp/protocol_3_16"
|
|
)
|
|
|
|
func TextDocumentCodeAction(context *glsp.Context, params *protocol.CodeActionParams) ([]protocol.CodeAction, error) {
|
|
d := wireguard.DocumentParserMap[params.TextDocument.URI]
|
|
|
|
actions := make([]protocol.CodeAction, 0, 2)
|
|
|
|
actions = append(actions, handlers.GetKeyGenerationCodeActions(d, params)...)
|
|
actions = append(actions, handlers.GetKeepaliveCodeActions(d, params)...)
|
|
actions = append(actions, handlers.GetAddPeerLikeThis(d, params)...)
|
|
|
|
if len(actions) > 0 {
|
|
return actions, nil
|
|
}
|
|
|
|
return nil, nil
|
|
}
|