mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-18 23:15:26 +02:00
feat: Add simple TextDocumentCompletion example
This commit is contained in:
parent
1d452369d0
commit
dba463ff05
17
main.go
17
main.go
@ -27,6 +27,7 @@ func main() {
|
|||||||
Initialized: initialized,
|
Initialized: initialized,
|
||||||
Shutdown: shutdown,
|
Shutdown: shutdown,
|
||||||
SetTrace: setTrace,
|
SetTrace: setTrace,
|
||||||
|
TextDocumentCompletion: TextDocumentCompletion,
|
||||||
}
|
}
|
||||||
|
|
||||||
server := server.NewServer(&handler, lsName, false)
|
server := server.NewServer(&handler, lsName, false)
|
||||||
@ -59,3 +60,19 @@ func setTrace(context *glsp.Context, params *protocol.SetTraceParams) error {
|
|||||||
protocol.SetTraceValue(params.Value)
|
protocol.SetTraceValue(params.Value)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TextDocumentCompletion(context *glsp.Context, params *protocol.CompletionParams) (interface{}, error) {
|
||||||
|
var completions []protocol.CompletionItem
|
||||||
|
|
||||||
|
Label := "happyface"
|
||||||
|
text := "Hello World!"
|
||||||
|
|
||||||
|
completions = append(completions, protocol.CompletionItem{
|
||||||
|
Label: Label,
|
||||||
|
Detail: &text,
|
||||||
|
InsertText: &text,
|
||||||
|
})
|
||||||
|
|
||||||
|
return completions, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
5
nvim-lsp-debug.lua
Normal file
5
nvim-lsp-debug.lua
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
vim.lsp.start {
|
||||||
|
name = "config-lsp",
|
||||||
|
cmd = { "./bin/config-lsp" },
|
||||||
|
root_dir = vim.fn.getcwd(),
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user