update tcl standard

This commit is contained in:
Christoph Brandau
2025-07-17 15:01:02 +02:00
parent 9390ad4569
commit f482c8db87
3 changed files with 27 additions and 8 deletions
+20 -5
View File
@@ -1,10 +1,25 @@
{ {
"tcl": [ "tcl": [
"proc", {
"puts", "label": "proc",
"if", "kind": "keyword"
"else", },
"elseif" {
"label": "if",
"kind": "keyword"
},
{
"label": "else",
"kind": "keyword"
},
{
"label": "elseif",
"kind": "keyword"
},
{
"label": "puts",
"kind": "function"
}
], ],
"MOM_procs": [ "MOM_procs": [
{ {
+5 -1
View File
@@ -11,6 +11,7 @@ KIND_MAP = {
"field": lsp.CompletionItemKind.Field, "field": lsp.CompletionItemKind.Field,
"module": lsp.CompletionItemKind.Module, "module": lsp.CompletionItemKind.Module,
"namespace": lsp.CompletionItemKind.Class, "namespace": lsp.CompletionItemKind.Class,
"keyword": lsp.CompletionItemKind.Keyword,
} }
@@ -41,7 +42,10 @@ class StandardCompletionItems:
items = [] items = []
for i in data.get("tcl", []): for i in data.get("tcl", []):
items.append( items.append(
lsp.CompletionItem(label=i, kind=lsp.CompletionItemKind.Keyword) lsp.CompletionItem(
label=i.get("label", ""),
kind=KIND_MAP.get(i.get("kind", ""), lsp.CompletionItemKind.Text),
)
) )
return items return items
+2 -2
View File
@@ -74,13 +74,13 @@ TOOL_ARGS = [] # default arguments always passed to your tool.
@LSP_SERVER.feature(lsp.TEXT_DOCUMENT_DID_OPEN) @LSP_SERVER.feature(lsp.TEXT_DOCUMENT_DID_OPEN)
def did_open(params: lsp.DidOpenTextDocumentParams) -> None: def did_open(params: lsp.DidOpenTextDocumentParams) -> None:
"""LSP handler for textDocument/didOpen request.""" """LSP handler for textDocument/didOpen request."""
document = LSP_SERVER.workspace.get_document(params.text_document.uri) document = LSP_SERVER.workspace.get_text_document(params.text_document.uri)
@LSP_SERVER.feature(lsp.TEXT_DOCUMENT_DID_SAVE) @LSP_SERVER.feature(lsp.TEXT_DOCUMENT_DID_SAVE)
def did_save(params: lsp.DidSaveTextDocumentParams) -> None: def did_save(params: lsp.DidSaveTextDocumentParams) -> None:
"""LSP handler for textDocument/didSave request.""" """LSP handler for textDocument/didSave request."""
document = LSP_SERVER.workspace.get_document(params.text_document.uri) document = LSP_SERVER.workspace.get_text_document(params.text_document.uri)
@LSP_SERVER.feature(lsp.TEXT_DOCUMENT_DID_CLOSE) @LSP_SERVER.feature(lsp.TEXT_DOCUMENT_DID_CLOSE)