Skip to content

Commit

Permalink
Fix issue #1140, register LSP server capability dynamically.
Browse files Browse the repository at this point in the history
  • Loading branch information
manateelazycat committed Jan 1, 2025
1 parent 402e65f commit b696f4f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions core/lspserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,10 +870,15 @@ def handle_work_done_progress_message(self, message):
def handle_register_capability_message(self, message):
if "method" in message and message["method"] in ["client/registerCapability"]:
try:
if message["params"]["registrations"][0]["id"] == "workspace/didChangeWatchedFiles":
workspace_watch_files = self.parse_workspace_watch_files(message["params"])
self.monitor_workspace_files(workspace_watch_files)
log_time("Add workspace watch files: {}".format(workspace_watch_files))
for registration in message["params"]["registrations"]:
if registration["id"] == "workspace/didChangeWatchedFiles":
workspace_watch_files = self.parse_workspace_watch_files(message["params"])
self.monitor_workspace_files(workspace_watch_files)
log_time("Add workspace watch files: {}".format(workspace_watch_files))
elif registration["id"] == "textDocument/formatting":
self.code_format_provider = True
elif registration["id"] == "textDocument/rangeFormatting":
self.range_format_provider = True
except:
log_time(traceback.format_exc())

Expand Down

0 comments on commit b696f4f

Please sign in to comment.