Error on hovering over variable
See original GitHub issueI am able to use the completion when I type a trigger character, however, when I hover over a variable, the console displays the following output:
INFO:EasyClangComplete.plugin.view_config: init completer based on libclang ERROR:concurrent.futures:exception calling callback for <Future at 0x7f288d91ff10 state=finished raised ArgumentError> Traceback (most recent call last): File “./python3.3/concurrent/futures/_base.py”, line 296, in _invoke_callbacks File “/home/avidbots/.config/sublime-text-3/Packages/EasyClangComplete/EasyClangComplete.py”, line 261, in info_finished (tooltip_request, result) = future.result() File “./python3.3/concurrent/futures/_base.py”, line 394, in result File “./python3.3/concurrent/futures/_base.py”, line 353, in __get_result File “./python3.3/concurrent/futures/thread.py”, line 54, in run File “/home/avidbots/.config/sublime-text-3/Packages/EasyClangComplete/plugin/completion/lib_complete.py”, line 242, in info self.tu, self.tu.get_location(view.file_name(), (row, col))) File “/home/avidbots/.config/sublime-text-3/Packages/EasyClangComplete/plugin/clang/cindex35.py”, line 2346, in get_location f = self.get_file(filename) File “/home/avidbots/.config/sublime-text-3/Packages/EasyClangComplete/plugin/clang/cindex35.py”, line 2335, in get_file return File.from_name(self, filename) File “/home/avidbots/.config/sublime-text-3/Packages/EasyClangComplete/plugin/clang/cindex35.py”, line 2531, in from_name return File(conf.lib.clang_getFile(translation_unit, file_name)) ctypes.ArgumentError: argument 2: <class ‘TypeError’>: wrong type
These are the settings I am using:
{
"flags_sources": [
{"file": ".clang_complete"},
{"file": "compile_commands.json"},
{"file": "CMakeLists.txt"},
],
"common_flags" : [
// some example includes
"-I/usr/include",
// this is needed to include the correct headers for clang
"-I/usr/lib/clang/$clang_version/include",
"-I/opt/ros/indigo/include",
"-I/opt/ros/indigo/include/roscpp",
"-I/usr/include/x86_64-linux-gnu/c++/4.8",
"-I/home/avidbots/Dev/avidbots/ros_indigo/src/avidbots_library/"
],
// C specific flags. Prepend common_flags for C files.
"c_flags" : [
"-std=c11"
],
// C++ specific flags. Prepend common_flags for C++ files.
"cpp_flags" : [
"-std=c++11"
],
"clang_binary" : "clang-3.5"
}
I’m only using the .clang_complete file. It is quite large since I am developing a robotics project with ROS and a large amount of nodes (each with different include directories).
The first 9 lines of this file is:
-I/usr/include -I/usr/include/eigen3 -I/usr/lib/clang/$clang_version/include -I/opt/ros/indigo/include -I/opt/ros/indigo/include/roscpp -I/usr/include/x86_64-linux-gnu/c++/4.8 -I/home/avidbots/Dev/avidbots/ros_indigo/src/avidbots_library -I/home/avidbots/Dev/avidbots/ros_indigo -I/home/avidbots/Dev/avidbots/ros_indigo/devel/include
Issue Analytics
- State:
- Created 7 years ago
- Comments:15 (15 by maintainers)
Oh it works now. I cleared my cache with EasyClangComplete: Clean current CMake cache.
I can now see the types of variables once I hover over them and I get information on functions as well. Excellent! I think this solves it. So I guess this could be wrapped up. The problem was that the wrong libclang library was being used.
Suggestion: I would suggest that for Linux, after receiving the binary you could parse the input produced by “<clangbinary> -v”. Which you already do in /plugin/tools.py as version_str except that you only need the first 2 digits separated by a dot: I.e. in regex (?<= )(\d.\d)
Then for Linux systems attempt to search first for a libclang file that has the form: libclang-<parsed_version_string>.so.1
A quick fix would be to accept an input in the settings file for the libclang library name; perhaps a good fallback.
Closed with the pull request.