Commit Graph

717 Commits

Author SHA1 Message Date
micbou
d61944098a
Do not open location list at the bottom of screen
The location list is specific to the current window so it should be opened
inside the current window, not to full width at the bottom of the screen.
2017-09-17 20:34:52 +02:00
micbou
c5bec8f690
Expect GetCompletions_Cache_List_Unicode test to fail
This test is expected to fail since we now filter and sort candidates on empty
query.
2017-09-10 16:33:24 +02:00
micbou
031edea89e
Improve error message when server crashes
Give the exact command that the user needs to type to open the server logfile
when the server unexpectedly crashes.
2017-08-18 18:15:20 +02:00
micbou
bdac8ed43e
Do not read server stderr
Reading ycmd stderr blocks Vim if a subserver process is still up even if ycmd
is not running.
2017-08-17 20:16:54 +02:00
micbou
1e935db4b7
Fix unicode warning when unloading buffer on Python 2 2017-07-08 14:46:04 +02:00
micbou
2afc0d5f5f
Update BufferUnload test with Unicode paths 2017-07-08 14:19:27 +02:00
micbou
139e3fbaf9
Add omnifunc tests 2017-07-07 22:45:05 +02:00
micbou
600383fbac
Do not cache omnifunc on FileReadyToParse event 2017-07-07 21:39:27 +02:00
micbou
dec9c0f827
Add test with omnifunc moving cursor position 2017-07-07 13:59:57 +02:00
micbou
83bb78a2d6
Restore cursor position after omnifunc call
Calling directly the omnifunc may move the cursor position. This is the case
with the default Vim omnifunc for C-family languages (ccomplete#Complete) which
calls searchdecl to find a declaration. This function is supposed to move the
cursor to the found declaration but it doesn't when called through the omni
completion mapping (CTRL-X CTRL-O). So, we restore the cursor position after
calling the omnifunc.
2017-07-07 03:38:33 +02:00
micbou
db0b9ab335
Rewrite omnifunc tests
The VimBuffer object now accepts a Python function as its omnifunc.
2017-07-05 23:21:36 +02:00
zzbot
191b79ed65 Auto merge of #2702 - micbou:unicode-warnings, r=bstaletic
[READY] Fix unicode warning when jumping on Python 2

On Python 2, jumping in a file whose path contains non-ASCII characters raises the following warnings:
```
Error detected while processing function <SNR>26_CompleterCommand:
line   18:
python\ycm\vimsupport.py:400: UnicodeWarning: Unicode unequal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if filename != GetCurrentBufferFilepath():
python\ycm\vimsupport.py:375: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if win.buffer.name == filepath:
```
This happens because, in the `JumpToLocation` function, we are comparing a unicode object (`filename` and `filepath`) with a Vim buffer name (`vim.current.buffer.name` returned by `GetCurrentBufferFilepath` and `win.buffer.name` where `win` is a Vim window) which is a byte object on Python 2.

For now, this PR adds tests covering the `JumpToLocation` function with unicode paths. They will raise the warnings on Python 2 and will fail because warnings are now treated as errors in tests. I'll update the PR with the fix once the builds are done.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2702)
<!-- Reviewable:end -->
2017-07-05 13:29:12 -07:00
micbou
81546b901e
Fix HiddenEnabled function
The 'hidden' option is a global option, not a buffer one. If this option is
false, we should check if the 'bufhidden' option, which is local to the buffer,
is set to 'hide'. If so, the buffer can be hidden despite the 'hidden' option
being false.
2017-07-05 19:56:13 +02:00
zzbot
bd302907f5 Auto merge of #2704 - micbou:stop-polling-if-server-crashed, r=bstaletic
[READY] Stop polling for readiness if the server crashed

There is no need to continue polling the server if its process has terminated (i.e. the server crashed). This fixes issue https://github.com/Valloric/YouCompleteMe/issues/2683 when the server is not working.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2704)
<!-- Reviewable:end -->
2017-07-05 01:28:17 -07:00
micbou
1ceabea26e
Stop polling for readiness if server crashed 2017-07-05 05:19:47 +02:00
micbou
e573457563
Convert buffer name to unicode
Fix JumpToLocation tests on Python 2.
2017-07-05 02:25:30 +02:00
micbou
e5457affd8
Add JumpToLocation unicode tests 2017-07-05 00:55:29 +02:00
micbou
f31102e317
Check if server is ready before running tests 2017-07-03 18:06:01 +02:00
Ben Jackson
5c98b69b6f Fix tests supplying findstart. It's 0-based. Known failure is no longer a known failure 2017-07-03 00:55:03 +01:00
Ben Jackson
c3984505db Use the omnifunc-supplied start column 2017-06-29 19:16:09 +01:00
micbou
223ae6ab9f
Rewrite completion system
Bring fully asynchronous completion by polling for completions with a timer
then calling completefunc once the completions are ready. Use the start column
returned by the server in completefunc. Immediately display the last completion
on the TextChangedI event to prevent the popup menu disappearing while waiting
for the completions. Handle the TextChangedI event not being triggered while
the completion menu is open by closing the menu when inserting a character
through the InsertCharPre event, and when deleting a character on the <BS> and
<C-h> keys.
2017-06-21 02:32:57 +02:00
zzbot
44d4f1d299 Auto merge of #2690 - micbou:identifier-functions-codepoint, r=Valloric
[READY] Use codepoint offsets in identifier functions

`CurrentIdentifierFinished` and `LastEnteredCharIsIdentifierChar` incorrectly use byte offsets with unicode lines (`CurrentColumn` returns a byte offset and `CurrentLineContents` a unicode string). This leads to weird bugs when there is a non-ASCII character on the current line:

![unicode-identifier-bug](https://user-images.githubusercontent.com/10026824/27256590-34b27c8c-53ba-11e7-8032-b98f0c7e0b14.gif)

This is fixed by converting byte offsets to codepoint ones through the `ByteOffsetToCodepointOffset` function.

This changes the behavior of these two functions when the current column position is invalid. Both functions returned false in that case. They now return as if the current column were at the end of the line. In practice, this doesn't really matter since the position of the current column should always be valid.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2690)
<!-- Reviewable:end -->
2017-06-18 12:29:13 -07:00
micbou
eb3c0cd8c1
Use codepoint offsets in identifier functions
CurrentIdentifierFinished and LastEnteredCharIsIdentifierChar incorrectly use
byte offsets with unicode lines. Convert those offsets to codepoint offsets.
2017-06-18 20:41:30 +02:00
Davit Samvelyan
a70755aa40 Removed current buffer caching approach. 2017-06-12 15:23:14 +04:00
Davit Samvelyan
e5b0565d1a Fixed bug: current buffer was not set correctly.
Other minor fixes.
2017-06-10 09:53:18 +04:00
Davit Samvelyan
22be4e777d Refactored diag interface, removed dummy sign. 2017-06-05 22:20:57 +04:00
zzbot
c2906b6fef Auto merge of #2631 - davits:changedtick, r=bstaletic
[READY] Moved change tracking to python. Per buffer diagnostics

Thank you for working on YCM! :)

- [x] I have read and understood YCM's [CONTRIBUTING][cont] document.
- [x] I have read and understood YCM's [CODE_OF_CONDUCT][code] document.
- [x] I have included tests for the changes in my PR. If not, I have included a
  rationale for why I haven't.
- [x] **I understand my PR may be closed if it becomes obvious I didn't
  actually perform all of these steps.**

Adds an emulation of Vim buffer object and moves change tracking into python.
Now diagnostics are stored per buffer, which effectively solves #2165 .

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2631)
<!-- Reviewable:end -->
2017-06-05 03:21:41 -07:00
Davit Samvelyan
8c6efb4214 Cache current buffer on buffer visit. 2017-06-04 12:09:49 +04:00
Davit Samvelyan
fc745f74b3 Minor changes addressing review comments. 2017-05-29 22:24:55 +04:00
Boris Staletic
3e77555905 Filepath space escaping 2017-05-24 17:30:15 +02:00
Davit Samvelyan
b6bbe6388f Removed unused function, added comment. 2017-05-21 19:35:01 +04:00
Davit Samvelyan
3a690fc8d4 Update based on the latest upstream changes. 2017-05-21 18:58:29 +04:00
Davit Samvelyan
0846673aa4 Latest upstream changes with buffer emulation.
Contains diagnostic interface improvents as well.
2017-05-21 18:26:50 +04:00
Davit Samvelyan
979f14acfd Moved change tracking to python. Per buffer diags 2017-05-21 11:47:27 +04:00
micbou
1fc6b4a43b
Clean C# inserting namespace code
Remove code that automatically insert namespaces in C# for Vim versions prior
to 7.4.774.
2017-05-17 19:44:02 +02:00
micbou
26ac0c8730
Add syntax keywords tests
Patch EventNotification instead of BaseRequest in event notification tests.
2017-05-17 13:09:39 +02:00
micbou
3ac2951c7b
Parse current buffer when server is ready 2017-05-15 23:57:09 +02:00
micbou
4e08cde268
Shut down ycmd after 30 minutes of inactivity 2017-05-15 11:20:48 +02:00
Homu
ff76a4ed33 Auto merge of #2602 - micbou:diagnostics-no-location-extent, r=Valloric
[READY] Fix diagnostic highlighting with invalid location extent

