update completion items
This commit is contained in:
@@ -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
|
||||
)
|
||||
)
|
||||
Reference in New Issue
Block a user