Giter Site home page Giter Site logo

niosus / easyclangcomplete Goto Github PK

View Code? Open in Web Editor NEW
575.0 22.0 83.0 28.99 MB

:boom: Robust C/C++ code completion for Sublime Text 3/4

Home Page: https://niosus.github.io/EasyClangComplete/

License: MIT License

Python 99.29% C++ 0.31% CMake 0.07% Objective-C 0.26% Objective-C++ 0.01% CSS 0.01% Makefile 0.03% C 0.03% Starlark 0.01%
auto-complete sublime-text-3 code-completion plugin compilation-database compile cmake clang libclang cpp

easyclangcomplete's Introduction

🇺🇦 Stand With Ukraine! 🇺🇦

The war in the middle of Europe is unfathomable. We must do whatever we can to stop russia's imperialistic agression. While my heart bleeds for Ukraine, it's not just about one country. It is a about autocratic regimes doing the only thing they can against the democratic world - waging war. We must do whatever is in our power to stop russia and whoever supports them. This is our way to show that we as humanity are better than that.

Please consider providing any support that you can on the official Ukrainian website dedicated to this war: https://war.ukraine.ua

Anything helps. Donate to military or humanitarian causes if you can, host displaced Ukrainians in Europe or spread the word about this whole situation at the very least.

Thank you!

Irrelevant for now information

Hi 👋, I'm Igor!

GitHub followers GitHub User's stars Visitors GitHub Sponsors Donate

easyclangcomplete's People

Contributors

alpo avatar cpagravel avatar darwinyip avatar detly avatar dibalavs avatar genuineaster avatar igor-nuro avatar jeeb avatar kgizdov avatar kingkili avatar kjteske avatar kriomant avatar kyle-foreflight avatar mheinzler avatar mhoeher avatar monkeywithacupcake avatar niosus avatar oakmountainapps avatar papadokolos avatar pl-ca avatar rchl avatar rcopera avatar rwols avatar tastytea avatar tillt avatar tomasz-kaczkowski avatar turndn avatar vans163 avatar ventero avatar xolom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

easyclangcomplete's Issues

need for .no-sublime-package

Seems that something is not working properly if the package is installed as a zip. Need to investigate it. It probably will be better for users to have the plugin as a zip to save bandwidth.

How to disable printing all stuff into the sublime text console and disable code linting?

During EasyClangComplete plugin working, it prints different info into the console like this:

These info is unused majority of time and just spam into the console.
How I can disable it?

