Hello folks, I have been thinking of working on an editor agnostic code helper library with an autocomplete engine for rust (since there isn't anything yet?) as a hobby project to get to know the internals of the compiler. Examples of similar projects in different languages include;
- [youcompleteme](https://github.com/Valloric/YouCompleteMe) (C/C++/Objective-C/Objective-C++) (this one is specific to vim and a more general solution to autocompletion in vim but it includes a clang based completion engine for c family languages) - [merlin](https://github.com/def-lkb/merlin) (ocaml) (haven't actually used this but since we have many ocaml people I'm guessing some people might have) - [gocode](https://github.com/nsf/gocode) (go) - [jedi](https://github.com/davidhalter/jedi) (python) I have already started playing with the code but couldn't make much progress. What I had in mind was; 1) Implement a type under cursor functionality 2) Implement autocompletion functionality (i.e by looking up the methods and members of the type under cursor) 3) Wrap the whole thing with a server-client architecture (only if performance suffers too much otherwise) 4) Work on the bindings for my editor of choice as the showcase and ask the community for others Unfortunately I'm still at step 1. I have managed to parse a file until typecheck using `phase_3_run_analysis_passes` which gave me a `CrateAnalysis` including presumably the type context in `ty::ctxt`. From there I have only checked two things so far, (1) `items: ast_map::map` which is basically a map from `NodeId` to the enum `ast_node` and (2) `node_types: node_type_table` which is similarly a map from `uint` to `t`. `t` seems to represent types which is what I was looking for although I couldn't find anything related to type names so far. I have found a few id's instead that I have yet to comprehend which then made me think that it might be the case that types themselves might be stored only with an id instead of a name. If this is the case, it may still be possible to work on autocomplete functionality by skipping type under cursor functionality. Any insight? Some more general questions are; - How feasible is this project with the current state of the compiler? - How difficult would it be for a newbie (to both rustc and compilers)? - Shall I open an issue for this? Thanks, Gokcehan
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
