janet-lang / spork

Various Janet utility modules - the official "Contrib" library.
MIT License
122 stars 35 forks source link

netrepl/server-single: tab completion doesn't include bindings from environment #43

Closed subsetpark closed 2 years ago

subsetpark commented 3 years ago

Having started a server-single instance, I connect with two clients. From client A (a text editor) I define a bunch of functions. We'll take warn-proto-method-shadow as an example. From client B (a janet session running client) we see the following confusing behavior:

[127.0.0.1:9365]:3: warn-proto-method-shadow
<function warn-proto-method-shadow>
[127.0.0.1:9365]:4: warn-<TAB>

We see that the symbol is bound. However, warn-<TAB> immediately completes:

[127.0.0.1:9365]:4: warn-compile

Even though the function is in the current environment, it's not in the list of tab completion options.

bakpakin commented 3 years ago

Yes, this is a limitation with how getline is working - makes it hard for a completion to be customized, especially with some from across a network, so currently it is just using the default autocomplete built into getline, which works with the default client environment. The proper fix here is to have and ev-aware getline implementation.

bakpakin commented 2 years ago

As of 31a5009cc9acc2096f14ada0cd2dde7d14839431, the default netrepl client should have this. A number of improvements have been made to netrepl, such that it should feel much like the default Janet repl.