Also, is there a way how to disable static code linting (analyzing) in EasyClangComplete? (I use another Clang code analyzer for this and I don't want to load CPU for analyzing code with EasyClangComplete)

Filter out constructors

You definitely cannot call constructor with dot operator.
MyObject obj; obj.MyObject();
have no sense.
Completion proposal for classes with multiple overloaded constructors are cluttered with them.

plugin_host crashing

With the fixing of #44 , I see libclang being properly loaded. However, the first time I save a C++ source file after starting Sublime Text 3dev, the plugin host crashes:

error: plugin_host has exited unexpectedly, plugin functionality won't be available until Sublime Text has been restarted

I'm not sure if it happens with every source file, but I'm seeing it consistently on some large-ish source files I have. Nothing suspicious is showing up with "verbose": true in the config.

libclang not being found

I have the following EasyClangComplete.sublime-settings set:

{
    "clang_binary" : "/home/moconnor/Applications/gcc-4.8.2/bin/clang++",
    "use_libclang" : true,
    "triggers" : [ ".", "->", "::"],
    "auto_set_sublime_triggers" : true,
    "include_dirs":
    [
        "/home/moconnor/Applications/gcc-4.8.2/include/c++/4.8.2",
        "/home/moconnor/Source/carte/llvm-carte/llvm-3.8.0/include",
        "/home/moconnor/Source/carte/llvm-carte/llvm-3.8.0-bld/include",
        "/home/moconnor/Source/carte/llvm-carte/carte++/include"
    ],
    "std_flag" : "-std=c++11",
}

When I start Sublime Text 3dev, I get the following in the log:

INFO:EasyClangComplete.EasyClangComplete: init completer based on libclang
INFO:EasyClangComplete.plugin.completion.base_complete: Getting version from command: `/home/moconnor/Applications/gcc-4.8.2/bin/clang++ --version`
INFO:EasyClangComplete.plugin.completion.base_complete: Found clang version: 3.8
WARNING:EasyClangComplete.plugin.completion.lib_complete: cannot get default cindex with error: No module named 'clang'
WARNING:EasyClangComplete.plugin.completion.lib_complete: using bundled one: EasyClangComplete.clang.cindex38
ERROR:EasyClangComplete.plugin.completion.lib_complete: error: libclang.so.3.8: cannot open shared object file: No such file or directory. To provide a path to libclang use Config.set_library_path() or Config.set_library_file().
ERROR:EasyClangComplete.EasyClangComplete: cannot initialize completer with libclang.
INFO:EasyClangComplete.EasyClangComplete: falling back to using clang in a subprocess.
INFO:EasyClangComplete.EasyClangComplete: init completer based on clang from cmd
INFO:EasyClangComplete.plugin.completion.base_complete: Getting version from command: `/home/moconnor/Applications/gcc-4.8.2/bin/clang++ --version`
INFO:EasyClangComplete.plugin.completion.base_complete: Found clang version: 3.8

I am not sure why libclang is not being found.

/home/moconnor/Applications/gcc-4.8.2/bin/clang++ -print-file-name=libclang.so is returning the correct path of /home/moconnor/Applications/gcc-4.8.2/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../libclang.so.

No module named 'clang' in python3

I've followed the instructions, and installed the packages 'clang' and 'python-clang-3.4' (Ubuntu 14.04). But it seems like I've missed something because the plugin fails to find 'clang' python bindings.

The error I get in Sublime's console is:

INFO:EasyClangComplete.EasyClangComplete: init completer based on libclang
INFO:EasyClangComplete.plugin.completion.base_complete: Getting version from command: `clang++ --version`
INFO:EasyClangComplete.plugin.completion.base_complete: Found clang version: 3.4
WARNING:EasyClangComplete.plugin.completion.lib_complete: cannot get default cindex with error: No module named 'clang'
WARNING:EasyClangComplete.plugin.completion.lib_complete: using bundled one: EasyClangComplete.clang.cindex34

However, i'm able to import the allegedly missing library manually when executing python interpreter from the terminal. I'm pretty sure it is due to the fact that Sublime runs python3, and the python bindings are installed under /usr/lib/python2.7/dist-packages/clang/... I tried to find an official python3 package for the python bindings without success.

The README file of this plugin states that the python bindings are working fine on Ubuntu, so I'm pretty sure i did something wrong. Can you give me a hand?

Thanks ahead

reload .clang_complete if it changed

For now the .clang_complete file will be read only when opening a new file. I think it would be cool to read it a add its contents to the call to clang if it has changed after the last query when completing.

suppress_word_completion option

@abadcafe has pointed out

And, I suggest you supply a new option suppress_word_completion. In the case of autocomplete_all = true, people (like me :p) usually don't like any word completions because the plugin can almost always supply more exact completions.

Does EasyClangComplete copy file to user folder?

Hi, I just noticed that sometimes I get warning like this:

WARNING:EasyClangComplete.plugin.completion.bin_complete: completion c:\users\user\appdata\local\temp\bl.c:3:10: fatal error: 'string.h' file not found did not match pattern <_sre.SRE_Pattern object at 0x03C65578>

So, I'm just interested in. Is EasyClangComplete really create copy of edited file into the user folder?

fails to start on Linux (ubuntu 15.10)

the plugin doesn't work, and the console shows this:

  File "/opt/sublime_text/sublime_plugin.py", line 333, in on_activated_async
    callback.on_activated_async(v)
  File "ccomplete_plugin in /home/dvirsky/.config/sublime-text-3/Installed Packages/CComplete.sublime-package", line 194, in on_activated_async
  File "ccomplete_plugin in /home/dvirsky/.config/sublime-text-3/Installed Packages/CComplete.sublime-package", line 63, in load
  File "ccomplete_plugin in /home/dvirsky/.config/sublime-text-3/Installed Packages/CComplete.sublime-package", line 81, in getProjectPaths
  File "./python3.3/posixpath.py", line 151, in dirname
AttributeError: 'NoneType' object has no attribute 'rfind'

Show errors when building with clang binary

Sometimes clang binary fails to produce autocompletions like in issue #10

I guess it would be nice to show the errors. Just need to parse them with regex. Just like completions. Should be quite easy to do.

use clang binary as a fallback

In case something is wrong with libclang, use clang -cc1 for auto completion. It is slower, but seems to work independent of the system. This is a nice option to have and is a must until I figure out how to fix errors on Windows as described in issue #4

No error but no autocompletion on Apple Clang version > 7.3

I haven't yet set up the include_dirs, which is the crux of the problem, but this is a bit onerous for the projects I'm working with and I'm not even seeing completions based on the default settings yet (i.e. from the h files in the file folder and its parent folder).

Here are my current user settings:

{
  "std_flag" : "-std=c++03",
  "auto_set_sublime_triggers" : false,
  "auto_complete_triggers" :
  [
    {
      "characters": ".:>",
      "selector": "source.c++ - string - comment - constant.numeric"
    }
  ]
}

On a related note, since my project has 4 folders, where does $project_base_path point to?

proj.sublime-project looks something like this:

{
    "folders":
    [
        {
            "path": "to/src"
        },
        {
            "path": "to/other/src"
        },
        {
            "path": "to/yet/another/src"
        }
    ]
}

I'm hoping to coax EasyClangComplete to give me completions, but note that my projects are probably not clang compatible. I build them using VxWorks 6.4/6.8 that run modified versions of GCC 3.4.4/4.1.2.

Please add "C Improved" syntax.

Hi, a lot of users uses C Improved plugin. But EasyClangComplete doesn't support this syntax. I have already tested it - you need just add it to the tools.py (line 103):


    syntax_regex = re.compile("\/([^\/]+)\.(?:tmLanguage|sublime-syntax)")

    valid_extensions = [".c", ".cc", ".cpp", ".cxx", ".h", ".hpp", ".hxx"]
    valid_syntax = ["C", "C++", "C Improved"]

libclang completion doesn't work with clang version > 3.6

The completion works fine on the default setup. But the log says
INFO:EasyClangComplete.EasyClangComplete: falling back to using clang in a subprocess.
I found out that on my system I have libclang.so, not libclang-3.8.so.1
After I changed it completion stopped working

INFO:EasyClangComplete.EasyClangComplete: init completer based on libclang
INFO:EasyClangComplete.plugin.completion.base_complete: Getting version from command: `clang++ --version`
INFO:EasyClangComplete.plugin.completion.base_complete: Found clang version: 3.8
WARNING:EasyClangComplete.plugin.completion.lib_complete: cannot get default cindex with error: No module named 'EasyClangComplete.clang.cindex'
WARNING:EasyClangComplete.plugin.completion.lib_complete: using bundled one: EasyClangComplete.clang.cindex38
DEBUG:EasyClangComplete.EasyClangComplete: on_activated_async view id 4
DEBUG:EasyClangComplete.EasyClangComplete: on_activated_async view id 18
DEBUG:EasyClangComplete.EasyClangComplete:init completer for view id: 18
DEBUG:EasyClangComplete.plugin.plugin_settings: populating include dirs with current variables:
DEBUG:EasyClangComplete.plugin.plugin_settings: project_base_name = 
DEBUG:EasyClangComplete.plugin.plugin_settings: project_base_folder = /home/daniel/.config/sublime-text-3/Packages/EasyClangComplete
DEBUG:EasyClangComplete.plugin.plugin_settings: file_parent_folder = /home
DEBUG:EasyClangComplete.plugin.plugin_settings: include_dirs = ['/usr/include', '/home/daniel/.config/sublime-text-3/Packages/EasyClangComplete/src', '/usr/include/c++/6.1.1', '/usr/include/c++/6.1.1/x86_64-unknown-linux-gnu', '/usr/include/c++/6.1.1/backward', '/usr/local/include', '/usr/lib/clang/3.8.0/include', '/home/daniel']
DEBUG:EasyClangComplete.plugin.completion.lib_complete: searching for .clang_complete in /home/daniel up to /home/daniel/.config/sublime-text-3/Packages/EasyClangComplete
DEBUG:EasyClangComplete.plugin.completion.lib_complete: clang flags are: ['-std=gnu++1z', '-I/usr/include', '-I/home/daniel/.config/sublime-text-3/Packages/EasyClangComplete/src', '-I/usr/include/c++/6.1.1', '-I/usr/include/c++/6.1.1/x86_64-unknown-linux-gnu', '-I/usr/include/c++/6.1.1/backward', '-I/usr/local/include', '-I/usr/lib/clang/3.8.0/include', '-I/home/daniel']
DEBUG:EasyClangComplete.plugin.completion.lib_complete: compilation started for view id: 18
DEBUG:EasyClangComplete.plugin.completion.lib_complete: compilation done in 0.4559640884399414 seconds
DEBUG:EasyClangComplete.plugin.error_vis: generating error regions for view 18
DEBUG:root: adding error {'row': '20', 'file': '/home/daniel/test.cpp', 'col': '5', 'error': "unexpected namespace name 'std': expected expression"}
DEBUG:EasyClangComplete.plugin.error_vis: 1 error regions ready
DEBUG:EasyClangComplete.plugin.error_vis: showing error regions: [(325, 328)]
DEBUG:EasyClangComplete.EasyClangComplete: on_modified_async view id 18
DEBUG:EasyClangComplete.plugin.error_vis: erasing error regions for view 18
DEBUG:EasyClangComplete.EasyClangComplete: on_query_completions view id 18
DEBUG:EasyClangComplete.EasyClangComplete: starting async auto_complete at pos: 329
DEBUG:EasyClangComplete.plugin.completion.lib_complete: started code complete for view 18
DEBUG:EasyClangComplete.plugin.completion.lib_complete: no completions

Error highlighting on save mostly doesn't work.
It seems that cindex38.codeComplete returns None at line 2606 because ptr is False for some reason.
I have Sublime Text 3114, Arch linux and clang 3.8

Getting a OSError/stackoverflow on windows

Tried this plugin for the first time. I immediately got this error:

INFO:EasyClangComplete.EasyClangComplete: init completer based on libclang
INFO:EasyClangComplete.plugin.completion.base_complete: Getting version from command: `clang.exe --version`
INFO:EasyClangComplete.plugin.completion.base_complete: Found clang version: 3.8
WARNING:EasyClangComplete.plugin.completion.lib_complete: cannot get default cindex with error: No module named 'clang'
WARNING:EasyClangComplete.plugin.completion.lib_complete: using bundled one: EasyClangComplete.clang.cindex38
Package Control: Skipping automatic upgrade, last run at 2016-06-06 19:40:41, next run at 2016-06-06 20:40:41 or after
Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 333, in on_activated_async
    callback.on_activated_async(v)
  File "C:\Users\jordan\AppData\Roaming\Sublime Text 3\Packages\EasyClangComplete\EasyClangComplete.py", line 101, in on_activated_async
    settings=settings)
  File "C:\Users\jordan\AppData\Roaming\Sublime Text 3\Packages\EasyClangComplete\plugin\completion\lib_complete.py", line 198, in init
    error_vis.FORMAT_LIBCLANG)
  File "C:\Users\jordan\AppData\Roaming\Sublime Text 3\Packages\EasyClangComplete\plugin\error_vis.py", line 59, in generate
    self.errors_from_tu_diag(view, errors)
  File "C:\Users\jordan\AppData\Roaming\Sublime Text 3\Packages\EasyClangComplete\plugin\error_vis.py", line 94, in errors_from_tu_diag
    location = str(diag.location)
  File "C:\Users\jordan\AppData\Roaming\Sublime Text 3\Packages\EasyClangComplete\clang\cindex38.py", line 239, in __repr__
    filename = self.file.name
  File "C:\Users\jordan\AppData\Roaming\Sublime Text 3\Packages\EasyClangComplete\clang\cindex38.py", line 2644, in name
    return conf.lib.clang_getCString(conf.lib.clang_getFileName(self)).decode ('utf-8')
