From f80414fac551fdcb4335afc4d170aeadb873d9d3 Mon Sep 17 00:00:00 2001 From: Stanislav Seletskiy Date: Wed, 17 Jun 2015 22:56:46 +0600 Subject: [PATCH 01/13] prototype of autotrigger --- autoload/UltiSnips.vim | 5 ++++ pythonx/UltiSnips/snippet/source/_base.py | 4 +-- .../snippet/source/_snippet_dictionary.py | 5 +++- pythonx/UltiSnips/snippet_manager.py | 29 ++++++++++++++++--- test/test_UltiSnipFunc.py | 2 +- 5 files changed, 37 insertions(+), 8 deletions(-) diff --git a/autoload/UltiSnips.vim b/autoload/UltiSnips.vim index 8394208..79ff2f4 100644 --- a/autoload/UltiSnips.vim +++ b/autoload/UltiSnips.vim @@ -144,3 +144,8 @@ endf function! UltiSnips#LeavingInsertMode() exec g:_uspy "UltiSnips_Manager._leaving_insert_mode()" endfunction + +function! UltiSnips#TrackChange() + exec g:_uspy "UltiSnips_Manager._track_change()" +endfunction +" }}} diff --git a/pythonx/UltiSnips/snippet/source/_base.py b/pythonx/UltiSnips/snippet/source/_base.py index 71ecf5c..50a68fc 100644 --- a/pythonx/UltiSnips/snippet/source/_base.py +++ b/pythonx/UltiSnips/snippet/source/_base.py @@ -28,7 +28,7 @@ class SnippetSource(object): deep_extends = self.get_deep_extends(base_filetypes) return [ft for ft in deep_extends if ft in self._snippets] - def get_snippets(self, filetypes, before, possible): + def get_snippets(self, filetypes, before, possible, autotrigger_only): """Returns the snippets for all 'filetypes' (in order) and their parents matching the text 'before'. If 'possible' is true, a partial match is enough. Base classes can override this method to provide means @@ -40,7 +40,7 @@ class SnippetSource(object): result = [] for ft in self._get_existing_deep_extends(filetypes): snips = self._snippets[ft] - result.extend(snips.get_matching_snippets(before, possible)) + result.extend(snips.get_matching_snippets(before, possible, autotrigger_only)) return result def get_clear_priority(self, filetypes): diff --git a/pythonx/UltiSnips/snippet/source/_snippet_dictionary.py b/pythonx/UltiSnips/snippet/source/_snippet_dictionary.py index a8b3d65..e334ac6 100644 --- a/pythonx/UltiSnips/snippet/source/_snippet_dictionary.py +++ b/pythonx/UltiSnips/snippet/source/_snippet_dictionary.py @@ -16,13 +16,16 @@ class SnippetDictionary(object): """Add 'snippet' to this dictionary.""" self._snippets.append(snippet) - def get_matching_snippets(self, trigger, potentially): + def get_matching_snippets(self, trigger, potentially, autotrigger_only): """Returns all snippets matching the given trigger. If 'potentially' is true, returns all that could_match(). """ all_snippets = self._snippets + if autotrigger_only: + all_snippets = [s for s in all_snippets if s.has_option('A')] + if not potentially: return [s for s in all_snippets if s.matches(trigger)] else: diff --git a/pythonx/UltiSnips/snippet_manager.py b/pythonx/UltiSnips/snippet_manager.py index f144fbf..04aba08 100644 --- a/pythonx/UltiSnips/snippet_manager.py +++ b/pythonx/UltiSnips/snippet_manager.py @@ -100,6 +100,8 @@ class SnippetManager(object): self._snip_expanded_in_action = False self._inside_action = False + self._last_inserted_char = '' + self._added_snippets_source = AddedSnippetsSource() self.register_snippet_source('ultisnips_files', UltiSnipsFileSource()) self.register_snippet_source('added', self._added_snippets_source) @@ -363,6 +365,8 @@ class SnippetManager(object): _vim.command('autocmd!') _vim.command('autocmd CursorMovedI * call UltiSnips#CursorMoved()') _vim.command('autocmd CursorMoved * call UltiSnips#CursorMoved()') + _vim.command('autocmd InsertCharPre * call UltiSnips#TrackChange()') + _vim.command('autocmd TextChangedI * call UltiSnips#TrackChange()') _vim.command( 'autocmd InsertLeave * call UltiSnips#LeavingInsertMode()') @@ -541,7 +545,7 @@ class SnippetManager(object): elif feedkey: _vim.command('return %s' % _vim.escape(feedkey)) - def _snips(self, before, partial): + def _snips(self, before, partial, autotrigger_only=False): """Returns all the snippets for the given text before the cursor. If partial is True, then get also return partial matches. @@ -565,7 +569,14 @@ class SnippetManager(object): cleared[key] = value for _, source in self._snippet_sources: - for snippet in source.get_snippets(filetypes, before, partial): + possible_snippets = source.get_snippets( + filetypes, + before, + partial, + autotrigger_only + ) + + for snippet in possible_snippets: if ((clear_priority is None or snippet.priority > clear_priority) and (snippet.trigger not in cleared or snippet.priority > cleared[snippet.trigger])): @@ -667,10 +678,10 @@ class SnippetManager(object): self._snip_expanded_in_action = True - def _try_expand(self): + def _try_expand(self, autotrigger_only=False): """Try to expand a snippet in the current place.""" before = _vim.buf.line_till_cursor - snippets = self._snips(before, False) + snippets = self._snips(before, False, autotrigger_only) if snippets: # prefer snippets with context if any snippets_with_context = [s for s in snippets if s.context] @@ -765,6 +776,16 @@ class SnippetManager(object): finally: self._inside_action = old_flag + def _track_change(self): + inserted_char = _vim.eval('v:char') + if inserted_char == '': + before = _vim.buf.line_till_cursor + if before and before[-1] == self._last_inserted_char: + self._try_expand(autotrigger_only=True) + else: + self._last_inserted_char = inserted_char + + UltiSnips_Manager = SnippetManager( # pylint:disable=invalid-name vim.eval('g:UltiSnipsExpandTrigger'), vim.eval('g:UltiSnipsJumpForwardTrigger'), diff --git a/test/test_UltiSnipFunc.py b/test/test_UltiSnipFunc.py index 6e6a06e..f59c275 100644 --- a/test/test_UltiSnipFunc.py +++ b/test/test_UltiSnipFunc.py @@ -154,7 +154,7 @@ from UltiSnips.snippet.source import SnippetSource from UltiSnips.snippet.definition import UltiSnipsSnippetDefinition class MySnippetSource(SnippetSource): - def get_snippets(self, filetypes, before, possible): + def get_snippets(self, filetypes, before, possible, autotrigger_only): if before.endswith('blumba'): return [ UltiSnipsSnippetDefinition( From 5af229abc0aab4c16baf314383e8b99a672e5af3 Mon Sep 17 00:00:00 2001 From: Stanislav Seletskiy Date: Thu, 18 Jun 2015 10:26:52 +0600 Subject: [PATCH 02/13] add error handling --- pythonx/UltiSnips/snippet_manager.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pythonx/UltiSnips/snippet_manager.py b/pythonx/UltiSnips/snippet_manager.py index 04aba08..2313bbd 100644 --- a/pythonx/UltiSnips/snippet_manager.py +++ b/pythonx/UltiSnips/snippet_manager.py @@ -776,6 +776,7 @@ class SnippetManager(object): finally: self._inside_action = old_flag + @err_to_scratch_buffer def _track_change(self): inserted_char = _vim.eval('v:char') if inserted_char == '': From 1356560f9a3e5b0ae86b3efdc78877175355dcdd Mon Sep 17 00:00:00 2001 From: Stanislav Seletskiy Date: Wed, 24 Jun 2015 20:16:48 +0600 Subject: [PATCH 03/13] fix blumba test --- test/test_UltiSnipFunc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_UltiSnipFunc.py b/test/test_UltiSnipFunc.py index f59c275..a0dde3d 100644 --- a/test/test_UltiSnipFunc.py +++ b/test/test_UltiSnipFunc.py @@ -155,7 +155,7 @@ from UltiSnips.snippet.definition import UltiSnipsSnippetDefinition class MySnippetSource(SnippetSource): def get_snippets(self, filetypes, before, possible, autotrigger_only): - if before.endswith('blumba'): + if before.endswith('blumba') and autotrigger_only == False: return [ UltiSnipsSnippetDefinition( -100, "blumba", "this is a dynamic snippet", "", "", {}, "blub", From 14ea90385b1ec3a78f2f1e3d25c595e5b8ccfafe Mon Sep 17 00:00:00 2001 From: Stanislav Seletskiy Date: Wed, 24 Jun 2015 21:39:33 +0600 Subject: [PATCH 04/13] tests and docs --- doc/UltiSnips.txt | 33 +++++++++++++++++++++++++++++++++ test/test_Autotrigger.py | 22 ++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 test/test_Autotrigger.py diff --git a/doc/UltiSnips.txt b/doc/UltiSnips.txt index bc5b541..62524ea 100644 --- a/doc/UltiSnips.txt +++ b/doc/UltiSnips.txt @@ -42,6 +42,7 @@ UltiSnips *snippet* *snippets* *UltiSnips* 4.10.1 Pre-expand actions |UltiSnips-pre-expand-actions| 4.10.2 Post-expand actions |UltiSnips-post-expand-actions| 4.10.3 Post-jump actions |UltiSnips-post-jump-actions| + 4.11 Autotrigger |UltiSnips-autotrigger| 5. UltiSnips and Other Plugins |UltiSnips-other-plugins| 5.1 Existing Integrations |UltiSnips-integrations| 5.2 Extending UltiSnips |UltiSnips-extending| @@ -690,6 +691,9 @@ The options currently supported are: > python expression. This option can be specified along with other options, like 'b'. See |UltiSnips-context-snippets| for more info. + A Snippet will be triggered automatically, when condition matches. + See |UltiSnips-autotrigger| for more info. + The end line is the 'endsnippet' keyword on a line by itself. > endsnippet @@ -1599,6 +1603,35 @@ def $1(): endsnippet ------------------- SNAP ------------------- +4.11 Autotrigger *UltiSnips-autotrigger* +---------------- + +Many language constructions can occur only at specific places, so it's +possible to use snippets without manually triggering them. + +Snippet can be marked as autotriggered by specifying 'A' option in the snippet +definition. + +After snippet is defined as being autotriggered, snippet condition will be +checked on every typed character and if condition matches, then snippet will +be triggered. + +Consider following snippets, that can be usefull in Go programming: +------------------- SNIP ------------------- +snippet "^p" "package" rbA +package ${1:main} +endsnippet + +snippet "^m" "func main" rbA +func main() { + $1 +} +endsnippet +------------------- SNAP ------------------- + +When "p" character will occur in the beginning of the line, it will be +automatically expanded into "package main". Same with "m" character. + ============================================================================== 5. UltiSnips and Other Plugins *UltiSnips-other-plugins* diff --git a/test/test_Autotrigger.py b/test/test_Autotrigger.py new file mode 100644 index 0000000..92b6a07 --- /dev/null +++ b/test/test_Autotrigger.py @@ -0,0 +1,22 @@ +from test.vim_test_case import VimTestCase as _VimTest +from test.constant import * + + +class Autotrigger_CanMatchSimpleTrigger(_VimTest): + files = { 'us/all.snippets': r""" + snippet a "desc" A + autotriggered + endsnippet + """} + keys = 'a' + wanted = 'autotriggered' + + +class Autotrigger_CanMatchContext(_VimTest): + files = { 'us/all.snippets': r""" + snippet a "desc" "snip.line == 2" Ae + autotriggered + endsnippet + """} + keys = 'a\na' + wanted = 'autotriggered\na' From 6c4fb6f3f21f03acf0a93acdb464be87e799d26c Mon Sep 17 00:00:00 2001 From: Stanislav Seletskiy Date: Mon, 20 Jul 2015 18:03:09 +0600 Subject: [PATCH 05/13] fix b->b2 case, fix merge --- plugin/UltiSnips.vim | 6 ++++++ pythonx/UltiSnips/snippet_manager.py | 13 ++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/plugin/UltiSnips.vim b/plugin/UltiSnips.vim index a32b018..f7be308 100644 --- a/plugin/UltiSnips.vim +++ b/plugin/UltiSnips.vim @@ -46,6 +46,12 @@ command! -bang -nargs=? -complete=customlist,UltiSnips#FileTypeComplete UltiSnip command! -nargs=1 UltiSnipsAddFiletypes :call UltiSnips#AddFiletypes() +augroup UltiSnips_AutoTrigger + au! + au InsertCharPre * call UltiSnips#TrackChange() + au TextChangedI * call UltiSnips#TrackChange() +augroup END + call UltiSnips#map_keys#MapKeys() " vim: ts=8 sts=4 sw=4 diff --git a/pythonx/UltiSnips/snippet_manager.py b/pythonx/UltiSnips/snippet_manager.py index 2313bbd..4995f2b 100644 --- a/pythonx/UltiSnips/snippet_manager.py +++ b/pythonx/UltiSnips/snippet_manager.py @@ -365,8 +365,6 @@ class SnippetManager(object): _vim.command('autocmd!') _vim.command('autocmd CursorMovedI * call UltiSnips#CursorMoved()') _vim.command('autocmd CursorMoved * call UltiSnips#CursorMoved()') - _vim.command('autocmd InsertCharPre * call UltiSnips#TrackChange()') - _vim.command('autocmd TextChangedI * call UltiSnips#TrackChange()') _vim.command( 'autocmd InsertLeave * call UltiSnips#LeavingInsertMode()') @@ -779,11 +777,12 @@ class SnippetManager(object): @err_to_scratch_buffer def _track_change(self): inserted_char = _vim.eval('v:char') - if inserted_char == '': - before = _vim.buf.line_till_cursor - if before and before[-1] == self._last_inserted_char: - self._try_expand(autotrigger_only=True) - else: + try: + if inserted_char == '': + before = _vim.buf.line_till_cursor + if before and before[-1] == self._last_inserted_char: + self._try_expand(autotrigger_only=True) + finally: self._last_inserted_char = inserted_char From 8ff84758a7b097b0da56cdccd7195d1670810f1f Mon Sep 17 00:00:00 2001 From: Stanislav Seletskiy Date: Wed, 12 Aug 2015 17:06:56 +0600 Subject: [PATCH 06/13] fix tests Autotrigger is not supported for old versions of vim. --- test/test_Autotrigger.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/test_Autotrigger.py b/test/test_Autotrigger.py index 92b6a07..171cd22 100644 --- a/test/test_Autotrigger.py +++ b/test/test_Autotrigger.py @@ -1,8 +1,22 @@ from test.vim_test_case import VimTestCase as _VimTest from test.constant import * +import subprocess + + +def has_patch(version, executable): + output = subprocess.check_output([executable, "--version"]) + for line in output.split("\n"): + if line.startswith("Included patches:"): + patch = line.split('-')[1] + + return int(patch) >= version + class Autotrigger_CanMatchSimpleTrigger(_VimTest): + skip_if = lambda self: 'Vim newer than 7.4.214 is required' if \ + not has_patch(214, self.vim._vim_executable) \ + else None files = { 'us/all.snippets': r""" snippet a "desc" A autotriggered @@ -13,6 +27,9 @@ class Autotrigger_CanMatchSimpleTrigger(_VimTest): class Autotrigger_CanMatchContext(_VimTest): + skip_if = lambda self: 'Vim newer than 7.4.214 is required' if \ + not has_patch(214, self.vim._vim_executable) \ + else None files = { 'us/all.snippets': r""" snippet a "desc" "snip.line == 2" Ae autotriggered From 878f79ffda2ba9d563a347531af26febfbad7590 Mon Sep 17 00:00:00 2001 From: Stanislav Seletskiy Date: Wed, 12 Aug 2015 17:22:15 +0600 Subject: [PATCH 07/13] review fixes --- doc/UltiSnips.txt | 8 +++++-- pythonx/UltiSnips/snippet/source/_base.py | 3 ++- test/test_Autotrigger.py | 26 +++++++++++++++++------ 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/doc/UltiSnips.txt b/doc/UltiSnips.txt index 62524ea..fc3ab06 100644 --- a/doc/UltiSnips.txt +++ b/doc/UltiSnips.txt @@ -1606,7 +1606,7 @@ endsnippet 4.11 Autotrigger *UltiSnips-autotrigger* ---------------- -Many language constructions can occur only at specific places, so it's +Many language constructs can occur only at specific places, so it's possible to use snippets without manually triggering them. Snippet can be marked as autotriggered by specifying 'A' option in the snippet @@ -1616,6 +1616,9 @@ After snippet is defined as being autotriggered, snippet condition will be checked on every typed character and if condition matches, then snippet will be triggered. +*Warning:* using of this feature can lead to significant vim slowdown. If you +discovered that, report an issue to the github.com/SirVer/UltiSnips. + Consider following snippets, that can be usefull in Go programming: ------------------- SNIP ------------------- snippet "^p" "package" rbA @@ -1630,7 +1633,8 @@ endsnippet ------------------- SNAP ------------------- When "p" character will occur in the beginning of the line, it will be -automatically expanded into "package main". Same with "m" character. +automatically expanded into "package main". Same with "m" character. There is +no need to press trigger key after "m". ============================================================================== 5. UltiSnips and Other Plugins *UltiSnips-other-plugins* diff --git a/pythonx/UltiSnips/snippet/source/_base.py b/pythonx/UltiSnips/snippet/source/_base.py index 50a68fc..3ffe2b3 100644 --- a/pythonx/UltiSnips/snippet/source/_base.py +++ b/pythonx/UltiSnips/snippet/source/_base.py @@ -40,7 +40,8 @@ class SnippetSource(object): result = [] for ft in self._get_existing_deep_extends(filetypes): snips = self._snippets[ft] - result.extend(snips.get_matching_snippets(before, possible, autotrigger_only)) + result.extend(snips.get_matching_snippets(before, possible, + autotrigger_only)) return result def get_clear_priority(self, filetypes): diff --git a/test/test_Autotrigger.py b/test/test_Autotrigger.py index 171cd22..33549f1 100644 --- a/test/test_Autotrigger.py +++ b/test/test_Autotrigger.py @@ -13,10 +13,15 @@ def has_patch(version, executable): return int(patch) >= version +def check_required_vim_version(test): + if not has_patch(214, test.vim._vim_executable): + return 'Vim newer than 7.4.214 is required' + else: + return None + + class Autotrigger_CanMatchSimpleTrigger(_VimTest): - skip_if = lambda self: 'Vim newer than 7.4.214 is required' if \ - not has_patch(214, self.vim._vim_executable) \ - else None + skip_if = check_required_vim_version files = { 'us/all.snippets': r""" snippet a "desc" A autotriggered @@ -27,9 +32,7 @@ class Autotrigger_CanMatchSimpleTrigger(_VimTest): class Autotrigger_CanMatchContext(_VimTest): - skip_if = lambda self: 'Vim newer than 7.4.214 is required' if \ - not has_patch(214, self.vim._vim_executable) \ - else None + skip_if = check_required_vim_version files = { 'us/all.snippets': r""" snippet a "desc" "snip.line == 2" Ae autotriggered @@ -37,3 +40,14 @@ class Autotrigger_CanMatchContext(_VimTest): """} keys = 'a\na' wanted = 'autotriggered\na' + + +class Autotrigger_CanExpandOnTriggerWithLengthMoreThanOne(_VimTest): + skip_if = check_required_vim_version + files = { 'us/all.snippets': r""" + snippet abc "desc" A + autotriggered + endsnippet + """} + keys = 'abc' + wanted = 'autotriggered' From 61e06bbc18b027e23e960d50fdc96c77130a4a34 Mon Sep 17 00:00:00 2001 From: Stanislav Seletskiy Date: Wed, 12 Aug 2015 17:35:24 +0600 Subject: [PATCH 08/13] add note about version and fix tests --- doc/UltiSnips.txt | 4 +++- test/test_Autotrigger.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/UltiSnips.txt b/doc/UltiSnips.txt index fc3ab06..2bfd44b 100644 --- a/doc/UltiSnips.txt +++ b/doc/UltiSnips.txt @@ -1606,6 +1606,8 @@ endsnippet 4.11 Autotrigger *UltiSnips-autotrigger* ---------------- +Note: vim should be newer than 7.4.214 to support this feature. + Many language constructs can occur only at specific places, so it's possible to use snippets without manually triggering them. @@ -1634,7 +1636,7 @@ endsnippet When "p" character will occur in the beginning of the line, it will be automatically expanded into "package main". Same with "m" character. There is -no need to press trigger key after "m". +no need to press trigger key after "m"" ============================================================================== 5. UltiSnips and Other Plugins *UltiSnips-other-plugins* diff --git a/test/test_Autotrigger.py b/test/test_Autotrigger.py index 33549f1..3089073 100644 --- a/test/test_Autotrigger.py +++ b/test/test_Autotrigger.py @@ -6,6 +6,7 @@ import subprocess def has_patch(version, executable): output = subprocess.check_output([executable, "--version"]) + patch = 1 for line in output.split("\n"): if line.startswith("Included patches:"): patch = line.split('-')[1] From a994e3286de525430ff56f6440356980be5c372a Mon Sep 17 00:00:00 2001 From: Stanislav Seletskiy Date: Wed, 12 Aug 2015 18:40:17 +0600 Subject: [PATCH 09/13] fix py3 tests --- test/test_Autotrigger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_Autotrigger.py b/test/test_Autotrigger.py index 3089073..c23b478 100644 --- a/test/test_Autotrigger.py +++ b/test/test_Autotrigger.py @@ -7,7 +7,7 @@ import subprocess def has_patch(version, executable): output = subprocess.check_output([executable, "--version"]) patch = 1 - for line in output.split("\n"): + for line in output.decode('utf-8').split("\n"): if line.startswith("Included patches:"): patch = line.split('-')[1] From 5a5de07349eeb715f7b771ca4e9b7ca9674430b2 Mon Sep 17 00:00:00 2001 From: Stanislav Seletskiy Date: Wed, 12 Aug 2015 19:15:06 +0600 Subject: [PATCH 10/13] neovim tests --- test/test_Autotrigger.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/test_Autotrigger.py b/test/test_Autotrigger.py index c23b478..51b85c4 100644 --- a/test/test_Autotrigger.py +++ b/test/test_Autotrigger.py @@ -15,6 +15,8 @@ def has_patch(version, executable): def check_required_vim_version(test): + if test.vim_flavor == 'neovim': + return None if not has_patch(214, test.vim._vim_executable): return 'Vim newer than 7.4.214 is required' else: From 9eb2de6c34a114524d2328d9f4d7db8284dc0e82 Mon Sep 17 00:00:00 2001 From: Stanislav Seletskiy Date: Thu, 13 Aug 2015 12:01:11 +0600 Subject: [PATCH 11/13] add test for vim<7.4.214 --- test/test_Autotrigger.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/test_Autotrigger.py b/test/test_Autotrigger.py index 51b85c4..86a1e2b 100644 --- a/test/test_Autotrigger.py +++ b/test/test_Autotrigger.py @@ -54,3 +54,16 @@ class Autotrigger_CanExpandOnTriggerWithLengthMoreThanOne(_VimTest): """} keys = 'abc' wanted = 'autotriggered' + + +class Autotrigger_WillProduceNoExceptionWithVimLowerThan214(_VimTest): + skip_if = lambda self: 'Vim older than 7.4.214 is required' \ + if has_patch(214, self.vim._vim_executable) else None + + files = { 'us/all.snippets': r""" + snippet abc "desc" A + autotriggered + endsnippet + """} + keys = 'abc' + wanted = 'abc' From c45867be5830f375bda9bcbccca4ecc1a713a084 Mon Sep 17 00:00:00 2001 From: Stanislav Seletskiy Date: Thu, 13 Aug 2015 12:43:30 +0600 Subject: [PATCH 12/13] add missing doc for autotrigger_only --- pythonx/UltiSnips/snippet/source/_snippet_dictionary.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pythonx/UltiSnips/snippet/source/_snippet_dictionary.py b/pythonx/UltiSnips/snippet/source/_snippet_dictionary.py index e334ac6..c0bb606 100644 --- a/pythonx/UltiSnips/snippet/source/_snippet_dictionary.py +++ b/pythonx/UltiSnips/snippet/source/_snippet_dictionary.py @@ -21,6 +21,13 @@ class SnippetDictionary(object): If 'potentially' is true, returns all that could_match(). + If 'autotrigger_only' is true, function will return only snippets which + are marked with flag 'A' (should be automatically expanded without + trigger key press). + It's handled specially to avoid walking down the list of all snippets, + which can be very slow, because function will be called on each change + made in insert mode. + """ all_snippets = self._snippets if autotrigger_only: From 8c7ce882778a472c64972b1770f2e1716bf664af Mon Sep 17 00:00:00 2001 From: Holger Rapp Date: Mon, 17 Aug 2015 08:30:55 +0200 Subject: [PATCH 13/13] Allow neovim to fail for the moment. It is flaky on travis. --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.travis.yml b/.travis.yml index 6081ac7..bbb52e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,12 @@ env: - VIM_VERSION="mercurial" - VIM_VERSION="NEOVIM" +matrix: + allow_failures: + env: + - VIM_="NEOVIM" + + install: # Some of these commands fail transiently. We keep retrying them until they succeed. - until sudo add-apt-repository ppa:kalakris/tmux -y; do sleep 10; done