Commit Graph

52 Commits

Author SHA1 Message Date
Stanislav Seletskiy
14ea90385b tests and docs 2015-08-03 14:41:25 +06:00
Stanislav Seletskiy
1356560f9a fix blumba test 2015-08-03 14:41:25 +06:00
Stanislav Seletskiy
f80414fac5 prototype of autotrigger 2015-08-03 14:41:25 +06:00
Stanislav Seletskiy
bdecd9a8b5 fix not cleared context 2015-07-29 20:08:49 +06:00
Stanislav Seletskiy
9649f15a9e fix buffer edits from jump action 2015-07-29 20:08:49 +06:00
Stanislav Seletskiy
5a663116f5 edge case: anon snip in pre-action 2015-07-29 20:08:49 +06:00
Stanislav Seletskiy
ba774c39ca review fixes 2015-07-29 20:08:49 +06:00
Stanislav Seletskiy
972305725f fix expan_anon in pre-action, snip object, fixes 2015-07-29 20:08:49 +06:00
Stanislav Seletskiy
191ebd8e8b migrate to snip.* namespace 2015-07-29 20:08:34 +06:00
Stanislav Seletskiy
1ca82f76f7 pre/post-expand and post-jump actions 2015-07-29 20:08:34 +06:00
Holger Rapp
67fbdb2ad8 Handle $0 in a default text like any other tabstop.
Also change timing for testing again.

Fixes #356.
2015-07-27 17:11:35 +02:00
Holger Rapp
300156642c Support $n tabstops for snipMate snippets.
Before, only ${n} tabstops were supported. Apparently snipMate changed
this behavior though, so now we support that too.

Fixes #533.
2015-07-20 15:01:49 +02:00
Holger Rapp
cd0e60bc0f Remove no longer needed langmap translation.
Vim now has the 'langnoremap' option that handles issues with mapping
much more canonical.
2015-07-18 17:33:27 +02:00
Holger Rapp
290600c027 Pass the expected python version to the tests.
This ensure that we are actually testing against the python version that
we want to test again. A few weeks ago we still had the problem that all
our python3 tests ran against system python3 which was always 3.2. This
has been fixed a while ago, but this change makes sure we do not
regress.

Also fixes a couple of NOCOM comments that I left over in one of the
last commits.
2015-07-18 12:49:23 +02:00
Holger Rapp
44db53b7b6 Even more leanient timings. 2015-07-15 08:03:05 +02:00
Holger Rapp
0be9d0f861 Even slower typing. 2015-07-14 22:53:18 +02:00
Holger Rapp
eee82219b6 More lenient typing speed for Neovim. 2015-07-14 22:29:35 +02:00
Holger Rapp
306f0ace5f Add a testing interface that works for Neovim.
- Remove support for python 3.2 to reduce number of test cases and because
  it actually fails with Neovim. It is not a supported version anyways.
