There seems to be a problem with the latest build of Sublime Text (2181) and this plugin. Per-project settings donāt work at all and the Sublimeclang error pane makes the caret disappear and re-appear every time you move it while the pane is visible. Downgrading to 2165 resolves these issues.
Clang (C/C++/Objective-C/Objective-C++) autocomplete
Under Windows to autocomplete filenames in my āincludeā directories (like stdio.h) Iāve added these lines to my āSublimeClang.sublime-settingsā file (in āoptionsā section) as below:
āoptionsā:
....
.
.
.
//include path for minGW
,"-IC:\\Program Files\\MinGW\\include"
,"-IC:\\Program Files\\MinGW\\lib\\gcc\\mingw32\\4.6.1\\include"
],
Nice coding!
(Iāve typed commas first to know which line is added to the file and to remove just the lines if needed)
P.S. Your āSublimeClang.sublime-settingsā file is in ā%Appdata%\Sublime Text 2\Packages\SublimeClangā folder.
[quote=āsujzā]Try to use ā//ā or ā\ā instead of āā for Windows.
[quote=ātiktaalikā]
Tried this but didnāt have an effect. Currently looks like so:
"-ID:/blah/MadScience/Project/blahproj/dev/Package/",
"-ID:/blah/MadScience/Project/blahproj/dev/Source/"
[/quote]
On Windows I have found that you should not have a trailing ā/ā in the path. Additionally I tend to use ā\ā instead of ā/ā because āā is the native character on Windows for file separation (and because its an escape character you need two of them).
I thought Iād replied previously but it looks otherwise - thank you for adding this feature, it is proving to be very useful.
[quote=āadnā]Under Windows to autocomplete filenames in my āincludeā directories (like stdio.h) Iāve added these lines to my āSublimeClang.sublime-settingsā file (in āoptionsā section) as below:
āoptionsā:
....
.
.
.
//include path for minGW
,"-IC:\\Program Files\\MinGW\\include"
,"-IC:\\Program Files\\MinGW\\lib\\gcc\\mingw32\\4.6.1\\include"
],
Nice coding!
(Iāve typed commas first to know which line is added to the file and to remove just the lines if needed)
P.S. Your āSublimeClang.sublime-settingsā file is in ā%Appdata%\Sublime Text 2\Packages\SublimeClangā folder.[/quote]
This works for me very well but I get a lot of errors from mingw files like this:
img651.imageshack.us/img651/3976 ā¦ 181953.png
Any solution to fix/disable this ?
Temporarily i set show_output_panel to false to disable this annoying errors.
My options:
"options":
"-Wall",
"-Wextra",
"-ferror-limit=0",
"-IE:/Dev/Tools/MinGW64/include",
"-IE:/Dev/Tools/MinGW64/lib/gcc/x86_64-w64-mingw32/4.6.1/include",
"-IE:/Dev/Libs/gmock-1.6.0/include",
"-IE:/Dev/Libs/gmock-1.6.0/gtest/include",
"-IE:/Dev/Libs/glfw-2.7.2/include",
// projects paths here
]
First of all, thanks for a great plugin!
I have stumbled upon a very annoying problem, that forces me to disable auto completion.
The problem I have is that auto completion does not seem to understand anonymous unions.
The library iām trying to use has a struct that contains a type and a union with type dependent data.
The problem is that the type will always be auto completed (like there was no other members in the struct).
This makes it impossible to write code to access the members within the union.
I supply a minimal code example that can reproduce the problem.
struct MyStruct
{
int type;
union
{
int value_int;
double value_double;
};
};
int main(int argc, char const *argv])
{
struct MyStruct my_struct;
// try to use my_struct here with autocompletion enabled.
// type is always auto completed and it is impossible
// to write code to access value_int or value_double with auto complete enabled.
return 0;
}
Iāve opened an issue for this on the SublimeClang homepage: github.com/quarnster/SublimeClang/issues/54
BTW, you can toggle the plugin on and off via the default keybinding alt+d,alt+t.
Iāve been reading through this thread and am still wondering if there is a definitive answer on whether or not clang autocomplete works properly on Windows 64 Sublime 2 using MinGW for C++ STL. I have the following in my User Options for SublimeClang:
[code]{
āoptionsā:
"-Wall",
"-IC:\\MinGW\\include",
"-IC:\\MinGW\\lib",
"-IC:\\MinGW\\lib\\gcc\\mingw32\\4.6.2\\include\\c++",
"-IC:\\MinGW\\lib\\gcc\\mingw32\\4.6.2\\include\\c++\\mingw32"
]
}
[/code]
and while it looks like the plugin is doing something, I keep getting the following error:
C:\MinGW\include\wchar.h:26,10 - Fatal - āstddef.hā file not found
stddef.h is sitting in C:\MinGW\lib\gcc\mingw32\4.6.2\include and when I alter the options to include that directory, the previous error goes and I am confronted with:
C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++\cwchar:145,11 - Error - no member named āfgetwsā in the global namespace
C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++\cwchar:147,11 - Error - no member named āfputwsā in the global namespace
C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++\cwchar:151,11 - Error - no member named āgetwcā in the global namespace
C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++\cwchar:152,11 - Error - no member named āgetwcharā in the global namespace
C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++\cwchar:157,11 - Error - no member named āputwcā in the global namespace
C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++\cwchar:158,11 - Error - no member named āputwcharā in the global namespace
C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++\bits/basic_ios.h:249,26 - Error - expected ā)ā
C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++\bits/basic_ios.h:249,17 - Note - to match this ā(ā
Any suggestions would be greatly appreciated.
Iāve found a problem that if in my sublimeclang_options I include a directory with a large number of files (1249 to be exact), sublime crashes with the following error:
https://dl.dropbox.com/u/427616/crash.png
I happen to have VS10 installed, and this is the assertion in question:
_Myiter& operator++()
{ // preincrement
#if _ITERATOR_DEBUG_LEVEL == 2
if (this->_Getcont() == 0
|| this->_Ptr == 0
|| ((_Myvec *)this->_Getcont())->_Mylast <= this->_Ptr)
{ // report error
_DEBUG_ERROR("vector iterator not incrementable");
_SCL_SECURE_OUT_OF_RANGE;
}
The Sublime console shows the following after the crash:
Exception AttributeError: "Cache instance has no attribute 'cache'" in <bound method Cache.__del__ of <translationunitcache.Cache instance at 0x000000000552F808>> ignored
Traceback (most recent call last):
File ".\common.py", line 173, in worker
File ".\translationunitcache.py", line 723, in task_reparse
File ".\translationunitcache.py", line 849, in get_translation_unit
File ".\translationunitcache.py", line 640, in __init__
File ".\translationunitcache.py", line 108, in __init__
WindowsError: [Error -2147483645] One or more arguments are invalid
Sublime itself doesnāt crash until I click āabortā, so Iām actually guessing the assertion is actually in libclang.dll.
This is with ST 2181 (Windows obviously).
Thanks.
Iāve opened up a new issue on github for this. Is your code base shareable so that I can get a copy of what you are seeing? If not, do you have a small test where this reproduces? Otherwise itās unlikely to be fixed from my side as I donāt code on Windows and itās not something Iāve seen from my limited testing on Windows.
Thanks. Iām not able to share the codebase Iām working on, but Iāll try to reproduce the problem with test code. Barring that, I can help debug it a bit for you if you have some things youād like me to try.
I had a quick play with this yesterday on windows and was getting lockups
I seem to recall reading that clang hardcodes visual studio/mingw paths?
Does anyone know if itās possible to steer it towards sources on a linux vm?
castles_made_of_sand, if your lockups are the same as RyanJās then maybe it has been fixed now. You could disable all the standard includes via ā-nostdincā. As long as the vm sources are available as a windows file path you should be able to steer it that way.
RyanJ, I think your issue has been fixed. As issue 74 hasnāt been fixed yet, could you use package control to remove SublimeClang, quit Sublime Text 2, delete the SublimeClang package folder and then re-install it via Package Control and see if the issue is gone now please?
So, I just got a lockup, the console was open and there was a traceback:
[code]Traceback (most recent call last):
File ".\sublimeclang.py", line 553, in recompile
File ".\translationunitcache.py", line 776, in reparse
File ".\translationunitcache.py", line ???, in get_opts_script
File ".\common.py", line 82, in expand_path
TypeError: unsupported operand type(s) for %: āNoneTypeā and ādictā
[/code]
(FFFF I just typed that in by hand and seem to have fucked up one of the line numbers )
Dunno how itās related to the lockup, but that 's the last bit info in the console.
From a superficial look, not really understanding the why/what/how of the locking , I can see a lack of try/finally with some uses of the locks, so an exception will mean the lock doesnāt get released.
Seems like itās a dictlike.get(key, None) % dict()
situation
Will take a look
Ah, using a Lock() instead of a reentrant lock, which if you grab in the same thread again, wonāt cause these locks.
I made a 1 character change to RLock and that same exception no longer causes the freeze.
Traceback (most recent call last):
File ".\sublimeclang.py", line 553, in recompile
File ".\translationunitcache.py", line 776, in reparse
File ".\translationunitcache.py", line 806, in get_opts_script
File ".\common.py", line 82, in expand_path
TypeError: unsupported operand type(s) for %: 'NoneType' and 'dict'
Iāll patch LockedVariable to make it a context manager.
Is there any way to get contextually aware auto completion?
For example, say I have my cursor, represented as ā|ā, inside #include <|
, Iām getting completion choices for macros and what have you.