ycmd may return a location extent with a starting column of zero (see the test for an example) which is not a valid column (columns are 1-indexed). We should use the location in this case. Also, when the location extent is not valid, we should call `AddDiagnosticSyntaxMatch` with the `is_error` parameter to highlight warnings as such and not as errors (`is_error` is `True` by default).

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2602)
<!-- Reviewable:end -->
2017-04-07 05:38:08 +09:00
micbou
47f3f9d2c6
Fix diagnostic highlighting with invalid location extent
Ignore location extent when starting column is zero. Do not highlight warnings
as errors when location extent is invalid.
2017-04-06 17:53:23 +02:00
micbou
c14459dd58
Do not cache Python interpreter path 2017-04-02 22:28:59 +02:00
Andrey Pikas
ebc3856121 Merge branch 'master' into fork_master 2017-03-30 20:26:11 +03:00
micbou
e45a409ac9
Prioritize errors over warnings on the same line 2017-03-29 12:34:48 +02:00
micbou
fb000ca9e7
Accept capitalized name for Python executable
Python executable name may be capitalized on macOS.
2017-03-28 02:12:15 +02:00
micbou
f84796bf0e
Remove Python version check
Starting the Python interpreter to check its version is slow.
2017-03-25 18:27:07 +01:00
Mike Perri
656ddc34e3 Enable diagnostics for TypeScript and update README 2017-03-25 11:22:02 -04:00
micbou
e581c5c8ab
Import urljoin and urlparse from ycmd.utils 2017-03-20 10:59:20 +01:00
micbou
f3ccafe3ae
Do not install aliases from future
Installing aliases from python-future is unreliable and slow.
2017-03-18 18:24:48 +01:00
Andrey Pikas
2495dffa59 Fix tests under Windows. 2017-03-12 23:06:05 +03:00
Andrey Pikas
822010fe4c Move import to the top of file. 2017-03-12 20:18:24 +03:00
Andrey Pikas
592b85516b Tests for checking that extra_conf_data sended to server from :DebugInfo and :YcmCompleter commands. 2017-03-12 19:03:07 +03:00
Andrey Pikas
3db1413cd9 Send extra_conf_vim_data in requests from :YcmCompleter and :YcmDebugInfo commands. It's needed for passing compile_commands.json directory to every call of FlagsForFile in client_data argument. 2017-03-11 13:34:37 +03:00
micbou
7e31634072
Convert stderr from server to unicode
On Python 3, reading stderr from server returns bytes. We need to convert it to
unicode for splitlines.
2017-03-08 17:30:00 +01:00
micbou
09a08d3240
Import requests module lazily
The requests module is slow to load so we should import it only when needed to reduce startup time.
2017-03-04 03:21:58 +01:00
micbou
414782bc74
Add tests for diagnostic commands 2017-02-20 18:28:49 +01:00
micbou
0d476a0164
Refactor diagnostic commands
Move s:ShowDiagnostics and s:ForceCompileAndDiagnostics logic to the Python layer.
Clear message about compilation blocking Vim once it is done.
2017-02-20 18:28:49 +01:00
micbou
c349980bce
Send requests again when server becomes ready 2017-02-18 14:04:03 +01:00
Andrea Cedraro
fda5c7e6c6 Use bang version of normal
Fixes #2519
2017-01-31 22:09:40 +01:00
micbou
10aba99782
Remove healthy check 2017-01-28 16:54:33 +01:00
micbou
6e8aeeac15
Catch ConnectionError instead of ConnectTimeout
On non-Windows platforms, a ConnectionError exception is raised instead
of a ConnectTimeout one when the connection cannot be established (e.g.
the server crashed). Since the latter is a subclass of the former, we
only need to catch ConnectionError.
2017-01-27 03:33:43 +01:00
micbou
8426191655
Update test 2017-01-24 22:43:41 +01:00
micbou
05256d6719
Define connect timeout
Rely on connect timeout instead of checking if the server is alive.
2017-01-24 22:43:40 +01:00
micbou
ab758e4c64
Include subservers logfiles in YcmToggleLogs 2017-01-21 13:42:58 +01:00
micbou
18aba7a582
Implement new debugging information API 2017-01-18 11:13:11 +01:00
Kyle Lippincott
b5b2fb57e1 Disable sitecustomize when checking python version
Sitecustomize files can be slow or broken and might hang editor
startup.  Since they aren't necessary for checking the python version,
disable them to get a small speed boost for everyone, and an editor
that doesn't hang indefinitely on startup if the sitecustomize gets
into an infinite loop (due to a bad NFS mount or similar).
2017-01-11 12:18:39 -08:00
micbou
deddca8927
Handle exceptions from loading/ignoring extra conf 2017-01-03 15:29:12 +01:00
Homu
8161d35030 Auto merge of #2465 - micbou:response-future, r=Valloric
[READY] Fix exception when response future is not set

