Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*DO NOT MERGE* sample snippet support #247

Closed
wants to merge 1 commit into from
Closed

Conversation

prabirshrestha
Copy link
Owner

Do not merge. This is me trying out how we can support snippets in vim-lsp.
This is using https://github.com/andreyorst/SimpleSnippets-snippets but we should allow anyone to hook into vim-lsp so they can easily use any snippet plugins they use.

Plug 'andreyorst/SimpleSnippets.vim'
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/vim-lsp'
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/asyncomplete-lsp.vim'

autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif
let g:asyncomplete_auto_popup = 1

let g:SimpleSnippets_dont_remap_tab = 1
inoremap <silent><expr><Tab> pumvisible() ? "\<c-n>" :
    \SimpleSnippets#isExpandableOrJumpable() ?
    \"<Esc>:call SimpleSnippets#expandOrJump()<Cr>" :
    \"\<Tab>"
inoremap <silent><expr><S-Tab> pumvisible() ? "\<c-p>" :
    \SimpleSnippets#isJumpable() ?
    \"<Esc>:call SimpleSnippets#jumpBackwards()<Cr>" :
    \"\<S-Tab>"
inoremap <silent><expr><Cr> pumvisible() ?
    \SimpleSnippets#isExpandableOrJumpable() ?
    \"\<Esc>:call SimpleSnippets#expandOrJump()\<Cr>" :
    \"\<Cr>" : "\<Cr>"
snoremap <silent><expr><Tab> SimpleSnippets#isExpandableOrJumpable() ?
    \"<Esc>:call SimpleSnippets#expandOrJump()<Cr>" : "\<Tab>"
snoremap <silent><expr><S-Tab> SimpleSnippets#isJumpable() ?
    \"<Esc>:call SimpleSnippets#jumpBackwards()<Cr>" :
    \"\<S-Tab>"

if executable('cquery')
  au User lsp_setup call lsp#register_server({
    \ 'name': 'cquery',
    \ 'cmd': {server_info->['cquery']},
    \ 'root_uri': {server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'compile_commands.json'))},
    \ 'initialization_options': { 'cacheDirectory':  '/tmp/cquery' },
    \ 'whitelist': ['c', 'cpp', 'objc', 'objcpp'],
    \ })
endif

@prabirshrestha prabirshrestha changed the title sample snippet support *DO NOT MERGE* sample snippet support Jan 15, 2019
@prabirshrestha
Copy link
Owner Author

Seems like SimpleSnippets is no longer supported. Might be need to try a different snippet plugin that supports LSP spec.

@prabirshrestha
Copy link
Owner Author

Closing in favor of #306

@prabirshrestha prabirshrestha deleted the snippets branch March 2, 2019 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant