diff options
author | Shougo Matsushita <Shougo.Matsu@gmail.com> | 2019-08-21 22:17:09 +0900 |
---|---|---|
committer | Shougo Matsushita <Shougo.Matsu@gmail.com> | 2019-08-21 22:17:09 +0900 |
commit | 6f6132cf168c2d14ab63ba497e42c49b28c43694 (patch) | |
tree | 885d29ba4e1983760ad966fb6d0b6cfed4b0597b /rplugin | |
parent | f40e43d20e5e48b6b1cb566c00806ef215f8a113 (diff) | |
download | deoplete.nvim-6f6132cf168c2d14ab63ba497e42c49b28c43694.zip |
Improve converter_remove_overlap behaviour
Diffstat (limited to 'rplugin')
-rw-r--r-- | rplugin/python3/deoplete/filter/converter_remove_overlap.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/rplugin/python3/deoplete/filter/converter_remove_overlap.py b/rplugin/python3/deoplete/filter/converter_remove_overlap.py index 459607a..c3f1893 100644 --- a/rplugin/python3/deoplete/filter/converter_remove_overlap.py +++ b/rplugin/python3/deoplete/filter/converter_remove_overlap.py @@ -24,13 +24,19 @@ class Filter(Base): if not m: return context['candidates'] # type: ignore next_input = m.group(0) - for [overlap, candidate] in [ - [x, y] for x, y + check_paren1 = self.vim.call('searchpair', '(', '', ')', 'bnw') + check_paren2 = self.vim.call('searchpair', '[', '', ']', 'bnw') + for [overlap, candidate, word] in [ + [x, y, y['word']] for x, y in [[overlap_length(x['word'], next_input), x] for x in context['candidates']] if x > 0]: + if check_paren1 and ')' in word[-overlap:]: + continue + if check_paren2 and ']' in word[-overlap:]: + continue if 'abbr' not in candidate: - candidate['abbr'] = candidate['word'] - candidate['word'] = candidate['word'][: -overlap] + candidate['abbr'] = word + candidate['word'] = word[: -overlap] return context['candidates'] # type: ignore |