An `AttributeError` exception is raised when `Done` is called before `Start` in the `CompletionRequest` and `EventNotification` classes because the `_response_future` attribute is not yet defined.

Fixes #2461.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2465)
<!-- Reviewable:end -->
2016-12-23 09:41:21 +09:00
micbou
85d5844873
Add docstring to HandleServerException
Wrap request with HandleServerException in YcmdKeepalive class.
2016-12-12 02:53:57 +01:00
micbou
01aa54ee2d
Add tests 2016-12-12 02:36:15 +01:00
micbou
fd41d52dfe
Catch and log all server exceptions 2016-12-12 02:36:15 +01:00
micbou
bd890428a4
Fix exception when response future is not set 2016-12-11 20:51:45 +01:00
micbou
b93c1fd47c
Add client logfile 2016-11-19 18:47:43 +01:00
Homu
fbe53de5a2 Auto merge of #2441 - micbou:flake8, r=Valloric
[READY] Fix flake8 error

This fixes a new error detected by the last version of `pycodestyle` (2.2.0), which is a dependency of `flake8`:
```
C:\projects\youcompleteme\python\ycm\youcompleteme.py:69:1: E305 expected 2 blank lines after class or function definition, found 1
```

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2441)
<!-- Reviewable:end -->
2016-11-16 04:10:30 +09:00
micbou
c33a844e5f
Fix flake8 error 2016-11-15 11:15:16 +01:00
Nader Akoury
f4f12f3c9b Fix another test failure
* Because I cannot seem to run the tests locally I am relying on the CI
tests which kind of sucks...
2016-11-11 11:28:20 -08:00
Nader Akoury
659746eaaf Doh, forgot to revert my previous changes. Fixed! 2016-11-11 10:53:26 -08:00
Nader Akoury
9c93244d3b Addressed review comments and fixed tests 2016-11-11 10:15:22 -08:00
Nader Akoury
74951adcc7 Address #1366 by reusing a single preview buffer
* Additionally set the preview buffer to be unlisted so it does not
interfere with commands like :bnext
2016-11-11 07:53:01 -08:00
dhleong
8eabf580ad Rename argument 2016-11-03 13:47:26 -04:00
dhleong
0babb4b102 Cleanup 2016-11-03 11:21:15 -04:00
dhleong
0523ad02c0 Fix InsertNamespace indent matching
Aso updates the appropriate tests and adds docs to some
relevant methods whose behavior might be confusing
2016-11-02 08:08:30 -04:00
dhleong
26141253a5 Add some tests for InsertNamespace 2016-11-01 08:28:28 -04:00
dhleong
62a815275f Fix InsertNamespace
ReplaceChunk must have changed to require the buffer at some point
2016-10-31 17:00:45 -04:00
Homu
6e52536f70 Auto merge of #2407 - micbou:remove-unloaded-buffer-parameter, r=vheon
[READY] Remove unloaded_buffer parameter