OSError: exception: stack overflow
Exception OSError: 'exception: access violation writing 0x0000006489000000' in 

Settings in Readme should stand out better

Many people miss the setting where they need to configure sublime text triggers. This step is crucial to get autocompletion working.

  1. Can I generate autocompletion triggers automatically and take the burden from the user's shoulders?
  2. Can I explain the initial setup steps better?

Python errors on any click or key press

Hi @niosus , I have installed the plug-in from package control and after configuring my includes I get the following errors on the console, which seems to come from the fact that completer is not initialized. I set verbose true but it seems to fail before it has the change to print anything. These errors happen as soon as I click anywhere or type anything. Any idea?

Traceback (most recent call last):
  File "/opt/sublime_text_3/sublime_plugin.py", line 333, in on_activated_async
    callback.on_activated_async(v)
  File "/home/plca/.config/sublime-text-3/Packages/EasyClangComplete/EasyClangComplete.py", line 88, in on_activated_async
    if completer.exists_for_view(view.id()):
AttributeError: 'NoneType' object has no attribute 'exists_for_view'
Traceback (most recent call last):
  File "/opt/sublime_text_3/sublime_plugin.py", line 333, in on_activated_async
    callback.on_activated_async(v)
  File "/home/plca/.config/sublime-text-3/Packages/EasyClangComplete/EasyClangComplete.py", line 88, in on_activated_async
    if completer.exists_for_view(view.id()):
