niosus / EasyClangComplete

:boom: Robust C/C++ code completion for Sublime Text 3/4
https://niosus.github.io/EasyClangComplete/
MIT License
575 stars 78 forks source link

Ability to turn off or manually restrict 'include auto completion' feature #705

Closed matreshkin closed 3 years ago

matreshkin commented 4 years ago

System info:

What happens:

Keeping admiring the plugin, I have a few perf issues. One of them is related to includes.

I'm working on a project inside a large repo and my files can #includes files from other projects. Specifically, there almost always are -I flag with root repo path in compiler flags. I had to write my own plugin to collect only required folders for header lookup (just listing them in the project config).

Now I've noticed that ECC tries to search headers on its own and 'goes through' that root folder. While this, 'plugin_host' gains lot of processor time. I am looking forward to ability

Log that illustrates the issue: ``` [ECC:DEBUG]:[EasyClangComplete.py]:[on_query_completions]:[MainThread]: showing default completions [ECC:DEBUG]:[include_parser.py]:[get_all_headers]:[Thread-6]: Going through: /usr/include [ECC:DEBUG]:[include_parser.py]:[get_all_headers]:[Thread-6]: Going through: /usr/include/c++/7 [ECC:DEBUG]:[include_parser.py]:[get_all_headers]:[Thread-6]: Going through: /usr/local/include [ECC:DEBUG]:[include_parser.py]:[get_all_headers]:[Thread-6]: Going through: /usr/include/c++/7/backward [ECC:DEBUG]:[include_parser.py]:[get_all_headers]:[Thread-6]: Going through: /usr/include/x86_64-linux-gnu [ECC:DEBUG]:[include_parser.py]:[get_all_headers]:[Thread-6]: Going through: /usr/include/x86_64-linux-gnu/c++/7 [ECC:DEBUG]:[include_parser.py]:[get_all_headers]:[Thread-6]: Going through: /REALLY/HUGE/CODEBASE/THAT/IS/ACTUALLY/MOUNTED ```
niosus commented 4 years ago

Yes, this feature is a bit half-baked and you raise a valid point. I was sure that I allow turning this off, but apparently not. Will add a switch. If you have ideas on how to implement this better feel free to contribute or just start a discussion in a new issue.

matreshkin commented 4 years ago

Thanks!

By the way, does this feature reads all the compile_commands.json to fill the folder list? Is it on plugin startup or at the moment autocompletion starts?

niosus commented 3 years ago

I will close this issue to continue talking about it in #706 if you don't mind. Hopefully I will get to actually implement this in a proper way some time soon.