update completion items

This commit is contained in:
Christoph Brandau
2025-07-30 17:28:18 +02:00
parent 8da61abfce
commit ed045aa459
6 changed files with 208 additions and 166 deletions
+37
View File
@@ -0,0 +1,37 @@
from tclint.syntax_tree import Visitor
import lsprotocol.types as lsp
class CompletionItems:
def __init__(self):
self._custom_functions: list[lsp.CompletionItem] = []
@property
def custom_functions(self) -> list[lsp.CompletionItem]:
return self._custom_functions
@custom_functions.setter
def custom_functions(self, value: lsp.CompletionItem):
self._custom_functions.append(value)
class _Completion(Visitor):
def __init__(self):
super().__init__()
self._custom_functions: list[lsp.CompletionItem] = []
@property
def custom_functions(self) -> list[lsp.CompletionItem]:
return self._custom_functions
def visit_command(self, command):
routine = command.routine
if routine.contents == "proc" and command.args:
first_arg = command.args[0]
if hasattr(first_arg, "value"):
self._custom_functions.append(
lsp.CompletionItem(
label=first_arg.value, kind=lsp.CompletionItemKind.Function
)
)