AttributeError: 'NoneType' object has no attribute 'exists_for_view'
Traceback (most recent call last):
  File "/opt/sublime_text_3/sublime_plugin.py", line 231, in run_callback
    expr()
  File "/opt/sublime_text_3/sublime_plugin.py", line 314, in <lambda>
    run_callback('on_selection_modified', callback, lambda: callback.on_selection_modified(v))
  File "/home/plca/.config/sublime-text-3/Packages/EasyClangComplete/EasyClangComplete.py", line 111, in on_selection_modified
    completer.error_vis.show_popup_if_needed(view, row)
AttributeError: 'NoneType' object has no attribute 'error_vis'

Error upon c++ completion processing

When introducing error in c++ and autocompleting using clang binary an error occurs:

Exception in thread Thread-12:
Traceback (most recent call last):
  File "./threading.py", line 901, in _bootstrap_inner
  File "./threading.py", line 858, in run
  File "C:\Users\%username%\AppData\Roaming\Sublime Text 3\Packages\EasyClangComplete\plugin\clang_bin_complete.py", line 205, in complete
    complete_results)
  File "C:\Users\%username%\AppData\Roaming\Sublime Text 3\Packages\EasyClangComplete\plugin\clang_bin_complete.py", line 270, in _process_completions
    comp_dict = pos_search.groupdict()
