pfultz2 / clangcomplete Goto Github PK
View Code? Open in Web Editor NEWClang completion for sublime
Clang completion for sublime
Is there a path you recommend for using this on mac? I can't get it to work with my version of LLVM (doesn't recognize what a vector
is of all things)
I use GLib on a C project. And it seems that the option "default_include_paths" is not being read properly.
On the setting file: ClangComplete.sublime-settings" I've added:
"default_include_paths":
[
"/usr/include/c++/4.8/",
"/usr/include/x86_64-linux-gnu/c++/4.8/.",
"/usr/include/c++/4.8/backward/",
"/usr/lib/gcc/x86_64-linux-gnu/4.8/include/",
"/usr/local/include/",
"/usr/include/",
"/usr/include/glib-2.0/",
"/usr/lib/x86_64-linux-gnu/glib-2.0/include/",
"/usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed/",
"/usr/include/x86_64-linux-gnu/",
"/usr/include/"
]
But I keep getting error messages for headers not found:
"fatal error: 'glib.h' file not found"
glib.h is on: /usr/include/glib-2.0/glib.h
Am I missing something? Or is it a bug?
Thank you and kudus for this project!
I get the following error when trying to compile using g++ 4.8:
complete.cpp: In function ‘std::shared_ptr<async_translation_unit> get_tu(const char*, const char**, int, int)’:
complete.cpp:536:39: error: could not convert ‘lock.std::unique_lock<_Mutex>::lock<std::timed_mutex>()’ from ‘void’ to ‘std::shared_ptr<async_translation_unit>’
if (timeout < 0) return lock.lock();
^
make: *** [all] Error 1
on commit 40e4bbb . This error does not occur with commit 8606a74.
This feature is really useful.
complete_at
error: plugin_host has exited unexpectedly, plugin functionality won't be available until Sublime Text has been restarted
Is there any recommendations how to debug such crashes?
I compiled ClangComplete on OSX with slight Makefile modifications, it is loaded but then immediately crashes plugin_host on first (or second) completion attempt.
When I open C++ file in sublime with no opened folders, plugin doesn't work and I see folowind log in console:
Traceback (most recent call last):
File "/opt/sublime_text/sublime_plugin.py", line 403, in on_post_text_command
callback.on_post_text_command(v, name, args)
File "/home/quasar/.config/sublime-text-3/Packages/ClangComplete/clangcomplete.py", line 492, in on_post_text_command
self.complete_at(view, "", pos, 0)
File "/home/quasar/.config/sublime-text-3/Packages/ClangComplete/clangcomplete.py", line 448, in complete_at
completions = convert_completions(get_completions(filename, get_args(view), row+1, col+1, "", timeout, get_unsaved_buffer(view)))
File "/home/quasar/.config/sublime-text-3/Packages/ClangComplete/clangcomplete.py", line 124, in get_args
project_path = get_project_path(view)
File "/home/quasar/.config/sublime-text-3/Packages/ClangComplete/clangcomplete.py", line 23, in get_project_path
return view.window().folders()[0]
IndexError: list index out of range
quote the usage here:
"Also if cmake is not used, options can be manually set by setting the default_options setting."
Could you be more detail on how to let ClangComplete parse the files in my project without cmake?
Summary: Could you make the display of the error panel optional and default to ON
?
I'm currently working on a project in which I mainly use ClangComplete for its completions, not the errors, as they are somewhat unreliable given that I'm compiling a miniature operating system for a university course.
It might be useful to use os.abspath on -I strings to cover the following edge case.
-I/home/user/projects/project/src/../deps/libraryname/include
This isn't really an issue with the code - almost certainly on my end - but..
I cloned the repo into my Packages folder (~/.config/sublime-text-3/Packages/User/) and then went into ClangComplete/complete and ran make. Didn't get any errors, all seemed well.
I got a complete.o and libcomplete.so, which, after looking through the Makefile, looks to be what the targets were (doesn't align with what the Install section of the readme says..). So I open up ST3 and nothing happens. I tried the keyboard shortcuts with no result.
I then mv'd the ClangComplete directory up one so it's in ~/.config.sublime-text-3/Packages/ instead of being inside the User directory, but that didn't change anything.
What am I doing wrong?
Has issues with Ubuntu 12.04. To get complete.cpp to compile clang-3.3, python-3.3, and gcc-4.8 have to be installed form ppa's. These ppa provide includes and libraries in different directories than the system ones. This proves to be a problem.
I was able to get complete.cpp to compile by altering the Makefile
-FLAGS=`pkg-config --cflags python-3.3`
+FLAGS=`pkg-config --cflags python-3.3` -I/usr/lib/llvm-3.3/include
However, nothing seems to be working within Sublime Text, not even any messages in the console.
Would you accept a patch that checks if https://github.com/SublimeLinter/SublimeLinter3 is available and if so optionaly, provides c/c++ errors/hints?
When enter a function name for completion, it expand to thing like "func()". I want it is "func ()".
Update: I solve it myself.
So, as always Red Hat based systems (fedora) always need a bit of special guidance when compiling.
This time I had to alter the makefile to set the clang_libs
variable to -L/usr/lib64/llvm -lclang
. It seems that the file libclang.so
is located at /usr/lib64/llvm
for a red hat based x64 system. And the clang_prefix
was changed to /usr/lib/clang/3.4.2
.
I'm not sure if it worth to add another condition to the makefile. But I though I should mention this if someone else is trying to use this awesome sublime package on their red hat system. Just saw #5 that fixes this issue completely
I have to note, I do get errors like /usr/lib/gcc/x86_64-redhat-linux/4.8.3/include/xmmintrin.h:213:10: error: use of undeclared identifier '__builtin_ia32_andps'
but it continues parsing and giving the correct warnings and errors for the stuff that matters, so I'm not complaining.
Hello,
i started to use this plugin yesterday. I pretty much like the "autoconfigure" idea of it.
A few problems happend when i started to work with it.
(I addessed the first two issues in a PR)
Otherwise awesome plugin!
Installed LLVM with
brew install --with-clang --with-all-targets --with-rtti --universal --jit llvm
but ld reports Undefined symbols error
g++ -std=gnu++0x -I/usr/local/opt/llvm/include/ -DNDEBUG -Os -c -fPIC complete.cpp -o complete.o
g++ -dynamiclib -Wl,-install_name,libcomplete.dylib -o libcomplete.dylib complete.o -L/usr/local/opt/llvm/lib/ -lclang
Undefined symbols for architecture x86_64:
"std::out_of_range::~out_of_range()", referenced from:
std::__1::unordered_map<unsigned int, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >, std::__1::hash<unsigned int>, std::__1::equal_to<unsigned int>, std::__1::allocator<std::__1::pair<unsigned int const, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > > >::at(unsigned int const&) in complete.o
std::__1::unordered_map<unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::hash<unsigned int>, std::__1::equal_to<unsigned int>, std::__1::allocator<std::__1::pair<unsigned int const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::at(unsigned int const&) in complete.o
"std::terminate()", referenced from:
___clang_call_terminate in complete.o
"typeinfo for std::out_of_range", referenced from:
std::__1::unordered_map<unsigned int, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >, std::__1::hash<unsigned int>, std::__1::equal_to<unsigned int>, std::__1::allocator<std::__1::pair<unsigned int const, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > > >::at(unsigned int const&) in complete.o
std::__1::unordered_map<unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::hash<unsigned int>, std::__1::equal_to<unsigned int>, std::__1::allocator<std::__1::pair<unsigned int const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::at(unsigned int const&) in complete.o
"vtable for std::out_of_range", referenced from:
std::__1::unordered_map<unsigned int, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >, std::__1::hash<unsigned int>, std::__1::equal_to<unsigned int>, std::__1::allocator<std::__1::pair<unsigned int const, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > > >::at(unsigned int const&) in complete.o
std::__1::unordered_map<unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::hash<unsigned int>, std::__1::equal_to<unsigned int>, std::__1::allocator<std::__1::pair<unsigned int const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::at(unsigned int const&) in complete.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [all] Error 1
Hi,
I read a comment that ClangComplete can work with any build system which generates compile_commands.json. I'm building with Scons, and have used Bear to create a compile_commands.json file.
Could you provide some instructions on how to proceed on the readme?
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.