Commit Graph

1266 Commits

Author SHA1 Message Date
Strahinja Val Markovic
0903d5151b Fix for unique_future in c++03 having private ctor 2012-08-13 10:13:51 -07:00
Strahinja Val Markovic
d099492a0f Adding a TODO; another var good for Boost.Atomic 2012-08-12 19:08:43 -07:00
Strahinja Val Markovic
f500ecaffb Fix for hang on insert enter after "foo.bar"
If the user had code like "foo.bar" and then entered insert mode after the 'r'
in "bar", YCM would cause vim to hang.

The problem happened because a sorting task was created that would try to sort
on the latest clang result but none would be created because a clang task was
not created in this occasion. clang_data_ready_ would remain false and would
never be set to true, thus causing an infinite loop in SortingThreadMain since
the thread would forever wait on the mutex.

This was rectified with better handling of the clang results cache. Now the
cache is a full class and it also stores the line & column number of the
location for which the results were computed. Better logic is in place for the
cache invalidation.
2012-08-12 19:01:39 -07:00
Strahinja Val Markovic
f99e89f812 Fix for "lclose not allowed here" error on open
The problem was caused by a race condition of all things. ClangCompleter would
set possibly_completions_ready when starting the first parse pass for the file
and then would try to extract diagnostics for the file before the diagnostics
were done. Technically this was not a problem because only an empty diagnostics
vector would be returned, but this triggered Syntastic because hey, we have some
diagnostics to show (even though we don't).

And then Syntastic would try to close the location list window during startup
when this operation is not available. Technically it's Syntastic's fault, but a
more principled way to check for done diagnostics is to return and use a future
for file parsing operations and this solution also works around the Syntastic
issue.
2012-08-12 14:36:36 -07:00
Strahinja Val Markovic
fef702eef0 Reversed the logic for the no-results-found var 2012-08-12 14:07:38 -07:00
Strahinja Val Markovic
de8f45c202 Possible fix for rare completion-repeat bug
On rare occasions a bug can occur where the user is trying to type text but the
completion system is erasing it as he types. I believe this new approach should
fix that problem. It also replaces the old system for preventing an infinite
loop to occur when there are no completions to show to the user.
2012-08-11 21:20:17 -07:00
Strahinja Val Markovic
d793919969 Removing old debugging statement 2012-08-11 21:19:06 -07:00
Strahinja Val Markovic
67c69197d8 Refactorings and removing dead code 2012-08-11 20:13:12 -07:00
Strahinja Val Markovic
6a2f8c859c Using -x c++ in clang opts so that headers compile
The problem is that clang loves to assume that .h files are in C. -x c++ gives
it a nudge in the right direction.
2012-08-11 19:46:22 -07:00
Strahinja Val Markovic
f88c9feb4f Refactored the clang completer; many bugs fixed
This change should fix the random hangs and segfaults when using the clang
completer. Also, assertion errors printed to the console on vim exit should go
away too, same thing with segfaults on vim exit. These "on exit" errors were
caused by not cleanly shutting down the background threads; both the identifier
completer and the clang one now join the threads on destruction. This results in
a clean shutdown.

The new clang completer architecture now uses only one clang thread (again)
instead of a completion and parsing thread. Since the parsing task needs to wait
on the completion task if it was started first (and vice-versa) there's no point
to using two threads. The desired "simplicity" of using two threads for these
two tasks actually created needless complexity (and bugs). Sigh. Such is life.

A TranslationUnit abstraction was also created and this in turn also reduces the
complexity of the clang completer.

The clang completer now also has some (very) basic tests.
2012-08-11 19:37:08 -07:00
Strahinja Val Markovic
04c01c2ad0 Removing some commented-out code 2012-08-11 19:06:46 -07:00
Strahinja Val Markovic
3e56aea6e3 Adding our custom X_ASSERT macro 2012-08-11 19:01:40 -07:00
Strahinja Val Markovic
04c04c6bce Not setting c++98compat warning for xcode 2012-08-11 19:00:39 -07:00
Strahinja Val Markovic
ee3ea72e3c Not parsing llvm cmake when using external clang
This speeds up the cmake project regeneration.
2012-08-11 18:59:54 -07:00
Strahinja Val Markovic
5a9d304c87 Option to auto-close preview window on select
The option defaults to off. Some people may find it useful.
2012-08-06 21:29:56 -07:00
Strahinja Val Markovic
658e1393b4 Moved completer.py under completers 2012-08-06 20:14:21 -07:00
Strahinja Val Markovic
f17e45bdc3 Forcing the use of move in one location 2012-08-06 20:02:46 -07:00
Strahinja Val Markovic
ddca4d0cf9 Split the CompletionData constructor into 2 funcs 2012-08-05 21:43:38 -07:00
Strahinja Val Markovic
6216eedbc9 Removing "__" from completion strings 2012-08-05 21:34:29 -07:00
Strahinja Val Markovic
0da734d393 Showing the first func def in the preview window 2012-08-05 21:13:01 -07:00
Strahinja Val Markovic
55267ceb5c Now showing optional parameters as well
Also refactored CompletionData building into a constructor for CompletionData
2012-08-05 21:01:42 -07:00
Strahinja Val Markovic
15561b9f1e Adding 'preview' to completeopt if not forbidden
The user can opt-out of this, but we set it by default since most people don't
know that the option exists. Those that are annoyed by it can just toggle an
option in their vimrc.
2012-08-05 19:55:06 -07:00
Strahinja Val Markovic
5f95a2bfde Showing preview window data for completions
Also, const functions have " const" correctly appended in the completion window.
2012-08-05 19:49:54 -07:00
Strahinja Val Markovic
bf9eba70ac Adding some python docstrings 2012-08-05 14:32:11 -07:00
Strahinja Val Markovic
b2b6b12195 Created c, objc & objcpp hooks that use cpp clang
These hooks just create a ClangCompleter which is universal for these four
languages. It can complete all of them.
2012-08-05 14:24:15 -07:00
Strahinja Val Markovic
b62ec81d68 Completer plugins now have their own folder 2012-08-05 14:14:31 -07:00
Strahinja Val Markovic
ea30cb046e ShouldUseNow for IdentifierCompleter done and used 2012-08-05 13:12:10 -07:00
Strahinja Val Markovic
df260ed2a8 Forcing c++ lang in clang options for ycm 2012-08-05 12:55:03 -07:00
Strahinja Val Markovic
feef67c50a Setting rpath only for non-system, external clang
Setting the rpath for the system libclang was for some reason breaking the
ycm_core_tests binary. Also, rpath seems to work funky on Mac OS X.
2012-08-04 19:37:00 -07:00
Strahinja Val Markovic
a2bbbe1a4d Code style fix 2012-08-04 19:33:28 -07:00
Strahinja Val Markovic
5646eeab5e More null checks for data coming from clang 2012-08-04 19:29:11 -07:00
Strahinja Val Markovic
3c65c84c7b Renaming 'indexer' to the more accurate 'ycm_core' 2012-08-04 18:59:22 -07:00
Strahinja Val Markovic
f3ddfd5458 Build option to use system libclang 2012-08-04 18:49:21 -07:00
Strahinja Val Markovic
d0f62d1205 Initial, rough version of completer separation
We are trying to build a nice plugin-oriented architechure for loading varios
completer objects.
2012-08-04 17:46:54 -07:00
Strahinja Val Markovic
1fd2515617 clang options file uses more succint dict syntax 2012-08-03 10:26:11 -07:00
Strahinja Val Markovic
f120c0ce1c Showing function args right next to name now
The completion text in the menu is different. We used to just show the func name
in the "main" part of the completion menu, now we show the full signature
without the return type (which is shown on the right)
2012-08-02 21:37:21 -07:00
Strahinja Val Markovic
2888cbf5c8 Check for python on plugin init 2012-08-02 20:38:15 -07:00
Strahinja Val Markovic
287d01c8b3 Setting updatetime to 2000 if user allows 2012-08-02 20:32:29 -07:00
Strahinja Val Markovic
45cccd09ac Refactored variable defaults setting
Now the all use the same style.
2012-08-02 20:28:25 -07:00
Strahinja Val Markovic
4765fd88fe Removing some unused code + fix for crash
The crash was caused by clang_disposeString/getCString not checking whether the
given CXString has NULL data members. Fixed with a workaround.
2012-08-01 22:09:31 -07:00
Strahinja Val Markovic
3868f94ac7 Adding a .ycm_clang_options.py file for YCM 2012-08-01 20:50:35 -07:00
Strahinja Val Markovic
3a820f1fb4 The clang options file now ends in .py 2012-08-01 20:22:03 -07:00
Strahinja Val Markovic
618a6acd59 Protecting ALL clang access with a mutex now 2012-08-01 20:09:01 -07:00
Strahinja Val Markovic
eab70838f0 New system for specifying clang flags
Now the .ycm_clang_options file is a python script that needs to implement our
API. This enables the user to do arbitrary things when computing flags.
2012-08-01 19:34:20 -07:00
Strahinja Val Markovic
11a52d018c Protecting diagnostic access with mutex 2012-08-01 17:18:35 -07:00
Strahinja Val Markovic
06d653c60d Adding the cursor identifier on InsertLeave
This should help catch cases where the user jumps to an identifier and then
edits it in place; we want to add that new ident to the db ASAP because the user
may want to have it completed soon.

Still, we're not perfect. If the user just deletes chars with 'x' or 'd' in Vim
and therefore never even enters insert mode we are obviously not going to pick
up that identifier until the next full file sweep.
2012-07-31 19:01:22 -07:00
Strahinja Val Markovic
b20a24cde9 Adding a TODO I don't want to forget about 2012-07-31 16:31:16 -07:00
Strahinja Val Markovic
2726349975 Not parsing empty files anymore
Also, not sending non-clang supported files as unsaved buffers when a completion
is requested.
2012-07-31 15:30:50 -07:00
Strahinja Val Markovic
11e42b49f0 Smarter updating of clang diagnostics display 2012-07-30 19:42:41 -07:00
Strahinja Val Markovic
71e3e86252 Adding option for custom extra rpath 2012-07-30 14:20:05 -07:00