AttributeError: 'NoneType' object has no attribute 'groupdict'

Moving it here from issue #4

EasyClangComplete fill some extra settings into the user preferences.sublime-settings

Hi, I have noticed that EasyClangComplete automatically adds few settings into the sublime user settings. When I try to remove this new section of settings - all ok, but when I start using EasyClangComplete - this section of settings came up into user settings again.
This behavior is unacceptable. Could you please fix this bug?

EasyClangComplete adds "auto_complete_triggers" section into the user settings:

    "auto_complete_triggers":
    [
        {
            "characters": "<",
            "selector": "text.html"
        },
        {
            "characters": ".>:",
            "selector": "source.c++, source.c - string - comment - constant.numeric"
        }
    ],

This is my EasyClangComplete settings:

{
    "use_libclang" : false,
    "autocomplete_all" : true,
    "search_clang_complete_file": false,
    "errors_on_save": false,
}

the "triggers" option are ineffective

my settings:

{
    "auto_complete_triggers":
    [
        {
            "characters": ".:>",
            "selector": "source.c - string - comment - constant.numeric"
        },
        {
            "characters": ".:>",
            "selector": "source.c++ - string - comment - constant.numeric"
        }
    ],
    "include_dirs" : [],
    "autocomplete_all": true,
    "std_flag" : "-std=gnu11",
}

