mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-18 23:15:26 +02:00
27 lines
433 B
Go
27 lines
433 B
Go
package handlers
|
|
|
|
import (
|
|
"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
|
|
}
|
|
|
|
errors := Parser.ParseFromFile(string(readBytes))
|
|
|
|
if len(errors) > 0 {
|
|
return errors[0]
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
|