- Due to Neovim not handling fast typing through the console properly
  (https://github.com/neovim/neovim/issues/2454), the typing is actually
  simulated through the Python client. We need to differentiate now if a
  keystroke is meant for the terminal or for the Vim session. Using
  neovim.input() introduces additional chances for races since inputs
  are not buffered but processed right away. This results in more
  retries for some tests.
- Neovim needs more parameters and configuration passed in through the
  test script. Added command line arguments for these.
- Skip an extra test under Neovim due to
  https://github.com/neovim/python-client/issues/128.
2015-07-14 21:58:30 +02:00
Greg Hurrell
c4ee3ecf10 Fire autocommands when setting up and tearing down inner state
It can be useful to set up mappings that apply only during expansion of
a snippet. UltiSnips does this internally with the `_setup_inner_state`
and `_teardown_inner_state` methods.

This commit adds some `User` autocommands so that users of UltiSnips can
set up their own mappings and tear them down at the same time as
`_setup_inner_state` and `_teardown_inner_state`.

This is particularly useful for people who are writing their own
expansion and jump functions using `UltiSnips#JumpForwards` and
`UltiSnips#ExpandSnippet()` and friends. Here's an example from my own
dotfiles:

- 0664b627e7
- 3740c248ee

Using this approach I've been able to get rid of Supertab and have a
more nuanced autocompletion experience that works exactly as I'd like
with YouCompleteMe.
2015-07-13 07:11:39 +02:00
Holger Rapp
324a4f8ffc Support regexp trigger ending in whitespace.
Fixes #178.
2015-07-11 18:11:19 +02:00
Holger Rapp
becab789a8 Remove bootstrap.vim. Simplify startup.
The python module is now pulled in autoload/UltiSnips.vim. This means
that parsing of the .vimrc will only map the keys and set some options -
very cheap.

Unfortunately, the autocommands set up in plugin/UltiSnips.vim pulls in
the python code basically immediately still.
2015-07-11 16:17:50 +02:00
Holger Rapp
4f65a76542 Fix testing and test against more scenarios.
Before this, we only ever ran against system python preinstalled on
travis (i.e. 2.7 and 3.2). This change makes sure that Vim is always
build and run against the correct python version in the virtual env.
Also adds mercurial (HEAD) Vim as a testing target.
This patch took me forever to get right. At least 2 months and ~200
travis runs of trial and error - there is just too much finicky going on
with the many virtual envs on travis, Vims strange build system that
does not use python-config and LD_LIBRARY_PATH loading. En plus, the
debugging insights one can glance from travis runs are rather limited.

Detailed changes:
- Uses less sudo and only outside of scripts.
- Build correct version of Vim against correct version of Python. This
  needs some LD_LIBRARY_PATH magic to make sure that Vim finds the
  correct Python libraries at runtime.
- Removes dirty hack that overwrote /usr/bin/vim with the correct Vim
  version to run. The test_all.py script now takes the Vim binary as a
  parameter.
2015-07-03 21:52:50 +02:00
Holger Rapp
d6098193ef Merge pull request #446 from seletskiy/context-snippets
New feature: Context-aware snippets
2015-05-01 14:35:19 +02:00
Stanislav Seletskiy
50bb61cdc4 another test for error reporting 2015-05-01 18:07:59 +06:00
Stanislav Seletskiy
463e68a611 fix for correct error reporting 2015-05-01 18:03:21 +06:00
Holger Rapp
9587d9daa4 Merge pull request #486 from seletskiy/enhance-undo
Add more precise undo levels (expanding, jumping)
2015-04-30 07:55:58 +02:00
Stanislav Seletskiy
099d3bcfbc Add more precise undo levels (expanding, jumping)
Breaking undo achieved through re-setting &undolevel:

    Setting the value of 'undolevels' also breaks undo. Even when the new
    value is equal to the old value.

    [:h :undoj]
2015-04-27 19:30:17 +06:00
Stanislav Seletskiy
1b3ecf4a85 priority test, docs & fmt fixes 2015-04-27 15:42:21 +06:00
Stanislav Seletskiy
904fbdecf5 review fixes 2015-04-25 21:38:22 +06:00
Holger Rapp
82ceb62887 Remove testing with GNU screen
The testing on Travis only relies on tmux which also works locally fine.
No need to support two interfaces for the same thing.
2015-04-22 09:31:07 +02:00
Stanislav Seletskiy
87c3a7ba43 fix UltiSnipFunc test 2015-04-19 11:40:00 +06:00
Holger Rapp
aeb2e24204 Disabled unite test - it seems flaky. 2015-04-18 17:33:36 +02:00
Holger Rapp
99eede1bf6 Started to test py2 and py3 on travis now.
I also learned that Vim 7.3 does not seem to be working at all anymore.
Fixes a bug that only happens with python3.
2015-04-18 17:15:05 +02:00
kawing.chiu
f9a22111f0 Fix adjacent tabstop input issue.
Previously, adjacent tabstops like $1$2 were not handled properly.
$2 could be jumped to but no text could be added. See issue #457.
2015-03-13 23:49:45 +08:00
spacewander
4d88df461f remove duplicate things in vim_test_case.py 2015-03-05 18:21:09 +08:00
Holger Rapp
56ac14840f Disable neocomplete test which fails right now. 2015-02-14 15:39:12 +01:00
Holger Rapp
09876e0084 Support for m (trim) snippet option. 2015-02-14 14:20:03 +01:00
Daniel Hahler
1a3d0ce4b3 tests: allow passing in PYTHON, and default to python2 2015-02-09 22:48:16 +01:00
Daniel Hahler
6602da89dd tests: fix duplicate method name (test_SnippetPriorities) 2015-02-09 22:48:16 +01:00
Daniel Hahler
98fa887e57 tests: remove star imports, sort 2015-02-09 22:48:16 +01:00
Stanislav Seletskiy
81a628c6ea Add option 'm' for trimming whitespaces in snippet
Fix #391
2015-02-04 11:55:28 +06:00
Holger Rapp
6a787cdc7b Applied pyformat on entire codebase. 2015-01-20 21:26:03 +01:00
John Szakmeister
1f3f1ce641 Don't rely on having the tmux/screen cwd being in the project directory.
Instead, let's just change the runtime path to include a pointer to the
top of the tree.
2014-11-24 04:45:37 -05:00
John Szakmeister
8b2115ec26 Fix #171: UltiSnips crashes in new file with text containing 0x80 char
It turns out that vim.eval() will attempt to do Unicode conversion and
can fail when raw bytes are present in the unnamed register.  To avoid
this problem, let's not carry the value across the bridge, and instead
store the cached value in Vim directly.  This successfully sidesteps the
issue entirely, and provides the correct save and restore behavior.

This also adds a test case for the issue.  Since expansion can finish
(despite the errors), the test has to capture the error messages and
examine them for a failure.
2014-11-21 06:09:49 -05:00
John Szakmeister
f4df1bd9e8 Teach _vim_enc to handle UnicodeDecodeErrors.
It's possible that when using _vim_dec with Python 2 that we fail to
convert the string to Unicode and just return the raw string instead.
This could happen, for instance, when there was arbitrary data in the
unnamed register during the save/restore process.  During restoration,
we'd attempt to encode the string, but this may fail with a
UnicodeDecodeError as Python attempts to first convert to Unicode and
then to the requested encoding.

To fix this, let's also catch `UnicodeDecodeError` and return the raw
string if we fail to convert.
2014-11-21 06:09:18 -05:00
John Szakmeister
56aa817be0 Reset the unnamed register at the start of a test.
Any test that alters the unnamed register can cause subsequent tests to
fail if there is an issues saving and restoring the register.  Let's
make the test infrastructure more robust against this issue by resetting
the unnamed register to an empty string.
2014-11-15 04:30:52 -05:00
Glenn Griffin
e3abd6678f Added test case for shiftwidth=0 and added myself to contributors list. 2014-10-08 10:30:40 -07:00
Holger Rapp
c3660128ac Implements clearsnippets by priority. 2014-08-02 14:55:27 +02:00
cwahbong
63f65ea874 Add/modify test cases for priority-based clearsnippets. 2014-08-01 14:32:47 +08:00
cwahbong
97bad9906a Add test case for #341 (github). 2014-07-31 20:58:43 +08:00