1cdcd0bf-02eb-49e0-904a-4fdf1006c942

Why does the fix triggers dialog add a `text.html` trigger?

This isn't really an issue, rather a question. On Windows, when I answer the dialog with "Sure!", this is what is written into my user settings file:

"auto_complete_triggers":
[
    {
        "characters": "<",
        "selector": "text.html"
    },
    {
        "characters": ".>:",
        "selector": "source.c++, source.c - string - comment - constant.numeric"
    }
]

As I couldn't find this in the plugin code I assume that ST adds this by itself (don't know why this would be necessary).

BTW wouldn't it make sense to add the triggers to the syntax specific files for C and C++ rather than the main user settings? Would maybe be more sensible in the modular ST package way, but may be harder to find/configure for the user.

Default completions disappear after a split second

When I have "autocomplete_all" set to true and "hide_default_completions" set to false, if there are no Clang completions to be shown, default Sublime completions only get shown for a split second before disappearing. This is a huge pain because Clang misses a lot of symbols from the current file that I'd like to autocomplete.

search for a correct libclang.so

There are many flavors of Linux out there. If you install libclang-3.6 on Ubuntu, you will get libclang-3.6.so.1 but not libclang.so. Arch on the contrary will have libclang.so but not the libclang-3.6.so.1. I guess I can remove the clang folder and replace it by just one single modified cindex file that will handle searching for a correct version on the library.

Ease up readme

It should be easy to start. There are people that struggle to make it work. Make the process really easy!

opencv completions fail

@simonhaenisch reported this:

This is what I get now when trying to trigger a completion for a Mat variable or doing cv:: (I shortened the full paths for the -I arguments). Somehow it can't get any completions for OpenCV (maybe I use the wrong include dir?)... I use another framework and for that most completions work.

Tracking this issue here.

Autocompletion is not working

The autocompletion is not working. But, the highlight works.

My configuration :

  • Sublime Text Build 3114 (Default conf with plugin "Package Control" and "EasyClangComplete")
  • Ubuntu 15.10
  • Ubuntu clang version 3.6.2-1
  • libclang-3.6-dev

Log :

reloading plugin EasyClangComplete.EasyClangComplete
plugins loaded
INFO:EasyClangComplete.EasyClangComplete: init completer based on libclang
INFO:EasyClangComplete.plugin.completion.base_complete: Getting version from command: clang++ --version
INFO:EasyClangComplete.plugin.completion.base_complete: Found clang version: 3.6
WARNING:EasyClangComplete.plugin.completion.lib_complete: cannot get default cindex with error: No module named 'clang'
WARNING:EasyClangComplete.plugin.completion.lib_complete: using bundled one: EasyClangComplete.clang.cindex36

use default autocomplete

When this plugin is enabled, is there a way to still have the default Sublime Text autocomplete for example for variable names?

Highlight errors

There is an easy way to use libclang to highlight errors. I think it would be cool to have it.

file not found when searching for libclang

@pl-ca reported:

When I launch ST3 after installing the plug-in I get an error related to some file not found. Am I missing something?

reloading plugin test-complete-plugin.script
Traceback (most recent call last):
  File "./python3.3/subprocess.py", line 1104, in _execute_child
