From f24449dd0e2c88fff6cd8d84dac0ae0e029e97af Mon Sep 17 00:00:00 2001 From: Matthew Runyon Date: Fri, 31 Mar 2023 12:11:28 -0500 Subject: [PATCH] Address Jinafeng comments --- .../deephaven_internal/auto_completer/_completer.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/py/server/deephaven_internal/auto_completer/_completer.py b/py/server/deephaven_internal/auto_completer/_completer.py index 2e2fe04c336..8e3ed0de933 100644 --- a/py/server/deephaven_internal/auto_completer/_completer.py +++ b/py/server/deephaven_internal/auto_completer/_completer.py @@ -62,7 +62,7 @@ def wrap_plaintext(txt: str) -> str: return '' -class Completer(object): +class Completer: def __init__(self): self._docs = {} self._versions = {} @@ -120,12 +120,10 @@ def set_scope(self, scope: dict) -> None: def get_completer(self, uri: str) -> Union[Interpreter, Script]: txt = self.get_doc(uri) - return ( + if self.__mode == Mode.SAFE: # The Script completer is static analysis only, so we should actually be feeding it a whole document at once - Script(txt) - if self.__mode == Mode.SAFE - else Interpreter(txt, [self.__scope]) - ) + return Script(txt) + return Interpreter(txt, [self.__scope]) def do_completion( self, uri: str, version: int, line: int, col: int @@ -143,7 +141,7 @@ def do_completion( # Path completions don't seem useful with our setup # It also doesn't suggest nested paths/files when the string is a parent path # Might just be a client issue, but either way not useful right now - completions = filter(lambda c: c.type != "path", completer.complete(line, col)) + completions = [c for c in completer.complete(line, col) if c.type != "path"] # for now, a simple sorting based on number of preceding _ # we may want to apply additional sorting to each list before combining