summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordelphinus <me@delphinus.dev>2019-06-25 17:57:38 +0900
committerdelphinus <me@delphinus.dev>2019-06-25 18:04:04 +0900
commita3521de64e8dfc2e8dbfc562fbc73502ba3e09ce (patch)
tree560d06bf77e7cecf111acc512c66761475acf572
parent4e1c46947dca552d86cd49a80714237801e01998 (diff)
downloadale-a3521de64e8dfc2e8dbfc562fbc73502ba3e09ce.zip
Use input_patterns & add comments for updating it
-rw-r--r--autoload/ale/completion.vim3
-rw-r--r--rplugin/python3/deoplete/sources/ale.py8
-rw-r--r--test/python/test_deoplete_source.py6
3 files changed, 14 insertions, 3 deletions
diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim
index 284b1e08..f0d6425d 100644
--- a/autoload/ale/completion.vim
+++ b/autoload/ale/completion.vim
@@ -59,7 +59,8 @@ let s:omni_start_map = {
\ '<default>': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$',
\}
-" A map of exact characters for triggering LSP completions.
+" A map of exact characters for triggering LSP completions. Do not forget to
+" update self.input_patterns in ale.py in updating entries in this map.
let s:trigger_character_map = {
\ '<default>': ['.'],
\ 'typescript': ['.', '''', '"'],
diff --git a/rplugin/python3/deoplete/sources/ale.py b/rplugin/python3/deoplete/sources/ale.py
index 653bc4fc..66a09551 100644
--- a/rplugin/python3/deoplete/sources/ale.py
+++ b/rplugin/python3/deoplete/sources/ale.py
@@ -24,7 +24,13 @@ class Source(Base):
self.rank = 1000
self.is_bytepos = True
self.min_pattern_length = 1
- self.input_pattern = r'(\.|::|->)\w*$'
+ # Do not forget to update s:trigger_character_map in completion.vim in
+ # updating entries in this map.
+ self.input_patterns = {
+ '_': r'\.\w*$',
+ 'rust': r'(\.|::)\w*$',
+ 'typescript': r'(\.|\'|")\w*$',
+ }
# Returns an integer for the start position, as with omnifunc.
def get_complete_position(self, context):
diff --git a/test/python/test_deoplete_source.py b/test/python/test_deoplete_source.py
index d219eef1..280df2e3 100644
--- a/test/python/test_deoplete_source.py
+++ b/test/python/test_deoplete_source.py
@@ -41,7 +41,11 @@ class DeopleteSourceTest(unittest.TestCase):
)
self.assertEqual(attributes, {
- 'input_pattern': r'(\.|::|->)\w*$',
+ 'input_patterns': {
+ '_': r'\.\w*$',
+ 'rust': r'(\.|::)\w*$',
+ 'typescript': r'(\.|\'|")\w*$',
+ },
'is_bytepos': True,
'mark': '[L]',
'min_pattern_length': 1,