mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-18 23:15:26 +02:00
26 lines
542 B
Go
26 lines
542 B
Go
package openssh
|
|
|
|
import (
|
|
"config-lsp/common"
|
|
"os"
|
|
|
|
"github.com/tliron/glsp"
|
|
protocol "github.com/tliron/glsp/protocol_3_16"
|
|
)
|
|
|
|
func TextDocumentDidOpen(context *glsp.Context, params *protocol.DidOpenTextDocumentParams) error {
|
|
readBytes, err := os.ReadFile(params.TextDocument.URI[len("file://"):])
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
diagnostics := DiagnoseParser(context, params.TextDocument.URI, string(readBytes))
|
|
|
|
if len(diagnostics) > 0 {
|
|
common.SendDiagnostics(context, params.TextDocument.URI, diagnostics)
|
|
}
|
|
|
|
return nil
|
|
}
|