Commit Graph

571 Commits

Author SHA1 Message Date
Strahinja Val Markovic
6ba2dd8caa Printing an error when no ycm_clang_options.py file 2013-01-22 17:13:14 -08:00
Strahinja Val Markovic
482de517ba Better support for CompilationDatabase
We now use the compilation working directory for a file that is specified in the
CompilationDatabase. We don't actually change the working directory of the
process, even temporarily (that would be annoying to users); we munge the flags
coming from the database so that all the relative paths in them are resolved to
absolute ones.
2013-01-22 16:30:49 -08:00
Strahinja Val Markovic
00db8fd8b1 compilation_database.json now fully supported 2013-01-19 18:53:30 -08:00
Strahinja Val Markovic
f9a516704b Now explicitly adding the clang includes to flags 2013-01-17 17:08:28 -08:00
Strahinja Val Markovic
0922864eda Moving clang includes to clang_includes folder 2013-01-17 17:08:11 -08:00
Strahinja Val Markovic
5ac3d40691 No error when no clang support and cpp file opened
Previously, when the user opened a cpp/c/objc/objcpp file and clang support was
not compiled in, there would be an error message printed in vim.
2013-01-13 20:56:10 -08:00
Strahinja Val Markovic
fa21622655 Updating local clang includes to 3.2
We have to have these beneath the folder where ycm_core.so is placed so that we
get fast completions. If these files are not here, then clang fails to
precompile a file preamble and completions are slow.
2013-01-13 12:49:49 -08:00
Strahinja Val Markovic
c9adb9e86e Comment update in vimsupport.py 2012-09-24 19:20:33 -07:00
Strahinja Val Markovic
04991d874d Moving a comment closer to the related code 2012-09-05 21:49:51 -07:00
Strahinja Val Markovic
0c17c49a66 Per-filetype turning off of filetype completion
So things like the ClangCompleter can be turned off fully and the user can rely
on identifier completion only.
2012-08-15 21:29:43 -07:00
Strahinja Val Markovic
dc2f52edbf Adding a max_diagnostics_to_display user option 2012-08-15 20:58:21 -07:00
Strahinja Val Markovic
daef17feb4 Support for showing extra info for diagstics
This was intended to show the full clang output for a given diagnostic,
including notes. But it appears that libclang does not provide this
functionality...
2012-08-15 19:39:03 -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
d793919969 Removing old debugging statement 2012-08-11 21:19:06 -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
658e1393b4 Moved completer.py under completers 2012-08-06 20:14:21 -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
3c65c84c7b Renaming 'indexer' to the more accurate 'ycm_core' 2012-08-04 18:59:22 -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
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
3a820f1fb4 The clang options file now ends in .py 2012-08-01 20:22:03 -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
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
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
333b71f8d5 Triggering syntastic error display more often 2012-07-29 22:13:42 -07:00
Strahinja Val Markovic
958a008462 Adding diagnostic extraction support
Next step is to add support to Syntastic so that it uses this new functionality
2012-07-28 15:27:30 -07:00
Strahinja Val Markovic
bfafad4f50 Using python's abc module for the Completer class 2012-07-28 12:24:25 -07:00
Strahinja Val Markovic
76715bd94c Posting vim message when no clang candidates 2012-07-28 12:06:59 -07:00
Strahinja Val Markovic
ae618c5566 Clang parse now again called on cursor hold 2012-07-28 12:06:38 -07:00
Strahinja Val Markovic
019b84e18b Omnifunc for clang types + mapping to invoke it
This omnifunc basically calls our ClangComplete engine.
2012-07-28 11:19:26 -07:00
Strahinja Val Markovic
3cc4cf8e10 Async clang parsing of the current file 2012-07-26 21:44:17 -07:00
Strahinja Val Markovic
13f87c5a62 Buffer identifiers are now extracted async 2012-07-24 20:09:09 -07:00
Strahinja Val Markovic
b120d6a5ba Now extracting identifiers in C++ code 2012-07-23 20:17:59 -07:00
Strahinja Val Markovic
74c363ef60 These headers magically speed up completions.
Clang searches for these files and if it doesn't find them, completion is twice
as slow (or slower) than otherwise.

