| |
| Posted by Basile B. in reply to Paul Backus | PermalinkReply |
|
Basile B.
Posted in reply to Paul Backus
| On Sunday, 24 October 2021 at 20:04:05 UTC, Paul Backus wrote:
> On Sunday, 24 October 2021 at 19:47:10 UTC, Basile B. wrote:
> I believe it's partly a problem of lazyness, e.g "I want to type less. I want to be proposed filter when I CTRL+SPACE after arr.fi ".
That case can be solved by doing a word split on the current document and by adding the results to the "good" completions when they are requested. If you have selective imports at the top of the module, for filter, map, each etc. then they are proposed as well.
Yeah, this is basically how Vim's built-in completion works. I sometimes use it to save typing on long identifiers, or to avoid spelling mistakes. But if I have to fall back to typing something out manually, it's not that big of a deal.
Maybe it's programmers who can't touch-type who rely heavily on tooling support? I know if I had to hunt-and-peck every letter of an identifier like formattedWrite , I'd be a lot more motivated to use code completion everywhere I could.
> The other part of the problem is that completion can be used to overcome the lack of knowledge of an API, for example. In this case the word split does not help.
Yeah, in that situation having an easy way to view the docs is really helpful. I have a shortcut set up in Vim that opens the dpldocs.info search page with the identifier under the cursor, which works pretty well for the standard library and ok for dub packages, but a language server could probably do a better job.
I'm thinking to a new design lately.
The deamon would just keep the ast in sync and when a request is made the semantic is run from a particular point. The idea is that there's no need to run the sema for everything on each request.
We only need to have the AST up to date, undecorate it when a file changes, redecorate it when request are made. And important, only redecorate from what's asked.
|