amp icon indicating copy to clipboard operation
amp copied to clipboard

[Feat. Request] Fuzzy Matched Code Completions

Open chris-ricketts opened this issue 5 years ago • 5 comments

First off thanks for creating Amp - it looks to be a really promising editor. I appreciate the simplicity, the efficiency of jump mode and the fuzzy file finder. Also the fact you don't have to install or mess about with any third party plugins.

The main thing I feel would take Amp to the next level would be fuzzy code completion. Similar to the way the YouCompleteMe plugin works with Vim but without the set up hassle or the mostly unnecessary semantic completions.

The best part about YCM in my opinion is the simplest part of it - the fuzzy finding of symbols in the currently open tabs (buffers in Amp's case). For example if you had the following rust code in an open buffer (say utils.rs):

trait SomeUtilTrait {
...
}

fn some_util_function() {
...
}

Typing su in a different buffer would immediately bring up SomeUtilTrait and some_util_function in the completion popup.

I noticed you're planning on supporting the LSP (#37) at some point. Maybe both the results from LSP and contents from the open buffers could be merged and funneled through the fuzzy algorithm to get the results to display in the completion popup.

chris-ricketts avatar Apr 23 '19 14:04 chris-ricketts

Hi @chris-ricketts! Thanks for the kind words.

Now that 0.6 has landed, I'm going to be investigating LSP for 0.7; once I've got an initial implementation in place, I can revisit this to see if it's viable. I'll be honest, I'm not fond of auto-complete pop-ups; I find them distracting. That said, there may be some UI treatment that would alleviate some of that noise.

jmacdonald avatar Jul 09 '19 01:07 jmacdonald

Just wanted to chime in with my own two-cents worth here. I find both fuzzy-style completion, and LSP to be a great boon in larger code bases as it becomes a bit harder to remember which thing from where and what the args etc are.

It may be worth looking at LSP-Neovim and seeing if that existing work could be leveraged. In some places it looks like it could be made editor agnostic. One thing it does that is nice is show errors/warning in-line with the line they occur on.

Sort of wondering what would be required for TabNine too.

(And thanks so much for creating Amp)

flukejones avatar Aug 10 '19 10:08 flukejones

I just would like to confirm, that there is interest in having LSP. Would love to use it with gopls. ;-)

ernierasta avatar Feb 18 '21 12:02 ernierasta

Some form of auto-complete is essential, I think. I tried Amp for the first time today and am very impressed — I was able to be almost as productive as with Vim and VS Code (I use only a small subset of their features). A major benefit of auto-complete is accuracy: I already accidentally introduced a nontrivial bug today using Amp that auto-completion would have prevented.

If a pop-up is unpalatable, what about using Ctrl+n or similar to cycle through fuzzy completions of the current “word”? Taking completions from just the buffer would be a great first step.

multinormal avatar Apr 13 '21 19:04 multinormal

You could potentially use the same pop-up as for file/command completion. Not having the pop-up where the text would be inserted might be a bit weird, but overall I think it'd be less distracting and integrate with amp's current design better than YCM's pop-up, and easier to use than a pure reliance on keybindings.

oldaccountdeadname avatar Apr 13 '21 20:04 oldaccountdeadname