FileNotFoundError: [WinError 2] Le fichier spécifié est introuvable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 78, in reload_plugin
    m = importlib.import_module(modulename)
  File "./python3.3/importlib/__init__.py", line 90, in import_module
  File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
  File "<frozen importlib._bootstrap>", line 1022, in load_module
  File "<frozen importlib._bootstrap>", line 1003, in load_module
  File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper
  File "<frozen importlib._bootstrap>", line 868, in _load_module
  File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
  File "C:\Users\Pierre-Louis\AppData\Roaming\Sublime Text 3\Packages\test-complete-plugin\script.py", line 14, in <module>
    clang_dir = ClangUtils.find_libclang_dir("clang++")
  File "C:\Users\Pierre-Louis\AppData\Roaming\Sublime Text 3\Packages\test-complete-plugin\clang\utils.py", line 62, in find_libclang_dir
    get_library_path_cmd).decode('utf8').strip()
  File "./python3.3/subprocess.py", line 576, in check_output
  File "./python3.3/subprocess.py", line 819, in __init__
  File "./python3.3/subprocess.py", line 1110, in _execute_child
FileNotFoundError: [WinError 2] Le fichier spécifié est introuvable

Moving here from #4

How to add some EasyClangComplete settings to project settings?

Hi,
I am very grateful to you for this plugin. I have the next question: how to add some include_dirs into *.sublime-project file? It is important because the folder structures with .h files are different from project to project.

For example, I recently create plugin which uses Cling binary for linting C, C++. So, in my *.sublime-project file the settings for plugin looks like this:

{
    "folders":
    [
        {
            "follow_symlinks": true,
            "path": ".",
            "file_exclude_patterns": [".tags", ".tags_sorted_by_file", ".gemtags"],
        }
    ],
    "settings":
    {
        "clanglinter_cmd_options":
        [
            "-I${project_path}/source",
            "-I${project_path}/source/Common",
            "-I${project_path}/source/DL",
            "-I${project_path}/source/BL",
            "-I${project_path}/source/HAL",
            "-I${project_path}/source/HAL/src-STM32F3xx",
            "-I${project_path}/source/HAL/src-STM32F3xx/PLib/CMSIS/CoreSupport",
            "-I${project_path}/source/ThirdParty",
            "-I${project_path}/source/UL",
            "-DSTM32F334x8",
            "-DUSE_STDPERIPH_DRIVER",
            "-DARM_MATH_CM4",
            "-DHSE_VALUE=8000000",
            "-std=c99",
            "-Wall",
            "-IE:/soft/1-ready/sublimetext/GNU Tools ARM Embedded/arm-none-eabi/include",
        ]
    }
}

Support cmake CMAKE_EXPORT_COMPILE_COMMANDS and compile_commands.json

Thanks for the plugin! It would be cool, if ECC could read the compile_commands.json file that cmake generates if you pass -DCMAKE_EXPORT_COMPILE_COMMANDS=ON.
In this file it lists all flags that where used for every file.

The compile_commands.json output looks like this:

[
{
  "directory": "/Users/me/mytool",
  "command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++   -DAVX2 -I/Users/me/repositories/mytool/src/commons -I/Users/me/repositories/mytool/src/util -I/Users/me/repositories/mytool/lib/getoptpp    -march=native -mavx2 -mfpmath=sse -std=c++0x -m64 -pedantic -Wall -Wextra -Winline -Wdisabled-optimization -Wno-unused-parameter -stdlib=libc++ -O3 -DNDEBUG  -march=native -mavx2 -mfpmath=sse -O3 -DNDEBUG -ffast-math -fno-exceptions -ftree-vectorize -fno-strict-aliasing   -o src/CMakeFiles/mytool.dir/mytool.cpp.o -c /Users/me/repositories/mytool/src/mytool.cpp",
  "file": "/Users/me/repositories/mytool/src/mytool.cpp"
}
...
]

Please add EasyClangComplete folder into user temp folder.

It would be nice if you change EasyClangComplete plugin behavior
from:
using raw Temp user folder for storing analyzed files
to:
create EasyClangComplete folder into Temp folder and using EasyClangComplete folder for storing analyzed files.

It increase stability and lets plugin avoid situation when there are some *.c or *.h files into Temp folder.

Regex error

from Reddit. Ksecutor wrote:

When trying to complete there is an error in console:

