summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rplugin/python3/deoplete/filter/converter_remove_overlap.py14
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