From 6e79c6423feaa09384f24d762f99a05a8f599755 Mon Sep 17 00:00:00 2001 From: Shunsuke Shibayama Date: Tue, 20 Aug 2024 22:10:33 +0900 Subject: [PATCH] fix: signature help not working --- README.md | 11 +++++++++++ crates/py2erg/convert.rs | 14 ++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 36284f7..de0e4db 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,16 @@ pylyzer converts Python ASTs to Erg ASTs and passes them to Erg's type checker. * [x] builtin modules analysis * [x] local scripts analysis * [x] local packages analysis +* [x] LSP features + * [x] diagnostics + * [x] completion + * [x] rename + * [x] hover + * [x] goto definition + * [x] signature help + * [x] find references + * [x] document symbol + * [x] call hierarchy * [x] collection types * [x] `list` * [x] `dict` @@ -135,6 +145,7 @@ pylyzer converts Python ASTs to Erg ASTs and passes them to Erg's type checker. * [x] type assertion (`typing.cast`) * [x] type narrowing (`is`, `isinstance`) * [ ] `pyi` (stub) files support +* [ ] glob pattern file check --- diff --git a/crates/py2erg/convert.rs b/crates/py2erg/convert.rs index 57bbb31..83bda6d 100644 --- a/crates/py2erg/convert.rs +++ b/crates/py2erg/convert.rs @@ -1166,6 +1166,7 @@ impl ASTConverter { } py_ast::Expr::Call(call) => { let loc = call.location(); + let end_loc = call.end_location(); let function = self.convert_expr(*call.func); let (pos_args, var_args): (Vec<_>, _) = call .args @@ -1201,10 +1202,15 @@ impl ASTConverter { .into_iter() .map(|Keyword { value, .. }| PosArg::new(self.convert_expr(value))) .next(); - let last_col = pos_args - .last() - .and_then(|last| last.col_end()) - .unwrap_or(function.col_end().unwrap_or(0) + 1); + let last_col = end_loc.map_or_else( + || { + pos_args + .last() + .and_then(|last| last.col_end()) + .unwrap_or(function.col_end().unwrap_or(0) + 1) + }, + |loc| loc.row.get(), + ); let paren = { let lp = Token::new( TokenKind::LParen,