Commit Graph

162 Commits

Author SHA1 Message Date
Strahinja Val Markovic
96d4874fe0 Ensuring b:ycm_changedtick always exists
Fixes #503 (I hope).
2013-08-13 10:03:34 -07:00
Strahinja Val Markovic
d35b39a20c Now parsing file on insert mode leave as well
We used to do it on buffer enter and cursor hold. Doing it on insert leave too
produces much quicker compilation error feedback when editing C-family code
because the user doesn't have to wait for the next cursor hold event.
2013-08-12 20:11:41 -07:00
Strahinja Val Markovic
60c9908d25 Ensure g:ycm_changedtick is always set.
Fixes #493.
2013-08-07 16:54:14 -07:00
Strahinja Val Markovic
360a70b1b3 Deleting some dead code 2013-08-05 13:36:11 -07:00
Strahinja Val Markovic
4db6fb8d7f Revert to old way of tracking insert mode change
b:changedtick is incremented by the feedkeys() call which screws us up and
there doesn't seem to be a way around it that's worth the hassle.
2013-08-03 18:42:16 -07:00
Strahinja Val Markovic
fc3a303ace Only parsing file if changes detected
Previously we would do it on every CursorHold, buffer changed or not.

Fixes #485.
2013-08-03 15:48:03 -07:00
Strahinja Val Markovic
edae6fd0a2 Using b:changedtick for change detection
For now, doing it just for detecting whether a change was made on move in insert
mode.

Using b:changedtick instead of our homebrew way of detecting the changed should
be both faster and more robust.
2013-08-03 15:05:25 -07:00
Strahinja Val Markovic
451acc0073 Adding OnVimLeave support to Completer class 2013-07-07 11:00:45 -07:00
Strahinja Val Markovic
16b6f877c6 Don't call SyntasticCheck if not syntastic checker
If the user forced YCM to not register itself as the Syntastic checker, we
should not be calling SyntasticCheck since that would slow down everything.

Fixes #416
2013-07-01 10:46:49 -07:00
Strahinja Val Markovic
e740bac1f6 Better completion in the middle of a word
For instance (`|` represents the cursor):
  1. Buffer state: `foo.|bar`
  2. A completion candidate of `zoobar` is shown and the user selects it.
  3. Buffer state: `foo.zoobar|bar` instead of `foo.zoo|bar` which is what the
  user wanted.

This commit resolves that issue.

It could be argued that the user actually wants the final buffer state to be
`foo.zoobar|` (the cursor at the end), but that would be much more difficult
to implement and is probably not worth doing.

Fixes #374.
2013-06-09 19:00:49 -07:00
Strahinja Val Markovic
381b86d595 Fixing python tests broken in rename 2013-05-19 20:06:14 -07:00
Strahinja Val Markovic
faa225fdc4 Moving everything under pytho/ycm 2013-05-19 19:44:42 -07:00
Strahinja Val Markovic
4b039e2102 Using BufUnload instead of BufDelete
Seems to be more robust. This should help with memory consumption when using the
clang_completer. See issue #184.
2013-05-11 13:49:48 -07:00
Strahinja Val Markovic
2b23245422 Minor refactoring & style cleanup 2013-05-09 20:28:04 -07:00
Stanislav Golovanov
0edec9c95a Add subcommand completion for YcmCompleter command 2013-05-09 21:55:55 +04:00
Stanislav Golovanov
c2024edbaa Add GoTo features for python
This adds a Go To Definition and Go To Declaration features for
python.
2013-05-04 03:11:10 +04:00
Strahinja Val Markovic
f4615c00c0 Separate options for completion in string/comment
We want to turn on completion in strings by default, but not for completion in
comments.
2013-04-24 23:15:13 -07:00
Strahinja Val Markovic
7500a94cda Use OnBufferVisit in ultisnips completer
This is instead of OnFileReadyToParse which is called every time the users stops
typing.
2013-04-24 13:31:28 -07:00
Strahinja Val Markovic
3258f324dd Merge branch 'JazzCore-general_completers'
Conflicts:
	python/ycm.py
2013-04-22 22:37:32 -07:00
Strahinja Val Markovic
14b2220f01 Supporting YcmCorePreload logic
Now the user has the option of writing custom logic before ycm_core.so is
loaded. This can be used to dynamically change the location of where ycm_core.so
is loaded by prepending paths to sys.path.

Very, very few people will need this feature, but I'm one of them so there.
2013-04-22 10:31:16 -07:00
Stanislav Golovanov
48cda3bb8f Add general completers support 2013-04-21 01:28:37 +04:00
Strahinja Val Markovic
6d0c736d04 Making sure that <C-Space> works in console Vim
Fixes #256.
2013-04-19 18:33:48 -07:00
Strahinja Val Markovic
89d93bc85c Fix traceback on <C-Space> semantic invoke
This was caused by yesterday's refactoring. I forgot to update one call site.

