mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-13 20:15:20 +00:00
fix(ls): correct SymbolBody.get_text for the one-line-past-EOF range
An LSP server can end a symbol range one line past EOF: the convention for a range covering whole lines ends it at the start of the following, non-existent line. SymbolBody.get_text indexes self._lines[end_line] directly, so that well-defined case raised IndexError. get_text now corrects exactly that case (end_line == len(lines), end_col=0) to end at the actual last line, in get_text itself so it also applies to a cached SymbolBody, not just a freshly constructed one. Any other out-of-range end_line now raises InvalidTextLocationError. Fixes #1498
This commit is contained in:
1 parent
ad2fdf1fa6
commit
3a67ea2086
4 files changed
+129
-5
No files matched your search
@@ -52,6 +52,15 @@ class SolidLSPException(Exception):
|
||||
return s
|
||||
|
||||
|
||||
class InvalidTextLocationError(SolidLSPException):
|
||||
"""
|
||||
Raised when a symbol's LSP range refers to a text location that does not exist
|
||||
in the file's current line buffer, other than the well-defined whole-line-through-EOF
|
||||
convention (end line exactly one past EOF at column 0), which is corrected rather
|
||||
than rejected.
|
||||
"""
|
||||
|
||||
|
||||
class MetalsStaleLockError(SolidLSPException):
|
||||
"""
|
||||
Raised when a stale Metals H2 database lock is detected and the user
|
||||
|
||||
Reference in new issue
Block a user