update completion feature
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"tcl": {
|
||||
"keywords": [
|
||||
"proc",
|
||||
"puts",
|
||||
"if"
|
||||
]
|
||||
},
|
||||
"tcl": [
|
||||
"proc",
|
||||
"puts",
|
||||
"if",
|
||||
"else",
|
||||
"elseif"
|
||||
],
|
||||
"MOM_procs": [
|
||||
"MOM_output_literal",
|
||||
"MOM_ask_ude_info",
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import json
|
||||
import lsprotocol.types as lsp
|
||||
import pathlib
|
||||
|
||||
|
||||
class StandardCompletionItems:
|
||||
def __init__(self):
|
||||
self.__tcl_keyword_list = self.load_tcl_keyword()
|
||||
|
||||
@property
|
||||
def tcl_keyword_list(self):
|
||||
return self.__tcl_keyword_list
|
||||
|
||||
def load_tcl_keyword(self) -> list[lsp.CompletionItem]:
|
||||
with open(
|
||||
pathlib.Path(__file__).parent.joinpath("completion_list.json"), "r"
|
||||
) as f:
|
||||
data = json.load(f)
|
||||
|
||||
items = []
|
||||
for i in data.get("tcl", []):
|
||||
items.append(
|
||||
lsp.CompletionItem(label=i, kind=lsp.CompletionItemKind.Keyword)
|
||||
)
|
||||
return items
|
||||
|
||||
|
||||
standard_items = StandardCompletionItems()
|
||||
Reference in New Issue
Block a user