Skip to content

Commit

Permalink
small refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
z80dev committed Dec 14, 2024
1 parent b92437f commit f3c3467
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion tests/test_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,22 @@ def foobar():
self.foo(self.baz(1), 2)
"""
ast.build_ast(src)
analyzer = AstAnalyzer(ast)

doc = Document(uri="<inline source code>", source=src)

pos = Position(line=3, character=11)
params = SignatureHelpParams(
text_document=TextDocumentIdentifier(doc.uri), position=pos
)
sig_help = analyzer.signature_help(doc, params)
assert sig_help is None

pos = Position(line=7, character=13)
params = SignatureHelpParams(
text_document=TextDocumentIdentifier(doc.uri), position=pos
)

analyzer = AstAnalyzer(ast)
sig_help = analyzer.signature_help(doc, params)
assert sig_help
assert sig_help.active_signature == 0
Expand Down
4 changes: 2 additions & 2 deletions vyper_lsp/analyzer/AstAnalyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def __init__(self, ast: AST) -> None:
self.diagnostics_enabled = True

def _handle_internal_fn_signature(
self, doc: Document, current_line: str, fn_name: str
self, current_line: str, fn_name: str
) -> Optional[SignatureHelp]:
node = self.ast.find_function_declaration_node_for_name(fn_name)
if not node:
Expand Down Expand Up @@ -109,7 +109,7 @@ def signature_help(

# this returns for all external functions
if module == "self":
return self._handle_internal_fn_signature(doc, current_line, fn_name)
return self._handle_internal_fn_signature(current_line, fn_name)

def _dot_completions_for_element(
self, element: str, top_level_node=None, line: str = ""
Expand Down

0 comments on commit f3c3467

Please sign in to comment.