I am trying to set the correct code completion in my favorite editor, let him use AnEditor to avoid answering specific requests that are filled on the network. (And the Alanguage language, you know.) The editor has two functions that I like: it works in the console as well as in the GUI, so I can use it over the network, and it is significantly extensible. Therefore, I do not want to use a full-blown IDE. But the editor does not have reliable code completion, although it can be connected if I find a decent solution.
I put together a whole bunch of questions and solutions for completing [language X] in [editor / IDE Y]. "It seems that each new IDE performs its code completion for each language from scratch, the parser and all. And each simpler editor (including AnEditor) does one of the following:
- fill in only standard library function names,
- or use ctags, which offers delayed regular expression-based analysis (for non-C programs) and should not indicate the type of variable that you typed now, so itโs not very useful for real code completion,
- There are other ways when the editor is expanded using plugins, but usually they come down to a more or less perverse combination above, with lots of custom regular expressions.
Now the question is: why can't we have a sound code completion library that I can connect to AnEditor and someone else to ABIGIDE? As far as I can tell (decrypting the C-pointer joystick is not my goal), the answer should look something like this:
- a general yacc / lex / bison-style parser (or static parser), somehow relaxed to tolerate code in the writing process, capable of accepting JavaDoc-style comments. And quickly, it is desirable that it can be used "on the fly"
- an index that can report the signatures of class members, methods and their position in files (ctags do it now), return values โโand other documentation from JavaDoc comments
- another index that knows the type of the variable, and a function that tells the type based on the position in the file or code that is currently written
So, in order to get the completion of work in any language, you make up the parser rules for the language, create indexes on the standard library and your project, call the type indicating function and look at the class members and documentation. Or just list the classes and members if you are dealing with object construction or static calls.
If Eclipse, Netbeans and JetBrains have successfully done this in Java (so I have to connect Eclipse to AnEditor ), why does โSomeone do it in a less bloated and more universal way? Or am I missing something and the future is already somewhere hiding?
autocomplete code-completion
katrmr
source share