update file sourcing
This commit is contained in:
+14
-19
@@ -191,16 +191,16 @@ def did_open(params: lsp.DidOpenTextDocumentParams) -> None:
|
||||
document = LSP_SERVER.workspace.get_text_document(params.text_document.uri)
|
||||
LSP_SERVER.compute_diagnostics(document)
|
||||
completion.reset()
|
||||
all_tcl_files = get_all_tcl_files(LSP_SERVER.workspace.root_path)
|
||||
# all_tcl_files = get_all_tcl_files(LSP_SERVER.workspace.root_path)
|
||||
|
||||
for filepath in all_tcl_files:
|
||||
try:
|
||||
with open(filepath, "r", encoding="utf-8") as f:
|
||||
source = f.read()
|
||||
tree = LSP_SERVER.parser.parse(source)
|
||||
tree.accept(completion, recurse=True)
|
||||
except Exception as e:
|
||||
log_to_output(f"Fehler beim Parsen von {filepath}: {e}")
|
||||
# for filepath in all_tcl_files:
|
||||
# try:
|
||||
# with open(filepath, "r", encoding="utf-8") as f:
|
||||
# source = f.read()
|
||||
# tree = LSP_SERVER.parser.parse(source)
|
||||
# tree.accept(completion, recurse=True)
|
||||
# except Exception as e:
|
||||
# log_to_output(f"Fehler beim Parsen von {filepath}: {e}")
|
||||
|
||||
|
||||
@LSP_SERVER.feature(lsp.TEXT_DOCUMENT_DID_SAVE)
|
||||
@@ -214,16 +214,6 @@ def did_close(params: lsp.DidCloseTextDocumentParams) -> None:
|
||||
"""LSP handler for textDocument/didClose request."""
|
||||
|
||||
|
||||
def get_all_tcl_files(root_path: str) -> list[str]:
|
||||
"""Sammelt alle .tcl-Dateien rekursiv im gegebenen Verzeichnis"""
|
||||
tcl_files = []
|
||||
for dirpath, _, filenames in os.walk(root_path):
|
||||
for filename in filenames:
|
||||
if filename.endswith(".tcl"):
|
||||
tcl_files.append(os.path.join(dirpath, filename))
|
||||
return tcl_files
|
||||
|
||||
|
||||
@LSP_SERVER.feature(lsp.TEXT_DOCUMENT_DID_CHANGE)
|
||||
def did_change(params: lsp.DidChangeTextDocumentParams) -> None:
|
||||
"""LSP handler for textDocument/didChange request"""
|
||||
@@ -464,6 +454,11 @@ def initialize(params: lsp.InitializeParams) -> lsp.InitializeResult:
|
||||
)
|
||||
|
||||
|
||||
@LSP_SERVER.feature(lsp.INITIALIZED)
|
||||
def initialized(params: lsp.InitializedParams) -> lsp.InitializeResult:
|
||||
pass
|
||||
|
||||
|
||||
@LSP_SERVER.feature(lsp.EXIT)
|
||||
def on_exit(_params: Optional[Any] = None) -> None:
|
||||
"""Handle clean up on exit."""
|
||||
|
||||
Reference in New Issue
Block a user