Skip to content
This repository has been archived by the owner on Mar 25, 2020. It is now read-only.

Commit

Permalink
Add some stubs for completion
Browse files Browse the repository at this point in the history
  • Loading branch information
TJ DeVries committed Dec 21, 2016
1 parent f410996 commit c37e5b0
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
38 changes: 38 additions & 0 deletions autoload/langserver/completion.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
function! langserver#completion#callback(id, data, event) abort
let l:parsed_data = langserver#callbacks#data(a:id, a:data, a:event)
if l:parsed_data == {}
return
endif

" {'isIncomplete': bool, 'items': [CompletionItems]}
let l:completion_items = l:parsed_data['items']

endfunction

function! langserver#completion#request(...) abort
return langserver#client#send(langserver#util#get_lsp_id(), {
\ 'method': 'textDocument/completion',
\ 'params': langserver#util#get_text_document_position_params(),
\ })
endfunction

let s:CompletionItemKind = {
\ 'Text': 1,
\ 'Method': 2,
\ 'Function': 3,
\ 'Constructor': 4,
\ 'Field': 5,
\ 'Variable': 6,
\ 'Class': 7,
\ 'Interface': 8,
\ 'Module': 9,
\ 'Property': 10,
\ 'Unit': 11,
\ 'Value': 12,
\ 'Enum': 13,
\ 'Keyword': 14,
\ 'Snippet': 15,
\ 'Color': 16,
\ 'File': 17,
\ 'Reference': 18
\ }
24 changes: 24 additions & 0 deletions rplugin/python3/deoplete/langserver.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from .base import Base


class Source(Base):
def __init__(self, nvim):
super(Source, self).__init__(nvim)

self.nvim = nvim
self.name = langserver
self.mark = '[LSP]'

def on_event(self, context, filename=''):
pass

def gather_candidates(self, context):
user_input = context['input']
filetype = context.get('filetype', '')
complete_str context['complete_str']

return [
{
'word': user_input + '_hello',
}
]

0 comments on commit c37e5b0

Please sign in to comment.