Fixes #242
2013-04-10 18:47:07 -07:00
Strahinja Val Markovic
77fbd80c89 Refactoring out some vim.eval calls
s:completion_start_column should not be evaled in Python code. That was a
stopgap measure that ended up lasting far longer than intended.
2013-04-09 19:32:48 -07:00
Strahinja Val Markovic
e4fc9a1136 Forcing the critical 'B' flag in cpoptions
Fixes #223.
2013-04-04 17:49:10 -07:00
Strahinja Val Markovic
bc4e7fb850 Option to disable YCM-Syntastic integration
Fixes #210.
2013-03-25 19:48:07 -07:00
Strahinja Val Markovic
cea707fc13 Fixing errors throw in "[Command Line]" window
Fixes #202.
2013-03-23 14:11:48 -07:00
Strahinja Val Markovic
f0ead1823a Clarifying an error message 2013-03-17 18:54:57 -07:00
Strahinja Val Markovic
0535d0ec9a :YcmDiags exits when compilation fails
Previously we'd tell the user "No warnings or errors detected", which is wrong.
2013-03-17 18:52:42 -07:00
Strahinja Val Markovic
56b2f70a1a using "silent!" on maps we create with <unique> 2013-03-17 13:09:55 -07:00
Strahinja Val Markovic
c391bdcc62 Reducing RAM consumption by deleting unused caches
When the user deletes a buffer, we can delete the clang caches for that file.
Fixes #184.
2013-03-16 10:41:47 -07:00
Florian Walch
a2595d6f7e Option to close preview after leaving insert mode
Added the `g:ycm_autoclose_preview_window_after_insertion` option
(similar to `g:ycm_autoclose_preview_window_after_completion`).
If set, the preview window is automatically closed when the user leaves
insert mode.
2013-03-15 20:40:48 +01:00
Strahinja Val Markovic
005175d3f3 Filetype whitelist option added.
Also renaming the filetype blacklist option for the sake of symmetry.
Fixes #178.
2013-03-09 20:32:31 -08:00
Strahinja Val Markovic
c394cb557e 'empty' over 'strlen' for empty string check (duh) 2013-03-09 19:31:00 -08:00
Strahinja Val Markovic
82bd32aa16 Fixing YCM breakage
VimScript is not Python so "!some_string" does not return false when some_string
is not empty (it _does_ return true when some_string _is_ empty). I of course
know this, but my fingers like to forget it from time to time.
2013-03-09 09:47:35 -08:00
Strahinja Val Markovic
81444e207c Don't run when there's no filetype set.
Implements the smaller part of issue #178.
2013-03-08 22:55:14 -08:00
Strahinja Val Markovic
d2db03b021 Better error message when unable to get diags
Fixes #72.
2013-03-01 18:37:10 -08:00
Johann Klähn
3d305f9c74 Implement completer-specific commands
This provides a framework for completer-writers to create
completer-specific commands. I have in mind to use this for the clang
completer to force reloading of a flags module via `:YcmCompleter reload`.
2013-02-28 11:32:07 +01:00
Strahinja Val Markovic
0abb3ca61c Clarifying the "ycm_core too old" error message 2013-02-20 10:14:29 -08:00
Strahinja Val Markovic
3f1b5c9283 Option to complete inside comments and strings.
Fixes issue #105.
2013-02-16 12:56:21 -08:00
Ton van den Heuvel
c3a6ac270b Fix auto completion being active within Doxygen comment blocks. 2013-02-15 11:18:55 +01:00
Strahinja Val Markovic
ad8345aa35 Now checking ycm_core version for compatibility 2013-02-12 20:54:27 -08:00
Strahinja Val Markovic
bdacf4dc36 Actually stopping compilation when no support
Previously we would just emit an error message _and continue_. The "and
continue" part was an embarrassing oversight.
2013-02-12 20:30:14 -08:00
Strahinja Val Markovic
5d89aef907 Removing YCM as omnifunc if no native support 2013-02-11 21:45:42 -08:00
Strahinja Val Markovic
786e6182ff Initial version of omnifunc-based omni_completer
Still a work in progress (needs better triggering and bug fixes)
2013-02-10 20:03:56 -08:00
Strahinja Val Markovic
6e27176ebd Shortening some function names
They could be shorter and still readable
2013-02-10 20:03:56 -08:00
Strahinja Val Markovic
4b5cbdbc9d Multiple mappings possible for selection cycling
This change also makes the arrow keys behave like Tab and Shift-Tab.

