Commit Graph

302 Commits

Author SHA1 Message Date
Strahinja Val Markovic
65e6b55268 Now showing red squiggle under diagnostic location 2014-01-06 15:24:05 -08:00
Strahinja Val Markovic
c9e9a640ac Echoing diag text on when cursor on diag line 2014-01-06 15:24:05 -08:00
Strahinja Val Markovic
6c01881e1a Replaced Syntastic support with YCM-native code
Currently, the only supported Syntastic features are the error signs in the
gutter. Other features will be added in the future.
2014-01-06 15:24:05 -08:00
Strahinja Val Markovic
e8d1a4cef8 Working around a Vim bug that causes flickering.
If the user had a hidden buffer and a recent version of Vim, the screen would
flicker every time the user typed. This was caused by a Vim bug.

On every key press, we end up calling GetUnsavedAndCurrentBufferData(), which
calls GetBufferOption( buffer_object, 'ft' ). If the buffer_object represents a
hidden buffer, Vim would flicker.

This would happen because we'd call "buffer_object.options[ 'ft' ]" in recent
versions of Vim, and that line of code causes Vim to flicker. I don't know why.
We're extracting the 'ft' value without going through buffer_object.options, and
that works just fine.

Fixes #669.
2014-01-06 15:00:51 -08:00
Strahinja Val Markovic
96b28b93a1 Optimizing overlap correction for common case
Most of the time there's nothing after the cursor.
2014-01-05 12:16:53 -08:00
Strahinja Val Markovic
a18807d31e Candidate overlap with buffer text improved
Now, "foobar.h" will be changed to insert "foo" if the text after the cursor is
"bar.h". This already worked for "foobar" and "bar", but the overlap search
would stop before a non-word character. This has now been resolved.
2014-01-05 12:07:15 -08:00
Strahinja Val Markovic
91368c09ea Handling vim.error from omnifunc
If the omnifunc encounters a syntax error, we need to handle this without
showing a traceback to the user.
2014-01-04 16:17:44 -08:00
Strahinja Val Markovic
e424d75c42 Preventing traceback for detailed diagnostic
Previously we'd show a Python traceback if the user asked for a detailed
diagnostic in a file that wasn't supported by Clang (something written in Python
perhaps). Now we show an nice, far less scary message informing the user of
this.

Fixes #748.
2014-01-02 14:24:17 -08:00
Strahinja Val Markovic
b3f70a6c95 Forwarding args for SafePopen to Popen directly 2013-12-24 18:53:23 -08:00
Strahinja Val Markovic
7fac081bea Merge branch 'fix-omnisharp-launch' of https://github.com/nop00/YouCompleteMe into nop00-fix-omnisharp-launch 2013-12-24 18:47:45 -08:00
davits
619e1c0b83 File&Dir issue fix 2013-12-24 12:25:07 +04:00
Strahinja Val Markovic
b1d71bbb91 Better handling of unknown extra conf files
Previously, we'd implicitly turn off future notices about unknown extra conf
files if we already raised one exception about it. This breaks when the user
ends up not receiving the "unknown extra conf, load?" message.

Now we only turn off the notice as a result of the user saying "don't load this"
so that if the first request fails to reach them, they'll get a second (and
third etc) request about it.

