515ef17207
Diagnostics are currently extended if text is inserted at their end. This is desirable when inserting text after an identifier. For example consider: let foo = 2; --- unused variable Renaming the identifier should extend the diagnostic: let foobar = 2; ------ unused variable This is currently implemented in helix but as a consequence adding whitespaces or a type hint also extends the diagnostic: let foo = 2; -------- unused variable let foo: Bar = 2; -------- unused variable In these cases the diagnostic should remain unchanged: let foo = 2; --- unused variable let foo: Bar = 2; --- unused variable As a heuristic helix will now only extend diagnostics that end on a word char if new chars are appended to the word (so not for punctuation/ whitespace). The idea for this mapping was inspired for the word level tracking vscode uses for many positions. While VSCode doesn't currently update diagnostics after receiving publishDiagnostic it does use this system for inlay hints for example. Similarly, the new association mechanism implemented here can be used for word level tracking of inlay hints. A similar mapping function is implemented for word starts. Together these can be used to make a diagnostic stick to a word. If that word is removed that diagnostic is automatically removed too. This is the exact same behavior VSCode inlay hints eixibit. |
||
---|---|---|
.. | ||
doc_formatter | ||
increment | ||
auto_pairs.rs | ||
chars.rs | ||
comment.rs | ||
config.rs | ||
diagnostic.rs | ||
diff.rs | ||
doc_formatter.rs | ||
fuzzy.rs | ||
graphemes.rs | ||
history.rs | ||
indent.rs | ||
lib.rs | ||
line_ending.rs | ||
macros.rs | ||
match_brackets.rs | ||
movement.rs | ||
object.rs | ||
path.rs | ||
position.rs | ||
rope_reader.rs | ||
search.rs | ||
selection.rs | ||
shellwords.rs | ||
surround.rs | ||
syntax.rs | ||
test.rs | ||
text_annotations.rs | ||
textobject.rs | ||
transaction.rs | ||
wrap.rs |