Skip to content

Commit

Permalink
Address Jinafeng comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrunyon committed Mar 31, 2023
1 parent 0b7ac8c commit f24449d
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions py/server/deephaven_internal/auto_completer/_completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def wrap_plaintext(txt: str) -> str:
return ''


class Completer(object):
class Completer:
def __init__(self):
self._docs = {}
self._versions = {}
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit f24449d

Please sign in to comment.