zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
49.26k stars 2.98k forks source link

Character lookahead when inserting JSON completions #5352

Open noib3 opened 2 years ago

noib3 commented 2 years ago

Is your feature request related to a problem? Please describe.

Let's say I have foobar as one of the current completion candidates, with the current line being foo|ar (| represents the cursor position). If I select that completion I'd expect to end up with foobar|, not foobar|ar.

Just as an example:

Screen Shot 2022-06-22 at 2 33 19 AM

->

Screen Shot 2022-06-22 at 2 32 50 AM

Describe the solution you'd like

Avoid inserting all the trailing characters of the inserted completion that match the text right after the current cursor position.

Additional context

Since this seems to be already happening when editing Rust files I suspect it's actually vscode-json-languageserver's fault for not properly setting the textEdit field of the returned CompletionItems.

If that's the case, could a new option be added to enable client-side character lookahead when inserting completions? It'd be off by default, w/ the ability to turn it on for specific languages through language_overrides.

marcospb19 commented 2 months ago

I managed to reproduce this in v0.150 with C, Rust and TOML, but not with Python.