Permalink
Browse files

adapt deoplete source to new COMPX structure

  • Loading branch information...
1 parent b34ca60 commit 65b336226803c8022f30816a05b76407a3b0f98e @lucidstack lucidstack committed Apr 7, 2016
Showing with 13 additions and 3 deletions.
  1. +13 −3 rplugin/python3/deoplete/sources/alchemist.py
@@ -1,4 +1,5 @@
import os
+import re
from numbers import Number
from subprocess import PIPE, Popen
from .base import Base
@@ -15,6 +16,7 @@ def __init__(self, vim):
self.mark = '[alchemist]'
self.filetypes = ['elixir']
self.is_bytepos = False
+ self.re_suggestions = re.compile(r'kind:(?P<kind>.*), word:(?P<word>.*), abbr:(?P<abbr>.*)$')
def get_complete_position(self, context):
return self.vim.call('elixircomplete#Complete', 1, '')
@@ -36,8 +38,16 @@ def __get_client__(self):
return self.vim.eval(self.ALCHEMIST_CLIENT)
def __get_request__(self, input):
- return self.vim.call(self.ALCHEMIST_FORMAT, 'COMP', input, 'Elixir', [], [])
+ return self.vim.call(self.ALCHEMIST_FORMAT, 'COMPX', input, 'Elixir', [], [])
def __get_suggestions__(self, server_results):
- suggestions = self.vim.call(self.ALCHEMIST_COMPLETE, 0, server_results)
- return [] if isinstance(suggestions, Number) else suggestions
+ suggestions = []
+ for result in server_results:
+ matches = self.re_suggestions.match(result)
+ suggestions.append({
+ 'kind': matches.group('kind'),
+ 'word': matches.group('word'),
+ 'abbr': matches.group('abbr')
+ })
+
+ return suggestions

0 comments on commit 65b3362

Please sign in to comment.