Skip to content

Commit

Permalink
fix: Fixed issues with pyright langserver, Send empty configurations …
Browse files Browse the repository at this point in the history
…after initialization
  • Loading branch information
tomlin7 committed Jul 2, 2024
1 parent 3e5bd13 commit 82fffce
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/biscuit/common/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ def start(self, *_) -> None:
self.t_out = Thread(target=self._process_out, daemon=True)
self.t_out.start()

# Debugging purposes
# self.t_err = Thread(target=self._process_err, daemon=True)
# self.t_err.start()

def stop(self, *_) -> None:
"""Stop the process"""

Expand All @@ -93,3 +97,10 @@ def _process_out(self) -> None:
if not data:
break
self.out_queue.put(data)

def _process_err(self) -> None:
while self.alive:
data = self.p.stderr.read(1)
if not data:
break
print(data.decode(), end="", flush=True) # Print to the console
6 changes: 6 additions & 0 deletions src/biscuit/common/notifications/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def info(
instance.pack(side=tk.TOP, fill=tk.BOTH, expand=1, pady=(0, 1))
self.count += 1
self.show()
self.update_idletasks()
self._follow_root()

self.notifications.append(instance)
self.latest = instance
Expand All @@ -101,6 +103,8 @@ def warning(
instance.pack(side=tk.TOP, fill=tk.BOTH, expand=1, pady=(0, 1))
self.count += 1
self.show()
self.update_idletasks()
self._follow_root()

self.notifications.append(instance)
self.latest = instance
Expand All @@ -118,6 +122,8 @@ def error(
instance.pack(side=tk.TOP, fill=tk.BOTH, expand=1, pady=(0, 1))
self.count += 1
self.show()
self.update_idletasks()
self._follow_root()

self.notifications.append(instance)
self.latest = instance
Expand Down
20 changes: 19 additions & 1 deletion src/biscuit/language/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,21 @@ def __init__(self, master: LangServerClient):
def process(self, e: lsp.Event) -> None:
"""Process the event"""

# print(e.__class__.__name__.upper(), e, end="\n\n")

if isinstance(e, lsp.Shutdown):
self.client.exit()
return

if isinstance(e, lsp.ConfigurationRequest):
self.base.logger.warning("Config asked for: ", e.items)
e.reply([])
return

# if isinstance(e, lsp.WorkspaceFolders):
# e.reply([lsp.WorkspaceFolder(uri=self.root_uri, name="Root")])
# return

if isinstance(e, lsp.LogMessage):
self.base.logger.rawlog(e.message, e.type)
return
Expand All @@ -44,7 +55,14 @@ def process(self, e: lsp.Event) -> None:
self.base.logger.info("Capabilities " + pprint.pformat(e.capabilities))
for tab in self.master.tabs_opened:
self.master.open_tab(tab)
self.master.request_outline(tab)
# self.master.request_outline(tab)

self.client._send_notification(
method="workspace/didChangeConfiguration",
params={
"settings": [],
},
)

self.base.statusbar.process_indicator.hide()
return
Expand Down

0 comments on commit 82fffce

Please sign in to comment.