aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/sage/textobjects.scm
diff options
context:
space:
mode:
authorPascal Kuthe2023-03-26 16:14:42 +0000
committerBlaž Hrastnik2023-12-27 06:28:14 +0000
commit515ef17207878b78e4f5eda8bf710fa0aa1eae87 (patch)
tree63dd3c451163e06fd5ee8ab7c6bfc24b45dcbf71 /runtime/queries/sage/textobjects.scm
parent8653e1b02f6193330f8b0f2afff0a2ff103bd6a4 (diff)
make diagnostics stick to word boundaries
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.
Diffstat (limited to 'runtime/queries/sage/textobjects.scm')
0 files changed, 0 insertions, 0 deletions