Python language server support


Please read tips for efficient and successful posting and posting code

Please fill also the fields below. Note that root -b -q will tell you this info, and starting from 6.28/06 upwards, you can call .forum bug from the ROOT prompt to pre-populate a topic.

ROOT Version: 6.28/10
Platform: CentOS 7
Compiler: linuxx8664gcc


Hi all,

Nowadays, popular code editors usually offer something called language server protocol (LSP). The features of LSP include jumping to definition and displaying inline code diagnostics etc. I have set up pyright as my python LSP, and I always get unknown member errors for ROOT module, below is one example:

I’m not able to jump to the definition of EnableImplicitMT(), but I can jump to the definition of ROOT package, so the LSP does recognize the top level ROOT.

I understand ROOT’s python interface is built upon cppyy. Perhaps this is why all the ROOT member functions are “opaque” to LSP, as they are really just C++ classes. In this sense, there may not be a solution from ROOT side at all, and it has to be fixed at LSP or cppyy level. Nonetheless, I still hope to find any workaround from the forum, so any suggestions will be really appreciated!

Hi Patrick,

Thanks for the interesting post.
As you say, entities in the ROOT module are bound lazily and dynamically through cppyy and I am not surprised tools like pyright do not work out of the box. I think we do not have a solution to support that at the moment, but don’t hesitate to reach out if you have a breakthrough!

Cheers,
Danilo

1 Like

Definitely!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.