See PR https://github.com/Valloric/ycmd/pull/542.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2407)
<!-- Reviewable:end -->
2016-10-28 01:44:10 +09:00
micbou
f6ffe1f1a6
Remove unloaded_buffer parameter 2016-10-27 01:48:33 +02:00
Homu
d55b5c09d6 Auto merge of #2394 - micbou:move-client-tests, r=Valloric
[READY] Move client tests to the main tests folder

This makes it possible to configure all tests at a package level by implementing the `setUpPackage` and `tearDownPackage` functions in `python/ycm/tests/__init__.py` file.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2394)
<!-- Reviewable:end -->
2016-10-26 07:46:33 +09:00
micbou
62ff65006f
Remove unused code in shutdown request 2016-10-25 17:59:17 +02:00
micbou
c991f04905
Create temporary files in a secure manner
Fixes #2395.
2016-10-24 22:45:15 +02:00
Homu
f27787f263 Auto merge of #2377 - dhleong:dhleong/#2021-quiet_messages, r=micbou
Implement ycm_quiet_messages options (See #2021)

# PR Prelude

- [x] I have read and understood YCM's [CONTRIBUTING][cont] document.
- [x] I have read and understood YCM's [CODE_OF_CONDUCT][code] document.
- [x] I have included tests for the changes in my PR. If not, I have included a
  rationale for why I haven't.
- [x] **I understand my PR may be closed if it becomes obvious I didn't
  actually perform all of these steps.**

# Why this change is necessary and useful

See issue #2021. This is a partial implementation based on the syntastic option referenced, supporting the `!` flag and filters of type `regex` and `level`. Also supports filetype specific filters using `ycm_<ft>_quiet_messages`, but I couldn't think of a great way to fall back to syntastic configs for this one.

In terms of usefulness: I've been playing with C# recently, which has a bunch of style warnings that I don't want to follow, and prefer to only have the gutter showing if there are actually errors, or warnings that I *do* want to follow.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2377)
<!-- Reviewable:end -->
2016-10-24 10:46:06 +09:00
dhleong
13fda74cc1 Refactor _FilterDiagnostics to rely on _ApplyDiagnosticFilter
Also builds the predicates using compilers from diagnostic_filter
2016-10-23 10:29:54 -04:00
dhleong
e2852a8b2b Update to use appropriate test_utils package after rebase 2016-10-22 23:33:43 -04:00
dhleong
7978215bca Refactor filter to not be initialized every time
We eagerly compile all the filters up front, then gather the
compiled filters into a DiagnosticFilter lazily, caching the
result to avoid garbage lists.
2016-10-22 23:31:46 -04:00
dhleong
b8280c7b19 Rename diagnostic_filter_tests -> diagnostic_filter_test 2016-10-22 23:31:46 -04:00
dhleong
18a25d45b3 Style refactor and cleanup 2016-10-22 23:31:46 -04:00
dhleong
bb793826b6 Refactor filter spec to filter_diagnostics; update tests, README 2016-10-22 23:31:46 -04:00
dhleong
3869830a65 Rename method for clarity and tweak style 2016-10-22 23:31:46 -04:00
dhleong
68cf0220e5 Remove unnecessary print() 2016-10-22 23:31:46 -04:00
dhleong
4c53e5d006 Use future.utils iterkeys; fix some more style issues 2016-10-22 23:31:46 -04:00
dhleong
ca29f6abe8 Verify that an empty list overrides (disables) rules 2016-10-22 23:31:46 -04:00
dhleong
f15f9f2255 Fix style/lint issues 2016-10-22 23:31:46 -04:00
dhleong
d274dcd37a Fix test error 2016-10-22 23:31:46 -04:00
dhleong
73343bd98f Support filtering on level/kind 2016-10-22 23:31:46 -04:00
dhleong
f7fbbd16f7 Implement a preliminary quest_messages with regex support 2016-10-22 23:31:46 -04:00
micbou
993f0ef7b6
Move client tests to the main tests folder 2016-10-20 00:24:38 +02:00
micbou
234658f30b
Use helper function to get current directory
Fix tests.
2016-10-18 15:35:51 +02:00
micbou
3109c9d8a4
Add tests for current directory 2016-10-18 02:22:28 +02:00
micbou
fa10f33c2a
Move test_utils to tests folder
This remove the file from coverage.
2016-10-15 04:03:48 +02:00
micbou
8d015c95cc
Refactor tests using a YouCompleteMe instance 2016-10-14 02:18:51 +02:00
micbou
cbe53c1f3e
Rename postcomplete tests file
Rename postcomplete_tests.py file to be consistent with other tests
name. Update its copyright date.
2016-10-12 05:13:06 +02:00
micbou
92f1bbda94
Add event notification tests
Add tests for the BufferVisit and BufferUnload event notifications.
2016-10-10 16:27:29 +02:00
micbou
2fabac5a67
Fix BufferUnload event notification
Send the request as the unloaded buffer instead of the current buffer
for the BufferUnload event notification. This fixes the issue where
the filetype of the current buffer is not the same as the unloaded
buffer one, making the ycmd server uses the wrong completer when
handling the request.
2016-10-08 16:43:50 +02:00
Justin Lebar
a33f20d690 Update ycmd, and use JoinLinesAsUnicode in GetUnsavedAndCurrentBufferData().
This function is invoked on every kepress.  On a large file (15+k loc),
using this new function takes kepress latency down to <10ms from ~100ms.
2016-10-07 18:27:09 -07:00
micbou
981a07ded7
Handle keyboard interruption from Vim 2016-09-13 00:53:31 +02:00
micbou
5dca552d5d
Do not depend on UltiSnips internals
Use UltiSnips#SnippetsInCurrentScope to fetch snippets.
Add an entry in the FAQ about the :UltiSnipsAddFiletypes command.
2016-09-11 17:11:32 +02:00
micbou
391757eec2 Avoid hit-enter prompts during completions
When an error occurs during completions, a message is displayed on
the status line. If this message is longer than the width of the
current window, Vim will prompt the user to press enter or type a
command to hide the message, interrupting user workflow. We prevent
that by truncating the message to window width.
Merge PostMultiLineNotice, EchoText, and EchoTextVimWidth functions
into PostVimMessage.
2016-08-28 09:19:07 +02:00
micbou
ef49f3e052 Fix diagnostic highlighting at line ending
When columns are clamped to not be past the contents of the line for
highlighting diagnostics, we need to account for the column end not
being included in the diagnostic range.
2016-08-18 21:21:10 +02:00
micbou
d3916a8752 Extract keywords from whole PreProc syntax group
Reorder syntax groups to follow documentation order.
2016-08-09 11:59:35 +02:00
micbou
75d41d1137 Improve extraction of syntax keywords
Use the following strategy to extract identifiers from syntax
highlighting:
 - ignore match and region: they mostly contain arguments,
   syntax groups and regular expressions;
 - ignore "nextgroup=" if first word and subsequent arguments
   "skipempty", "skipwhite", and "skipnl";
 - ignore "contained" argument if first word;
 - add remaining words to the list of identifiers.