Fixes #615
2013-12-21 11:19:39 -08:00
Strahinja Val Markovic
1edf22357f Try to cleanup files only if they stil exist
Fixes #738
2013-12-20 13:01:48 -08:00
nop
bc9a283be6 New wrapper function around subprocess.Popen
New wrapper function around subprocess.Popen that handles stdin
correctly when on Windows (see issue #637)
2013-12-11 13:41:04 +01:00
nop
c8b0f466c0 Small stylistic change 2013-12-11 10:27:29 +01:00
nop
96762e2a7e Removed an unused import 2013-12-10 14:59:44 +01:00
nop
fd6338fa88 Fixed OmniSharp launch under Windows (again)
We pass shell=True to Popen so that OmniSharp is not started inside a
new visible window under Windows. And since we use shell=True, we pass
the command to execute as a string, as recommended by Python's docs
(also, it won't work when passed as a sequence anyway :) ).
2013-12-10 12:46:05 +01:00
nop
ee90d9b09b Fix faulty logic in previous commit
Previous commit is 9b8781322e
2013-12-10 12:35:33 +01:00
Daniel Hahler
3e5e34b633 Only notify about a server crash once
Fixes #715
2013-12-09 22:27:11 +01:00
nop
9b8781322e Small refactoring
Use the dedicated function to check if we're running on Windows instead
of checking the platform directly.
2013-12-05 10:25:55 +01:00
nop00
d4829f1ef9 Fix OmniSharp launch under Windows 2013-12-04 22:01:35 +01:00
Val Markovic
7f5dd0fcf0 Merge pull request #680 from nop00/master
Omnisharp: smarter solution file finder
2013-12-04 10:32:13 -08:00
Strahinja Val Markovic
e0c7db4ac5 Fix issue with omnifunc mode persisting
This can happen when the user inserts a candidate string like "operator[]" which
doesn't end with an identifier char. A very obscure bug, but a bug nonetheless.
2013-12-03 14:39:31 -08:00
nop
93fa3ad7e7 Small stylistic changes 2013-12-03 17:34:10 +01:00
Jamie Liu
f58b06adde Add -include to INCLUDE_FLAGS
The -include flag forces the inclusion of a single file, and is used by
(at least) the Linux kernel's build system.
2013-12-03 00:43:42 -08:00
Strahinja Val Markovic
aeb2c5c227 Adding the g:ycm_auto_trigger option
Toggling this option off turns off the identifier completer and the semantic
triggers.

Fixes #597
2013-12-02 16:37:59 -08:00
Val Markovic
447ce97147 Merge pull request #699 from nop00/fix-omnisharp-shutdown
Check auto_stop_csharp_server when shutting down
2013-11-29 17:54:40 -08:00
nop00
3da6f5c197 Unit tests for Omnisharp's smarter solution finder 2013-11-29 22:13:04 +01:00
Strahinja Val Markovic
b085ca7c0b Filtering out "too mary errors emitted" diags
Because they're completely useless and incredibly annoying.
2013-11-25 13:33:49 -08:00
Dan Schmidt
457d2a5eac Add -isysroot to list of INCLUDE_FLAGS. 2013-11-23 09:13:41 -05:00
nop
389e3bfe4c Check auto_stop_csharp_server when shutting down
Check auto_stop_csharp_server instead of auto_start_csharp_server when
shutting down
2013-11-21 17:10:37 +01:00
nop
aa7801b850 Omnisharp: smarter solution file finder
When loading the Omnisharp server, YCM tries to find a suitable solution
file to feed it. Instead of giving up when finding multiple solution
files, it now tries to find one named like the edited files' folder at
the solution level, e.g. if we have bla/Project.sln and we are editing
bla/Project/Folder/Whatever/File.cs, we use bla/Project.sln.
2013-11-21 15:31:38 +01:00
Strahinja Val Markovic
cf6211055e Removing the server_idle_suicide_seconds option
This option existed so that the user can tweak it if they found the default idle
timeout too short, for instance if they leave their machine on over the weekend.

This use case is now covered by the new YcmdKeepalive system that pings ycmd
every 10 minutes as long as Vim is running. This prevents ycmd shutting down if
one leaves their Vim instance alone for a long time.

Thus the old option is useless now; ycmd now shuts down after 3 hours of
inactivity, which should only ever happen when its corresponding Vim instance
has shut down abnormally.
2013-11-20 12:33:57 -08:00
Strahinja Val Markovic
5ae3a573b9 Workaround for annoying clang bug with pragma once
Fixes #216
2013-11-17 17:59:39 -08:00
Strahinja Val Markovic
757602becf Workaround for header flags with compilation db 2013-11-17 14:17:20 -08:00
Strahinja Val Markovic
76f9c42d6e Minor whitespace fix 2013-11-17 13:46:14 -08:00
Strahinja Val Markovic
1f23171c08 Test for exception on no flags from extra conf 2013-11-17 13:45:39 -08:00
Strahinja Val Markovic
19a5bf0500 Notifying user if no flags come from extra conf 2013-11-17 13:32:43 -08:00
Strahinja Val Markovic
2caf90637d Better handling of bad flags from extra conf 2013-11-17 13:10:16 -08:00
Strahinja Val Markovic
64078f20a0 Added the g:ycm_use_ultisnips_completer option
This can be used to turn off UltiSnips completion candidates.

Fixes #596.
2013-11-15 16:22:20 -08:00
Strahinja Val Markovic
d41a011198 Deleting some dead code 2013-11-15 15:48:55 -08:00
Strahinja Val Markovic
450403044b Adding new g:ycm_path_to_python_interpreter option
Fixes #663
2013-11-14 10:50:53 -08:00
Strahinja Val Markovic
0226ba4c90 ycmd using Vim stdin on Windows
This resolves YCM crash problems. Fixes #637.
2013-11-07 14:53:15 -08:00
Strahinja Val Markovic
4aa207c2ad Checking for 'pythonw' only on Windows
On Mac OS X, checking for pythonw can return a path to an ancient 2.4 version of
Python in some cases. We don't want that.
2013-11-05 15:30:34 -08:00
Strahinja Val Markovic
207a0779c3 Ensuring filename is a plain Python string
We don't want to send a unicode string to the user's ycm_extra_conf.py file.
This should fix problems with sending the filename to YCM's CompilationDatabase
API.
2013-11-05 10:28:40 -08:00
Strahinja Val Markovic
aa0ccdb925 Better client notice when ycmd crashes
Now we only show the last 30 lines of stderr instead of everything in it which
was not very useful. We also tell the user about :YcmRestartServer.
2013-11-04 11:15:03 -08:00
Strahinja Val Markovic
9ea0c39279 Forcing requests to ycmd to ignore local proxies
Fixes #641
2013-11-04 10:34:42 -08:00
Strahinja Val Markovic
ca90d10ff7 Minor logic refactor for path to Python func 2013-11-01 10:53:16 -07:00
Strahinja Val Markovic
7bfb4c3402 Use a thread pool that doesn't join workers
By default, a ThreadPoolExecutor will wait at Python interpreter shutdown for
all the threads to stop by themselves before letting the interpreter shut down.

We don't want that for the network requests thread pool, it causes a shutdown
latency if there are outstanding requests. Killing the threads in our pool is
perfectly safe so we can avoid the latency by introducing an
UnsafeThreadPoolExecutor.
2013-10-30 18:08:35 -07:00
Sascha G.
2ea2444e66 Upping ycmd max request size to 1000kb 2013-10-30 22:50:58 +01:00
Tom Vincent
15b7e7683a Blacklist vimwiki filetype
[vimwiki][] has a markdown-like syntax, which doesn't bode well with YCM
(flickering "pattern not found" messages, performance hits with long prose).

[vimwiki]: https://github.com/vimwiki/vimwiki
2013-10-30 01:35:17 +00:00
Strahinja Val Markovic
9734c473e2 Upping ycmd max request size to 500kb
Fixes #624
2013-10-29 12:16:46 -07:00
Strahinja Val Markovic
f91790e2ee Only importing ycm_core in ycmd
I'm not sure, but it seems that loading both ycm_client_support and ycm_core
into the same process is causing random ycmd crashes.
2013-10-28 12:17:18 -07:00
Strahinja Val Markovic
6e782508b3 Now possible to sent Vim data to FlagsForFile func
Fixes #612.
2013-10-26 16:22:43 -07:00
Strahinja Val Markovic
dda1a83c09 Turning off the omnisharp server after test 2013-10-26 12:30:49 -07:00
Strahinja Val Markovic
63534e1a6f Fixing some cs completer subcommands failing
The subcommand would execute correctly, but since there would be no return
statement, it would hit the bottom of the function and raise an error.
2013-10-26 12:28:10 -07:00
Strahinja Val Markovic
3795f4f11c Split server tests into multiple files 2013-10-26 12:15:56 -07:00
Strahinja Val Markovic
17d149e899 ycmd loads default options when none provided 2013-10-25 13:26:33 -07:00
Strahinja Val Markovic
2b8ee37bf5 ycmd uses a random free port when running vim-free
Previously the default was 6666, which was temporary.
2013-10-25 13:11:13 -07:00
Strahinja Val Markovic
77b8adf0a9 Minor refactoring for readability 2013-10-24 20:24:08 -07:00
Strahinja Val Markovic
2a42e2ccdf Better way of locating the Python 2.6/2.7 bin
It appears we can't trust sys.executable on some Unix machines as well.

Fixes #607.
2013-10-24 20:21:03 -07:00
Strahinja Val Markovic
a0f85f0b6c The ycm_temp dir is now accessible by all
Fixes #606
2013-10-24 10:26:55 -07:00
Strahinja Val Markovic
4af2ba0faa Option "shutdown_secs" is now "suicide_secs"
Calling the option server_idle_suicide_seconds should be easier to understand.
2013-10-23 12:33:27 -07:00
Strahinja Val Markovic
b2aa5e3d3f Moving client-only settings out of settings JSON
Since these options are only used on the client, they shouldn't be in
default_settings.json.
2013-10-23 12:30:13 -07:00
Strahinja Val Markovic
262d8aad03 New ycmd watchdog kills server when idle too long
Defaults are kill server after 12 hours of inactivity; the reason why it's 12
hours and not less is because we don't want to kill the server when the user
just left his machine (and Vim) on during the night.
2013-10-23 12:21:33 -07:00
Strahinja Val Markovic
78107361b3 Killing some dead code 2013-10-22 13:48:15 -07:00
Strahinja Val Markovic
5b76bcf8b7 GetDetailedDiagnostic actually takes 2 params
The Completer class version of the func only took 1 by mistake.
2013-10-22 13:46:24 -07:00
Strahinja Val Markovic
ce96a47098 Printing server PID in YcmDebugInfo 2013-10-22 10:53:31 -07:00
Strahinja Val Markovic
6d9969fa9c Surfacing ycmd server PID to user scripts
To get the PID, call function youcompleteme#ServerPid().
2013-10-22 10:51:37 -07:00
Strahinja Val Markovic
9d8fdac518 Minor cleanup of Completer comments 2013-10-18 12:35:40 -07:00
Strahinja Val Markovic
f6ca040cf7 Nth attempt at correct shutdown procedure.
If we install an explicit signal handler for SIGTERM and SIGINT and then call
sys.exit ourselves, atexit handlers are run. If we don't call sys.exit from the
handler, ycmd never shuts down. So fixed... I think. We'll see.

Fixes #577... again.
2013-10-17 22:15:17 -07:00
Strahinja Val Markovic
a5fb6b7509 Removing unsupported signal() calls on Windows
SIGQUIT and SIGHUP are not supported.

For details, see Python docs: http://docs.python.org/2/library/signal.html#signal.signal
2013-10-17 20:16:44 -07:00
Strahinja Val Markovic
6e9a16e90e Signal handler must take 2 params
Otherwise we get a TypeError
2013-10-17 20:14:56 -07:00
Strahinja Val Markovic
acae8e4e9d Tweaked the request retries logic.
We now send more retry requests that are less spaced apart.
2013-10-17 14:45:53 -07:00
Strahinja Val Markovic
40464f6e0d Resolving issues with event requests timing out
It appears that the issue comes from sending a None timeout to Requests. It
seems it's a bug in Requests/urllib3. So we just pick an arbitrary long timeout
of 30s as the default.
2013-10-17 14:21:37 -07:00
Strahinja Val Markovic
5070835d01 Ensuring server cleanup on OS signals
atexit won't run registered functions for SIGTERM which we send to the server.
This prevents clean shutdown.

Also making sure that the server logfiles are deleted as well.
2013-10-17 12:21:59 -07:00
Strahinja Val Markovic
b4d5b4ffbb More logging for extra conf store 2013-10-17 12:21:33 -07:00
Strahinja Val Markovic
5b37a2e36d Don't print traceback when no detailed diagnostic
We should only print the message.
2013-10-16 14:37:42 -07:00
Strahinja Val Markovic
18002e17df Better handling of crashed ycmd; restart command
Previously the YCM Vim client would go bonkers when ycmd crashed. Now the user
can continue using Vim just without YCM functionality.

Also added a :YcmRestartServer command to let the user restart ycmd if it
crashed. With a little luck, this will be rarely necessary.
2013-10-15 15:27:54 -07:00
Strahinja Val Markovic
436017bd4d Now using new ycm_client_support shared lib
This means we can now load just ycm_client_support (which is a much smaller
library) into Vim and ycm_core into ycmd. Since ycm_client_support never depends
on libclang.so, we never have to load that into Vim which makes things much,
much easier.
2013-10-15 14:15:04 -07:00
Strahinja Val Markovic
016434e846 Deleting some dead code 2013-10-14 20:46:42 -07:00
Strahinja Val Markovic
98f549aeae More robust way of picking an unused local port
Fixes #584.
2013-10-14 20:38:45 -07:00
Strahinja Val Markovic
b903867cdd ycm_core now imported after extra conf preload 2013-10-14 15:29:00 -07:00
Strahinja Val Markovic
bc607724f0 Ensuring ident completion works always
A bug turned it off when omni completion was available.

Fixes #583.
2013-10-14 13:29:28 -07:00
Strahinja Val Markovic
a534a58477 Checking if ultisnips data present before using it
Mentioned in issue #583, but it's not the root cause.
2013-10-14 12:32:18 -07:00
Strahinja Val Markovic
c3fcaf2b29 Strict 0.5s time budget for completion requests
Vim still loves to block the main GUI thread on occasion when asking for
completions... to counteract this stupidity, we enforce a hard budget of 0.5s
for all completion requests. If the server doesn't respond by then (it should,
unless something really bad happened), we give up.
2013-10-14 11:08:15 -07:00
Strahinja Val Markovic
a04ae37ead Client & server threads increased from 4 to 10 2013-10-11 20:12:04 -07:00
Strahinja Val Markovic
f6432e1498 Releasing Python's GIL in C++ code where possible
Without this, all requests to the server become effectively serialized.
2013-10-11 19:27:04 -07:00
Strahinja Val Markovic
3ae10395ea Preventing Vim thread block on file save
Syntastic would run SyntasticCheck on file save, which would unconditionally
call _latest_file_parse_request.Response() and thus block until the request
returned from the server. We don't want that, so we throw in an explicit check
for the request being ready.
2013-10-11 19:09:21 -07:00
Strahinja Val Markovic
db45e243dd Getting path to python exe on Windows correctly
Fixes #581.
2013-10-11 11:11:02 -07:00
Strahinja Val Markovic
78e3607b00 We now only run extra conf preload for global file
This changes functionality, but since this is an undocumented, non-public API,
it's fine. The reason this is required is because of issue #579; if we try to
run extra conf preload on non-global extra conf, we might not have the
permission to load it. The global extra conf is something the user explicitly
has to set so it's always fine to load that.
2013-10-10 12:55:49 -07:00
Strahinja Val Markovic
7a73eb14d8 Fix problems with unknown extra conf at ycmd start
Fixes #579.
2013-10-10 11:32:20 -07:00
Strahinja Val Markovic
8ce07f508c <c-space> again filters the semantic completions
Fixes #576.
2013-10-09 20:20:34 -07:00
Strahinja Val Markovic
98ef568359 Refactored the popen call for ycmd
Also removed shell = true in the other branch that calls popen
2013-10-09 19:28:27 -07:00
Strahinja Val Markovic
9482ad189e Using full path to Python in popen call
This is the root of the problem in issue #577.

Fixes #577.
2013-10-09 19:18:36 -07:00
Strahinja Val Markovic
a25ed01a7c Starting ycmd without shell = True
This should make it easier to shut down the server on some machines.

Fixes #577.
2013-10-09 17:00:28 -07:00
Strahinja Val Markovic
70a51be209 Making the cs_completer test less flaky 2013-10-09 13:17:53 -07:00
Strahinja Val Markovic
3b057cc667 Basic integration test for the cs_completer 2013-10-08 21:30:53 -07:00
Strahinja Val Markovic
d84f2b0e8e cs_completer works again 2013-10-08 20:52:04 -07:00
Strahinja Val Markovic
7afd76b4d4 Better url joining in base_request 2013-10-08 20:49:00 -07:00