Language Server Tool to Navigate Across PackedFunc FFI for IDEs like VSCode and Emacs

Great, in that case I guess lsp-mode automatically guess the root correctly.

Anyway, right now the feature only contains the find def from py to cxx.

I find it is interesting to add project specific analysis that can be minimum and enhance the IDE in this way.

Would love to see how will the such kind of IDE enhancements benefit our development and code navigation

I’m playing with this, it is so much fun :slight_smile: I encourage everyone to try it (but be sure to fetch my PR at https://github.com/tqchen/tvm-ffi-navigator/pull/1, which enables fallback to pyls)

It’s great to be able to do things like this without messing with elisp or typescript.

VS code extension works beautifully! I’ve also tested that the extension can be compiled locally once and install to a remote server via Remote SSH, although fft_navigator must be available on the remote server to make it work.

I would also recommend directly installing the package so that we don’t need to setup PYTHONPATH.

improvements(instructions and features) are more than welcomed. The PYTHONPATH is mainly used to ease development purposes.

I made some more hacks, the latest set of improvements are here https://github.com/tqchen/ffi-navigator#features Feel free play with it and enhance more to add features that might helps the development

1 Like

This could also be of interest to MXNet or PyTorch dev. Supporting MXNet seems straightforward, but pytorch generates C++ code from templates during build, so it requires source build be done beforehand.

To make it easier to support other projects, we want to separate TVM-specific component into one place and make BaseServer dispatch into project-specific handlers.

I just did anothe refactor to isolate the project specific part into a folder. I will stop adding major changes at this point, I think it should be pretty easy to add new ffi dialects, and enhance the project a bit further to allow configuration of things like path to scan and so on, feel free to add features that you think are good

Looks great, thanks. Will add mxnet dialect and possibly torch too.

1 Like

Is there anyone who is willing to share his/her experience installing ffi-navigator either in CLION or VS studio?

For some reason, I failed to follow instructions provided here: https://github.com/tqchen/ffi-navigator

First, I tried to install it under my anaconda using following command inside ffi-navigator folder. It did not showed up on my list of packages of my anaconda environment.

python setup install --user

Second, I tried to install it on my VS studio, but I failed to find “%USERPROFILE%.vscode\extensions” folder on my windows machine. I am sure my %userprofile% is /my_username/ under users. But there is no .vscode folder.

Thanks.

If you just want to use it instead of development, you can install the extension via VSCode marketplace, and then pip install ffi_navigator. It doesn’t support CLion yet and currently no plan for it.

@comaniac – thank you very much, but VSCode marketplace does not show ffi-navigator. I did searched all combinations like ffi navigator, ffi, …etc. Nothing shows up.

https://marketplace.visualstudio.com/items?itemName=tqchen.ffi-navigator

1 Like

Thank you @comaniac very much.

Hi @comaniac,

For some reason, I am still having trouble properly using ffi-navigator in VSCode. In the instructions, it says we can get ffi-navigator from marketplace which I did get succesfully installed as extension to VSCode. But when I navigate tvm python code as shown in the demo (e…g, Go To Definitions), it does not go to C++ definition from python. Any ideas ?

I had a go at installing it into CLion but the LSP plugin was giving me trouble. I could not get the server to start reliably although it would start from the command-line.

You can check the extension log (in the bottom OUTPUT tab of VSCode window, select ffi_navigator on the right side.) to see if 1) ffi_navigator is launched and initialized correctly, and 2) the Python line to be navigated is in the scope of FFI.

@Leo-arm do you have pyls working with clion?

Sadly, no. I tried it with the LSP plugin and while the plugin tries to start the server, it fails to initialise properly. The CLion log shows issues in the plugin.

Is there some guide for vim ?

We don’t have vim plugin for FFI navigator now, but you are welcome to contribute one :slight_smile: