mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-18 15:05:28 +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,
|
||||
Shutdown: shutdown,
|
||||
SetTrace: setTrace,
|
||||
TextDocumentCompletion: TextDocumentCompletion,
|
||||
}
|
||||
|
||||
server := server.NewServer(&handler, lsName, false)
|
||||
@ -59,3 +60,19 @@ func setTrace(context *glsp.Context, params *protocol.SetTraceParams) error {
|
||||
protocol.SetTraceValue(params.Value)
|
||||
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