lsp: FIx indentation inconsistency and multi-word keyword completion repetition bug
This PR:
- Makes the formatter use 2 spaces instead of 4 to match the tree-sitter indentation
- Fixes completion repetition on typing past the first word in a multi-word keyword (e.g. completing
in pas opposed toinresults inin in propertywhere it should result inin property)
The new function in completion.rs could probably be smaller which is why I'm opening this as a draft
Before:
https://github.com/user-attachments/assets/fab3556b-01f3-4a67-b63e-43848d1ad6bd
After:
https://github.com/user-attachments/assets/2c628a2b-c424-4bf8-934e-ef940843ffb7
forgot to update the tests, one sec
This is vim/nvim I assume? I think VSCode and helix both work fine with 4 spaces, so we should fix the tree-sitter based indentation in vim :-) And it would unbreak many of the failing tests, too:-)
I do like your completion suggestion a lot though!
This is vim/nvim I assume? I think VSCode and helix both work fine with 4 spaces, so we should fix the tree-sitter based indentation in vim :-) And it would unbreak many of the failing tests, too:-)
I do like your completion suggestion a lot though!
oh i already fixed all but 3 of the tests
i can definitely revert them though
also i might fix it to not remove newlines as well since removing them makes the code too compact
Sorry for taking so long to look at your PR.
Makes the formatter use 2 spaces instead of 4 to match the tree-sitter indentation
We shouldn't change this like that as it would force to reformat everyone's code, and many people prefer 4 spaces. If anything this could be a setting.
Fixes completion repetition on typing past the first word in a multi-word keyword (e.g. completing in p as opposed to in results in in in property where it should result in in property)
This makes sense. Somehow this works fine on vscode, but we should be fixing it for editor that don't behave like that. There could also be tests for that behavior.
I'll fix the PR up later this week