I'm desperate for an editor with better tab-completion / intellisense, any solace out there?

Hi everyone, it’s been a while since I’ve used kakoune as I’ve discovered the excellent Dance for VSCode, which lets you use kakoune keys and editing in VSCode itself.

This day, I’ve decided to quit, however, as VSCode’s Intellisense is infuriating, and completely unconfigurable.

I thought “Now’s the time to go running back into the open arms of kakoune!”. But kak has the same problem. And I don’t know what to do.

I don’t have the scope to go into every problem that exists with it, but essentially, there are far too many suggestions, and it triggers for everything you type. The only real option available is to turn it off, which is hardly an option. In each project, the number of suggestions builds up until it becomes completely unsustainable. The best I can do is to give a couple of personal examples:

  • Example 1: Dart / Flutter

I have a Flutter project, with a lot of classes, sub-libraries, libraries loaded, etc. Intellisense would be helpful, but I can’t concentrate on this complicated project with the fuzzy matching triggering for everything, every time, as the sheer amount of library classes summoned up is overwhelming.

Desired behaviour: Start Intellisense only after entering >=3 characters; bring in variables local to the file but not from other open files or from comments; use fuzzy matching for classes but strict for snippets as I have a lot of them.

Actual behaviour: Nothing, a total mess, just a completely unconfigurable, eye-rending spam of garbage after everything I enter.

  • Example 2: BQN (an APL language)

I’m writing some small projects with this strange language (BQN), and the VSCode extension uses snippets to enter the peculiar glyphs, e.g. ∧∨¬⊣⊢↑↓«»⌾, used by this language. Snippets are in the form of \ followed by an ASCII character; for example, is \q, ⍷ is \E, is \$, and so on. It would be a perfect system, but it causes VSCode’s Intellisense to trigger for everything I write, because every single alphanumeric character is tied to one or two snippets. Better, also, would be if I could auto-enter snippets after completion (but for this project only)—it would save a huge amount of tab/enter keypresses.

Desired behaviour: Strictly complete variable names of >3 length, but only suggest snippets after entering the \ character; auto-insert snippets after completion.

Actual behaviour: Zilch, nada, nothing, the Intellisense is a completely uncustomizable waste of time.

So, then, that’s my experience.

In short: I want to come back to kak, but I’m afraid to because the fuzzy Intellisense / completions were always a frustration to me, and I’ve not seen any way to configure them. However, VSCode and Helix, for example, have the same problem. So I’m stuck, I don’t know what to do, and I thought we could share some fruitful debate on the matter?

It might seem like I’m being pernickety, but a lot of great things are started by somebody having a very specific vision, one that other people didn’t have. And I can’t be the only one. So let’s talk about it!

What you want is conjecturaly achievable with Kakoune, but like others configurable tools, you will have to learn a bit about:

  • hooks (doc hooks) to be triggered on filetypes, e.g. hook global WinSetOption filetype=dart %{…}

  • completer option (doc options) and this tutorial

for the 3 characters trick maybe get inspiration from ctags_min_chars from ctags builtin plugin

1 Like

I don’t think that Kakoune is missing relevant features here, and it’s probably much simpler than other editors.

Start Intellisense only after entering >=3 characters;

It depends on how you set your completers option but when using kak-lsp, this should work

set-option global lsp_completion_trigger %{execute-keys '<a-h><a-k>\S...\z<ret>'}

If the completions are from word or filename completers, then currently the easiest
option is to patch Kakoune, which shouldn’t be hard.

bring in variables local to the file but not from other open files or from comments;

might wanna use word=buffer instead of word=all in your completers (see :doc options)
But that can only get you so far; a language server would be better

Better, also, would be if I could auto-enter snippets after completion (but for this project only)—it would save a huge amount of tab/enter keypresses.

in Kakoune, by default tab or enter do not interact with completions.
You probably have some plugin or key mapping configured.
kak-lsp snippets auto-expand without having to press enter or tab (using InsertCompletionHide), other snippets plugins should do the same.

but only suggest snippets after entering the \ character;

where are the snippet completions coming from?
Depending on that answer, you might need to add \ to your extra_word_chars option for this filetype

Thanks, I didn’t know about some of these options. If only VScode and other (supposedly more “featured”) editors had them too.

kak-lsp snippets auto-expand without having to press enter or tab (using InsertCompletionHide ),

This is great, for my uses!

Another great tutorial from Screwtape! But it looks like I don’t want to use the built-in completions at all, but rather kak-lsp. Perhaps I should be digging into the sources for that?

That just about covers the low-hanging fruit.

Anyway, I’m going to start setting up my configuration, but an important step is to make the completion non-fuzzy, Is there not any way to do this? It’s infuriating. There has to be some way to get into the core strategy of completion, and make it less intrusive. There’s also things like making it case-sensitive, or not. This is the crux of the matter, and what makes using LSPs so bittersweet in the current day.

Turning off the buffer-based completion will be necessary—if you write well-commented code like I do, you get a lot of suggestions for words like ‘is’. After writing an s. Useless.

Like, I said, I’ve been using Dance for VSCode, so I don’t remember the specific behaviour of kakoune, but I know for sure I’m not the only one who had problems configuring completions to work nicely. I’d like to hear from the users who have the same tastes for modern LSP tools that are quiet and unobtrusive.

(I was trying to avoid having to fork kak, or VSCode, in my precious spare time, but it looks like I’m going to have to do that, unfortunately…)