Fix a bug where the word "match" was extracted while not being a keyword
of the syntax language.
2016-08-06 13:39:06 +02:00
micbou
f14485acb9 Rewrite syntax tests
Use matchers from hamcrest instead of eq_ assertions in syntax tests
to get more detailed assertion errors when tests are failing.
2016-08-06 01:12:59 +02:00
micbou
7b2155ab64 Refactor tests using a server instance
Create a Server_test class for tests that need a server instance.
2016-07-23 11:21:38 +02:00
micbou
630b85ad01 Use shutdown request to stop server
Use shutdown request to stop ycmd server in a portable way.
2016-07-23 11:21:20 +02:00
micbou
899746d51c Convert Vim buffers to bytes in ReplaceChunk 2016-07-14 02:39:33 +02:00
micbou
a986b3ed0e Update ReplaceChunk tests
Do not convert strings to bytes but instead use plain strings to mimic
Vim buffers returning a list of byte objects on Python 2 and unicode
objects on Python 3.
2016-07-14 00:46:30 +02:00
Ben Jackson
cfd4bbd531 Support selecting from the list of FixIts when multiple are supplied 2016-07-11 21:52:41 +01:00
micbou
805911b56b Use SetQuickFixList for GoTo* subcommands
Open the quickfix window to full width at the bottom of the screen with
its height set to fit all entries. This behavior can be overridden by
using the YcmQuickFixOpened autocommand.
Add a new section for autocommands in the documentation.
Update GoTo and ReplaceChunks tests.
2016-06-13 00:25:12 +02:00
Homu
e0f2da0885 Auto merge of #2160 - micbou:open-file-encoding, r=Valloric
[READY] Fix LookupError exception when opening a file