Traceback (most recent call last): 
File "C:\Soft\Sublime Text 3\sublime_plugin.py", line 333, 
in on_activated_async callback.on_activated_async(v) 
File "C:\Soft\Sublime Text 3\Data\Packages\EasyClangComplete\EasyClangComplete.py", line 97, 
in on_activated_async file_parent_folder=parent_folder) 
File "C:\Soft\Sublime Text 3\Data\Packages\EasyClangComplete\plugin\plugin_settings.py", line 242, 
in populate_include_dirs "(\$project_base_path)", self.project_base_folder, include_dir) 
File "./python3.3/re.py", line 170, in sub File "./python3.3/re.py", line 309, 
in _subx File "./python3.3/re.py", line 296, 
in _compile_repl File "./python3.3/sre_parse.py", line 801, 
in parse_template sre_constants.error: missing group name

request: project-specific settings

Is there any possiblilty that adding a 'read project-specific setting' feature before processing a file?

Maybe the project-specific setting file is a .clang_complete file as used by vim's clang_complete plugin.

EasyClangComplete can search up from the directory tree for the setting file. If it's found, use it to add parameters passed to clang.

Library mode support for OS X.

I've been looking into getting library mode working on OS X - and it actually seems to be working just fine almost out of the box!

I had to make one small change, as I'm not using the default clang/LLVM installation that ships with Xcode, but a Homebrew installation instead. The code for that can be found in Ventero@e79556c - from what I can tell, that snippet should work for all clang installations on OS X - including the default Xcode installation.

After applying that change, autocompletion and error highlighting worked just fine with most clang versions tested - only 3.8 segfaults somewhere inside libclang, so I guess there's some kind of mismatch between that version of cindex.py and the native library.

If you think the commit above makes sense, feel free to apply it.

libclang tests on linux

I know it works because it works on all machines I installed it to, but there are no unit tests for this. I believe this needs to be fixed. The travis ci comes with a strange clang instalation, so maybe there will be some magic on how to find the library, so probably this relies on issue #22

Verbose remote tests

Currently, the tests that I run on travis and appveyor are not verbose. They just say that something is wrong, but not what exactly is wrong. I need that info to understand why it cannot find libclang.

Errors on windows [libclang related]

When running on windows the plugin cannot find libclang with the error EasyClangComplete: function 'clang_CXXField_isMutable'. Moving the discussions about this here from issue #1

Don't try to find default libclang python bindings

The default python bindings are working with Python 3 only (ugh). There is no reason to try to find them. I should probably remove the warning to avoid confusion and just use the cindex files that I provide with my package.

clear not used translation units

If there is many tabs opened after some code has been written using libclang completion in them, there is going to be a bunch of translation units saved in memory. I think it is a good idea to free this memory after some time.

AttributeError: 'NoneType' object has no attribute 'error_vis'

With the latest version I don't get any completions anymore on Windows (not libclang). I get this in console:

Traceback (most recent call last):
  File "<ST3-Path>\sublime_plugin.py", line 231, in run_callback
    expr()
  File "<ST3-Path>\sublime_plugin.py", line 314, in <lambda>
    run_callback('on_selection_modified', callback, lambda: callback.on_selection_modified(v))
  File "<ST3-Packages-Path>\EasyClangComplete\EasyClangComplete.py", line 118, in on_selection_modified
    completer.error_vis.show_popup_if_needed(view, row)
AttributeError: 'NoneType' object has no attribute 'error_vis'

And a few similar ones:

(...) EasyClangComplete.py", line 129, in on_modified_async
    completer.error_vis.clear(view)
AttributeError: 'NoneType' object has no attribute 'error_vis'
(...) EasyClangComplete.py", line 94, in on_activated_async
    if completer.exists_for_view(view.buffer_id()):
AttributeError: 'NoneType' object has no attribute 'exists_for_view'
(...) EasyClangComplete.py", line 175, in on_query_completions
    if completer.async_completions_ready:
AttributeError: 'NoneType' object has no attribute 'async_completions_ready'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.