davidhalter / jedi-vim

Using the jedi autocompletion library for VIM.
MIT License
5.28k stars 370 forks source link

How can I exclude certain library paths from jedi-vim? #905

Closed danijar closed 5 years ago

danijar commented 5 years ago

My workstation includes some Python packages via a network drive. How can I prevent jedi-vim from crawling the path where the network drive is mounted to avoid slowing down the whole system?

For example, I had the same problem with the ALE syntax highlighter, which I solved by setting an option let g:ale_pattern_options = {'/path/to/exclude/.*': {'ale_enabled': 0}}.

davidhalter commented 5 years ago

I'm not sure if jedi-vim is really your problem. We're not really indexing - unless you use completion on those files. Since there is no indexing (except maybe if you use usages), we just open the files that are relevant for completions. Usually none at all, in some cases probably like 10. If that's not possible your system is so slow that you should probably work on improving the system instead :)

If you don't want completions for certain files, this is at the moment not possible with Jedi. If it's not about completions, but about highlighting - it's probably another system's fault.

I currently have other priorities (see the issues list in Jedi), therefore this is not going to happen anytime soon.

danijar commented 5 years ago

Thanks for getting back, @davidhalter. Are you sure it only opens up to about 10 files per Vim buffer? My program has several thousands of Python files as indirect import dependencies which are stored on the network disk. I'm only using jedi-vim for "goto definition", etc and deoplete-jedi for completions -- I will look into that plugin, too.

The jedi-vim plugin is invaluable to me, but I understand that there are other priorities right now. However, I don't think it should be difficult to add a regex check before opening files. If you don't have capacity, could you point me to the relevant parts of the code so I can take a stab at this?

davidhalter commented 5 years ago

Are you sure it only opens up to about 10 files per Vim buffer?

Yes. No index is generated. Unless you use completions on very complex code, it opens just one a few files (mostly stdlib related).

However, I don't think it should be difficult to add a regex check before opening files. If you don't have capacity, could you point me to the relevant parts of the code so I can take a stab at this?

It's not that simple. There are quite a few places where files are opened. Also I don't want to complicate things. I really think Jedi is not an issue here - if it was I would like to see you profile it a bit more. I'm happy to look into it if Jedi really loads a lot of files - but I haven't seen these numbers from you.