mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-21 00:07:16 +09:00
74 lines
1.5 KiB
Go
74 lines
1.5 KiB
Go
package lsp
|
|
|
|
import (
|
|
"github.com/sourcegraph/go-lsp"
|
|
)
|
|
|
|
func (s *Server) DidOpen(filename, language, text string, version int) {
|
|
doc := lsp.TextDocumentItem{
|
|
URI: lsp.DocumentURI("file://" + filename),
|
|
LanguageID: language,
|
|
Version: version,
|
|
Text: text,
|
|
}
|
|
|
|
params := lsp.DidOpenTextDocumentParams{
|
|
TextDocument: doc,
|
|
}
|
|
|
|
go s.SendMessage("textDocument/didOpen", params)
|
|
}
|
|
|
|
func (s *Server) DidSave(filename string) {
|
|
doc := lsp.TextDocumentIdentifier{
|
|
URI: lsp.DocumentURI("file://" + filename),
|
|
}
|
|
|
|
params := lsp.DidSaveTextDocumentParams{
|
|
TextDocument: doc,
|
|
}
|
|
go s.SendMessage("textDocument/didSave", params)
|
|
}
|
|
|
|
func (s *Server) DidChange(filename string, version int, changes []lsp.TextDocumentContentChangeEvent) {
|
|
doc := lsp.VersionedTextDocumentIdentifier{
|
|
TextDocumentIdentifier: lsp.TextDocumentIdentifier{
|
|
URI: lsp.DocumentURI("file://" + filename),
|
|
},
|
|
Version: version,
|
|
}
|
|
|
|
params := lsp.DidChangeTextDocumentParams{
|
|
TextDocument: doc,
|
|
ContentChanges: changes,
|
|
}
|
|
go s.SendMessage("textDocument/didChange", params)
|
|
}
|
|
|
|
func (s *Server) DidClose(filename string) {
|
|
doc := lsp.TextDocumentIdentifier{
|
|
URI: lsp.DocumentURI("file://" + filename),
|
|
}
|
|
|
|
params := lsp.DidCloseTextDocumentParams{
|
|
TextDocument: doc,
|
|
}
|
|
go s.SendMessage("textDocument/didClose", params)
|
|
}
|
|
|
|
func (s *Server) DocumentFormat() {
|
|
|
|
}
|
|
|
|
func (s *Server) DocumentRangeFormat() {
|
|
|
|
}
|
|
|
|
func (s *Server) Completion() {
|
|
|
|
}
|
|
|
|
func (s *Server) CompletionResolve() {
|
|
|
|
}
|