Do not pass filename to UltiSnips#AddSnippet.
This commit is contained in:
parent
2eb82d127b
commit
991609e461
@ -387,11 +387,10 @@ UltiSnips provides some functions for extending core functionality.
|
|||||||
3.5.1 UltiSnips#AddSnippet *UltiSnips#AddSnippet*
|
3.5.1 UltiSnips#AddSnippet *UltiSnips#AddSnippet*
|
||||||
|
|
||||||
The first function is UltiSnips#AddSnippet(trigger, value, description,
|
The first function is UltiSnips#AddSnippet(trigger, value, description,
|
||||||
options, ...). It adds a new snippet with the provided trigger, value,
|
options, filetyp="all"). It adds a new snippet with the provided trigger, value,
|
||||||
description, and options to the current list of snippets. See
|
description, and options to the current list of snippets. See
|
||||||
|UltiSnips-syntax| for details on the meaning of the function arguments. All
|
|UltiSnips-syntax| for details on the meaning of the function arguments. All
|
||||||
arguments are strings. An optional fifth argument can be used to specify the
|
arguments are strings.
|
||||||
filetype for the new snippet.
|
|
||||||
|
|
||||||
|
|
||||||
3.5.2 UltiSnips#Anon *UltiSnips#Anon*
|
3.5.2 UltiSnips#Anon *UltiSnips#Anon*
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
"""Handles manually added snippets (i.e. not in a file)."""
|
"""Handles manually added snippets through UltiSnips#AddSnippet or
|
||||||
|
UltiSnips_Manager.add_snippet()."""
|
||||||
|
|
||||||
from UltiSnips.providers._base import SnippetProvider
|
from UltiSnips.providers._base import SnippetProvider
|
||||||
|
|
||||||
class AddedSnippetsProvider(SnippetProvider):
|
class AddedSnippetsProvider(SnippetProvider):
|
||||||
"""See module docstring."""
|
"""See module docstring."""
|
||||||
|
|
||||||
# TODO(sirver): filename makes no sense here. Is it even used?
|
def add_snippet(self, ft, snippet):
|
||||||
def add_snippet(self, ft, snippet, filename):
|
|
||||||
"""Adds the given 'snippet' for 'ft'."""
|
"""Adds the given 'snippet' for 'ft'."""
|
||||||
self._snippets[ft].add_snippet(snippet, filename)
|
self._snippets[ft].add_snippet(snippet, None)
|
||||||
|
@ -169,10 +169,10 @@ class SnippetManager(object):
|
|||||||
|
|
||||||
@err_to_scratch_buffer
|
@err_to_scratch_buffer
|
||||||
def add_snippet(self, trigger, value, description,
|
def add_snippet(self, trigger, value, description,
|
||||||
options, ft="all", globals=None, fn=None):
|
options, ft="all", globals=None):
|
||||||
"""Add a snippet to the list of known snippets of the given 'ft'."""
|
"""Add a snippet to the list of known snippets of the given 'ft'."""
|
||||||
self._added_snippets_provider.add_snippet(ft, SnippetDefinition(
|
self._added_snippets_provider.add_snippet(ft, SnippetDefinition(
|
||||||
trigger, value, description, options, globals or {}), fn
|
trigger, value, description, options, globals or {})
|
||||||
)
|
)
|
||||||
|
|
||||||
@err_to_scratch_buffer
|
@err_to_scratch_buffer
|
||||||
|
Loading…
Reference in New Issue
Block a user