Fixes #2159.

I think the issue is caused by `locale.getpreferredencoding()` returning an empty string on some configurations (especially on OS X with Python 2). This is [the value used by default when no encoding is specified](https://docs.python.org/2/library/io.html?highlight=open#io.open). The same error is raised if we do:
```python
open( 'some_file', encoding = '' )
```

For references, similar issues: https://github.com/Valloric/ycmd/issues/395, https://github.com/Valloric/ycmd/issues/419

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2160)
<!-- Reviewable:end -->
2016-05-11 02:01:22 +09:00
micbou
b0786d5c4f Fix LookupError exception when opening a file
Open the file in binary mode in CheckFilename function.
Use ReadFile helper in syntax_parse tests.
2016-05-10 16:30:04 +02:00
Ben Jackson
e73426187d Add tests for omni completer GetCompletions 2016-05-08 15:47:58 +01:00
Ben Jackson
4d7b386a37 Fix a number of multi-byte errors and tracebacks
- Correct FixIts when there are unicode characters
- Fix errors in CompleteDone handler
- Fix tracebacks when omnifunc returns unicode chars
2016-05-08 15:32:36 +01:00
micbou
b923431d7d Avoid evaluating Vim globals in Python
On Python 3, evaluating a Vim expression will raise a unicode exception
if it contains an invalid sequence of bytes for the current encoding.
We can't really do anything about it because this is the way Vim and
Python 3 interact. However, we can prevent this situation to occur by
not evaluating Vim data that we have no control over: in particular,
the Vim globals. This is done by:
 - adding one by one the YCM default options instead of extending the
   Vim globals with them;
 - only evaluating the Vim global variable names (and not their values)
   when building the YCM options for the ycmd server.