See this issue report for more details:
https://github.com/Rip-Rip/clang_complete/issues/17
2012-07-23 18:45:00 -07:00
Strahinja Val Markovic
ad32584a10 Now reparsing clang files on buffer enter
This creates an auto PCH that speeds up code completion.
2012-07-23 18:45:00 -07:00
Strahinja Val Markovic
cfede619f2 Added flag to turn off clang completion if desired 2012-07-23 11:15:25 -07:00
Strahinja Val Markovic
cdb8dfc86b Loading .ycm_clang_options files now
These files can contain flags that are passed to clang.
2012-07-22 15:19:28 -07:00
Strahinja Val Markovic
6f0dc0b21d Explicitly calling OnBufferVisit for first file 2012-07-21 15:33:59 -07:00
Strahinja Val Markovic
b53ea06d5f Using 'dup':1 to save expensive dup eliminition
Since we are never going to return duplicate candidates to Vim we might as well
save some performance by forcing Vim to not search for duplicates
2012-07-21 12:17:29 -07:00
Strahinja Val Markovic
7bf18c7c5c Improving IdentifierCompleter performance
We limit the number of candidates returned to Vim to 20 and also make sure that
we are not returning any duplicate candidates. This provides a noticeable
improvement in latency.
2012-07-21 12:06:18 -07:00
Strahinja Val Markovic
ad859ee002 Using the pyeval func introduced in vim 7.3.584
This makes the whole plugin much faster since we now don't need to serialize and
deserialize the return values from python funcs before we can use them in Vim.
Oh God I've been waiting for something like this for so long... using this also
forces us to demand vim 7.3.584 or higher.
2012-07-21 10:10:19 -07:00
Strahinja Val Markovic
44b671c2c0 ClangCompleter now returs extra data
This data is used to show more information about the completions in the
completion menu.
2012-07-19 21:17:39 -07:00
Strahinja Val Markovic
c9e1706fa1 ClangCompleter now async and caches Clang data
First off, we don't block the GUI thread anymore for ClangCompleter (that was
always temporary). Secondly, now ClangCompleter will cache the data coming from
clang so that query-based filtering of members is fast.
2012-07-15 20:49:56 -07:00
Strahinja Val Markovic
52d8a1236b If query empty, Results sorted lexicographically
This change was also the root cause of the crash bug I spent two days tracking
down. The problem was that the new bool member was not added to the custom copy
ctor... since we don't really need a custom copy ctor for Result, we're going
with the compiler-provided one.
2012-07-15 19:40:24 -07:00
Strahinja Val Markovic
ca861d9f0c Creating a new Completer Python base class
Common logic for the IdentifierCompleter and ClangCompleter (from the python
plugin) is now in the base class.
2012-07-15 18:11:26 -07:00
Strahinja Val Markovic
27e1400558 ClangComplete now sorts completions based on query 2012-07-11 22:41:32 -07:00
Strahinja Val Markovic
e78e0400d9 Renamed CompletionSystem to IdentifierCompleter 2012-07-10 23:30:44 -07:00
Strahinja Val Markovic
39ecf76798 Renamed ClangComplete to ClangCompleter 2012-07-10 23:28:58 -07:00
Strahinja Val Markovic
545792c055 Renaming Completer to IdentifierCompleter 2012-07-10 23:13:12 -07:00
Strahinja Val Markovic
39ceebbb1e Where possible, using native objects, not vim.eval 2012-07-10 20:50:03 -07:00
Strahinja Val Markovic
ab0b349207 Sending the contents of all the modified buffers
Initially, we were sending only the contents of the current buffer.
2012-07-10 20:27:46 -07:00
Strahinja Val Markovic
5de395d9bb Storing the completion start column in Vim script
This way we don't have to recalculate it every time we call CandidatesForQuery
2012-07-10 15:39:59 -07:00
Strahinja Val Markovic
94288108d8 Initial, rough kinda working version ClangComplete
Many things need to be ironed out still.
2012-07-10 15:26:07 -07:00
Strahinja Val Markovic
30c9637992 Using the vector indexing suite from Boost.Python
This removes the need for a special overload for AddCandidatesToDatabase. Also,
the GetFuture function now provides a more sensible API with the list being
returned instead of accepted as an out parameter.
2012-07-08 15:34:44 -07:00
Strahinja Val Markovic
174687c4bc Renaming ConcurrentStack to ConcurrentLatestValue 2012-07-06 12:14:25 -07:00
Strahinja Val Markovic
02a1f8780c Small refactoring of the ShouldAddIdentifier func 2012-05-12 20:42:45 -07:00
Strahinja Val Markovic
5d6e839118 Newly inserted identifiers are added immediately 2012-05-12 15:20:03 -07:00
Strahinja Val Markovic
6430677f4f Whitespace changes 2012-05-07 21:23:38 -07:00
Strahinja Val Markovic
7cf580a447 Completion suggestions are now fetched async 2012-05-05 23:48:22 -07:00
Strahinja Val Markovic
7468a5a21c Don't add candidates for "weird" buffers 2012-05-05 18:12:15 -07:00
Strahinja Val Markovic
903452e855 Candidates are now stored per type and filepath 2012-04-29 19:51:20 -07:00
Strahinja Val Markovic
ced1d0ad5a Adding new candidates is now faster; + more
Also fixed a memory leak and started work on adding filepath-aware candidate
repos.
2012-04-29 16:36:31 -07:00
Strahinja Markovic
1a08eb9ce0 Updating copyright line 2012-04-15 20:28:46 -07:00
Strahinja Markovic
156a1882e1 Initial import 2012-04-15 16:57:10 -07:00