diff --git a/README.md b/README.md index 36284f7..52fb44c 100644 --- a/README.md +++ b/README.md @@ -45,13 +45,13 @@ On average, pylyzer can inspect Python scripts more than __100 times faster__ th While pytype/pyright's error reports are illegible, pylyzer shows where the error occurred and provides clear error messages. -### pylyzer 😃 +### pyright -![report](https://raw.githubusercontent.com/mtshiba/pylyzer/main/images/report.png) +![pyright_report](https://raw.githubusercontent.com/mtshiba/pylyzer/main/images/pyright_report.png) -### pyright 🙃 +### pylyzer 😃 -![pyright_report](https://raw.githubusercontent.com/mtshiba/pylyzer/main/images/pyright_report.png) +![report](https://raw.githubusercontent.com/mtshiba/pylyzer/main/images/report.png) * Rich LSP support 📝 @@ -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,