Skip to content

Instantly share code, notes, and snippets.

@mhartington
Created May 11, 2016 00:52
Show Gist options
  • Save mhartington/b6743be10e71dfd3f1b1053c28644fdd to your computer and use it in GitHub Desktop.
Save mhartington/b6743be10e71dfd3f1b1053c28644fdd to your computer and use it in GitHub Desktop.
import deoplete.util
import deoplete.logger
import logging
from subprocess import Popen, PIPE
import json
from .base import Base
class Source(Base):
def __init__(self, vim):
Base.__init__(self, vim)
self.rank = 600
self.name = 'typescript'
self.mark = '[TS]'
self.min_pattern_length = 0
self.filetypes = ['typescript']
def get_complete_position(self, context):
pos = context['input'].rfind('.')
return pos if pos < 0 else pos + 1
def gather_candidates(self, context):
# line = str(self.vim.current.window.cursor[0])
# column = str(self.vim.current.window.cursor[1] + 1)
# command = ['tsserver']
# buf = '\n'.join(self.vim.current.buffer[:])
# deoplete.util.debug(self.vim, line)
# deoplete.util.debug(self.vim, column)
# deoplete.util.debug(self.vim, buf)
return
# process = Popen(command, stdout=PIPE, stdin=PIPE)
# command_results = process.communicate(input=str.encode(buf))[0]
#
# if process.returncode != 0:
# return []
#
# results = json.loads(command_results.decode('utf-8'))
#
# return [{'word': x['name'], 'kind': x['type']} for x in results['result']]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment