summaryrefslogtreecommitdiff
path: root/rplugin/python3/deoplete/util.py
diff options
context:
space:
mode:
authorShougo Matsushita <Shougo.Matsu@gmail.com>2016-02-18 06:31:42 +0900
committerShougo Matsushita <Shougo.Matsu@gmail.com>2016-02-18 06:31:42 +0900
commitb8206e908435aa44aa574a226bfe06cef8e9d028 (patch)
tree94c151789c65d1e26e5842253eb08f18dfc6e75e /rplugin/python3/deoplete/util.py
parentd1247ab46abb0553a32f04faf730f95822319eb9 (diff)
downloaddeoplete.nvim-b8206e908435aa44aa574a226bfe06cef8e9d028.zip
Fix #179 dictionary and tag source errors
Diffstat (limited to 'rplugin/python3/deoplete/util.py')
-rw-r--r--rplugin/python3/deoplete/util.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/rplugin/python3/deoplete/util.py b/rplugin/python3/deoplete/util.py
index c52d273..4aa47a2 100644
--- a/rplugin/python3/deoplete/util.py
+++ b/rplugin/python3/deoplete/util.py
@@ -23,7 +23,10 @@
# }}}
# ============================================================================
+import re
import json
+import functools
+import operator
def get_buffer_config(vim, filetype, buffer_var, user_var, default_var):
@@ -85,3 +88,13 @@ def get_custom(vim, source_name):
def get_syn_name(vim):
return vim.call('deoplete#util#get_syn_name')
+
+
+def parse_file_pattern(f, pattern):
+ lines = f.readlines()
+ if not lines:
+ return []
+ p = re.compile(pattern)
+ return list(set(functools.reduce(operator.add, [
+ p.findall(x) for x in lines
+ ])))