2016-05-06 20:14:10 +02:00
micbou
b440f682a8 Add error messages when ycmd crashed
Display an error message to the user depending on the status code
returned by the ycmd server.
Remove ycm_core checks in plugin/youcompleteme.vim. These checks are
now done by the ycmd server.
Do not start a separate process to check the core version but rely on
ycmd returning a specific exit code. This slightly improves the Vim
startup time.
2016-05-02 23:08:32 +02:00
Val Markovic
8fe90b43c4 Starting ycmd with Python used to build it
Note: depends on Valloric/ycmd#466 being merged and the ycmd submodule
ref then being updated.

Fixes #2136
2016-04-27 19:42:00 -07:00
micbou
638550384e Update PostComplete tests
Move with-statement patch as decorator when possible.
Use single quote everywhere instead of double quote (for consistency).
Remove empty lines.
2016-04-07 00:42:43 +02:00
micbou
4b9e16f14d Fix PostComplete test
ReturnEmptyIfPendingMatches_OldVim test was identical to
ReturnEmptyIfPendingMatches_NewVim.
2016-04-07 00:42:43 +02:00
Andrea Cedraro
9e6645f515 Rename ycmd python option
- Rename ycm_path_to_python_interpreter to ycm_ycmd_python_interpreter
- Keep ycm_path_to_python_interpreter backward compatible
2016-03-26 19:15:08 +01:00
Ben Jackson
953885c449 Fix traceback when a syntax file has unicode characters
vim.eval returns a str() object on py2, but our internal strings are all unicode().
We use vimsupport.VimExpressionToPythonType to wrap the conversion complexities.
2016-03-10 21:28:42 +00:00
micbou
d59dfb0a7e Do not send request if server is down
Do not send an "event_notification" request in OnFileReadyToParse
function if server process is terminated. Otherwise, it blocks Vim
for one second or results in a traceback each time the InsertLeave,
CursorMoved, CursorHold, and BufferVisit events are triggered.
2016-03-09 16:53:20 +01:00
Ben Jackson
edd2bdbe0f Update flake8 config 2016-03-06 17:39:55 +00:00
micbou
f6d5f68d6b Catch ReadTimeout exception on requests 2016-03-05 22:34:45 +01:00
Val Markovic
0bcecb14d8 Fixing conversion bug in VimExpressionToPythonType
Bug was that objects other than strings/bytes were being converted to
strings. Also added tests.
2016-03-05 10:16:08 -08:00
Val Markovic
74f5e5ef34 Using non-emacs version of python coding line 2016-03-02 18:12:38 -08:00
Val Markovic
80631b1aaf Enforcing unicode in more vimsupport functions 2016-03-01 19:30:02 -08:00
Val Markovic
c91130f280 Not depending on exception internals
We used to read the `message` attribute; that breaks on py3. The
standard idiom is to just use `str( exception )` to get the message.
2016-03-01 19:30:02 -08:00
Val Markovic
0ed1096040 Support multiline exception message
Also stopped adding the "ycmd exception:" prefix to error messages
because it lies; some exceptions hitting this may not come from ycmd.
2016-03-01 19:29:21 -08:00
micbou
f981370965 Fix CheckFilename test on Windows and Py2
On Windows and Python 2, the full exception message from IOError
in CheckFilename will contain the filepath formatted as a unicode
string. Since the filepath is already added in the RuntimeError
message, use the strerror attribute to only display the error.
2016-02-29 20:06:01 +01:00
micbou
fae95812dc Simplify YouCompleteMe test
Add missing python-future boilerplate.
2016-02-29 20:06:01 +01:00
micbou
b78c403cfe Clean up YCM object in PostComplete tests
Move PostComplete tests inside a class that defines setUp and tearDown
methods. Clean YCM object in tearDown method. This fixes the error
"OSError: [WinError 6] The handle is invalid" on Windows with
Python 3.5.
2016-02-29 20:06:01 +01:00
Val Markovic
eb8a24f23d Addressing review comments 2016-02-29 10:26:50 -08:00
Val Markovic
1c65c96e65 Fixing bad comparison causing ToggleLogs to fail
`is` in Python checks for identity, not equality.
2016-02-28 20:24:53 -08:00
Val Markovic
be1bb3617d Minor tweaks 2016-02-28 19:23:40 -08:00