mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-13 20:15:20 +00:00
CSharpLanguageServer: Wait for indexing to complete
resolving issues pertaining to retrievals not working correctly initially Fixes #814
This commit is contained in:
1 parent
fd8bd8d064
commit
b724eccde6
2 files changed
+10
-5
No files matched your search
@@ -627,10 +627,14 @@ class CSharpLanguageServer(SolidLanguageServer):
|
||||
def handle_project_needs_restore(params: dict) -> None:
|
||||
return
|
||||
|
||||
def handle_workspace_indexing_complete(params: dict) -> None:
|
||||
self.completions_available.set()
|
||||
|
||||
# Set up notification handlers
|
||||
self.server.on_notification("window/logMessage", window_log_message)
|
||||
self.server.on_notification("$/progress", handle_progress)
|
||||
self.server.on_notification("textDocument/publishDiagnostics", do_nothing)
|
||||
self.server.on_notification("workspace/projectInitializationComplete", handle_workspace_indexing_complete)
|
||||
self.server.on_request("workspace/configuration", handle_workspace_configuration)
|
||||
self.server.on_request("window/workDoneProgress/create", handle_work_done_progress_create)
|
||||
self.server.on_request("client/registerCapability", handle_register_capability)
|
||||
@@ -679,7 +683,6 @@ class CSharpLanguageServer(SolidLanguageServer):
|
||||
self._open_solution_and_projects()
|
||||
|
||||
self.initialization_complete.set()
|
||||
self.completions_available.set()
|
||||
|
||||
log.info(
|
||||
"Microsoft.CodeAnalysis.LanguageServer initialized and ready\n"
|
||||
@@ -687,6 +690,12 @@ class CSharpLanguageServer(SolidLanguageServer):
|
||||
"This may take a while for large projects"
|
||||
)
|
||||
|
||||
if self.completions_available.wait(30): # Wait up to 30 seconds for indexing
|
||||
log.info("Indexing complete")
|
||||
else:
|
||||
log.warning("Timeout waiting for indexing to complete, proceeding anyway")
|
||||
self.completions_available.set()
|
||||
|
||||
def _force_pull_diagnostics(self, init_response: dict | InitializeResult) -> None:
|
||||
"""
|
||||
Apply the diagnostic capabilities hack.
|
||||
|
||||
Reference in new issue
Block a user