Fixes issue #83.
2013-02-08 18:30:28 -08:00
Strahinja Val Markovic
c6beecbf01 Minor stlye fix 2013-02-06 19:16:33 -08:00
Strahinja Val Markovic
0a4d82b171 Don't leave whitespace on empty lines
This was caused by complicated interactions with Vim.

Fixes #15.
2013-02-06 19:04:31 -08:00
Strahinja Val Markovic
7cf179e2b8 Some default mappings can be set to empty strings
This allows the user to not have a mapping. Also, showing a detailed diagnostic
is now possible through a new command.

Fixes #64.
2013-02-06 18:34:08 -08:00
Strahinja Val Markovic
6f10d7aad7 YcmDiags now doesn't hang when no flags available
Fixes #46
2013-02-05 21:22:50 -08:00
Strahinja Val Markovic
4b88970e91 Avoiding issues with wrong module loaded
This could happen if your python path is not the first item on sys.path
2013-02-04 18:16:36 -08:00
Strahinja Val Markovic
7c573528ed New YcmDiags command that shows diagnostics
Docs updated to mention it. Syntastic is still a better option than calling this
command.
2013-01-31 19:21:11 -08:00
Strahinja Val Markovic
f3cfc05608 New Syntastic API forces us to select YCM
Previously, Syntastic would pick YCM as the default checker if YCM was
installed. The new Syntastic API does not do this. I don't know is this a bug or
not (talking to upstream), but until it's resolved, YCM has to force the use of
itself.
2013-01-31 18:44:42 -08:00
Strahinja Val Markovic
8f6ebce42c Documenting the show-full-diag-message command 2013-01-31 12:32:07 -08:00
Strahinja Val Markovic
8452914046 Adding a command to force recompilation and diags 2013-01-30 14:46:58 -08:00
Strahinja Val Markovic
9b3e009ed1 Mappings can now be easily remapped 2013-01-26 18:45:27 -08:00
Strahinja Val Markovic
60860d82f3 Adding shift-tab for prev completion too 2013-01-26 17:58:34 -08:00
Strahinja Val Markovic
e8b60fd537 Adding the YcmDebugInfo command 2013-01-26 11:45:14 -08:00
Strahinja Val Markovic
d02ecc2b1c Making sure 'sys' is imported before being used 2013-01-21 17:20:54 -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
d0223a8f0b Easier to move in insert mode now
The completion menu would interfere with moving in insert mode with the arrow
keys. This is now solved.
2012-08-20 20:55:25 -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
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
4a4eea0d8a Final workaround for bug with vim-notes use
The vim-notes plugin adds 'longest' to completeopt in its filetype plugin. This
breaks ycm. The result is that the user can't type at all after a notes file has
been visited.

We work around this by setting our completeopt settings on every buffer visit
and CursorHold event.
2012-08-13 20:47:45 -07:00
Strahinja Val Markovic
bcf9ddff32 Now properly ignoring unwanted filetypes
The previous implementation of ignoring filetypes the user doesn't want
completions for was deeply flawed. This one actually works...
2012-08-13 19:01:55 -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
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
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
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
ea30cb046e ShouldUseNow for IdentifierCompleter done and used 2012-08-05 13:12:10 -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
287d01c8b3 Setting updatetime to 2000 if user allows 2012-08-02 20:32:29 -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
11e42b49f0 Smarter updating of clang diagnostics display 2012-07-30 19:42:41 -07:00
Strahinja Val Markovic
15d82eac91 Making sure the syntastic variable exists 2012-07-30 14:19:42 -07:00
Strahinja Val Markovic
a6d5979b08 Don't run the plugin when in diff mode 2012-07-29 22:13:42 -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
0ea218022a Leaving omnifunc mode on InsertLeave 2012-07-28 11:42:43 -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
70900c5ac6 Simplified some vim logic 2012-07-28 11:19:25 -07:00
Strahinja Val Markovic
3cc4cf8e10 Async clang parsing of the current file 2012-07-26 21:44:17 -07:00
Strahinja Val Markovic
68156e8b47 Merge branch 'master' into dev
Conflicts:
	autoload/youcompleteme.vim
2012-07-26 12:59:06 -07:00
Strahinja Val Markovic
6d76563e86 C-TAB selects previous candidate 2012-07-24 18:45:28 -07:00
Strahinja Val Markovic
48d95bcd20 Doing buffervisit for clang only when clang on 2012-07-23 18:47:01 -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
6f0dc0b21d Explicitly calling OnBufferVisit for first file 2012-07-21 15:33:59 -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
be41be5323 Can now ignore filetypes plugin-wide 2012-07-16 14:44:50 -07:00
Strahinja Val Markovic
ae474483e7 Whitespace fix 2012-07-16 14:35:24 -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
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