lsp#complete omnifunc isn't triggered
Opened this issue · 3 comments
Omnifunc completion works very nicely with the css completer:
let g:completor_css_omni_trigger = '([\w-]+|@[\w-]*|[\w-]+:\s*[\w-]*)$'
I would love to use the omnifunc completer from prabirshrestha/vim-lsp, however, It is not listing matches.
My configuration is similar to the css completion, I tried it with bash-language-server.
set omnifunc=lsp#complete
let g:completor_sh_omni_trigger = '(\w*)$'
The debug log shows that - supposedly - the omnifunc is called:
2020-02-23 08:45:50,912 [INFO][.../completor.vim/pythonx/completers/common/omni.py] omnifunc: b'lsp#complete'
2020-02-23 08:45:50,913 [INFO][.../completor.vim/pythonx/completers/common/omni.py] start: 9,0
If I press i_Ctrl-X_Ctrl_O
, the completion popup appears, the omnifunc is working.
I understand that completor itself could be configured to use LSP directly, however, vim-lsp (with mattn/vim-lsp-settings) is a super nice and scalable solution to maintain LSP enginges easily.
I could also use the suggested prabirshrestha/asyncomplete.vim and prabirshrestha/asyncomplete-lsp.vim async engines, however completor gives a more configurable and nicer representation, and better configurability for triggers etc.
Maybe the sh
shell example wasn't the best. The original reason I started fiddling with it is the json/yaml schema completion.
vim-lsp can be configured for example like below, and omnicompletion works perfectly with the selected schema (when I open a package.json
file then then dictionary keys are completed from the json schema on schemastore.
let g:lsp_settings = {
\ 'json-languageserver': {
\ 'workspace_config': {
\ 'json': {
\ 'schemas': [
\ {
\ 'url': 'http://json.schemastore.org/package',
\ 'fileMatch': ['package.json'],
\ },
\ ],
\ 'format': {
\ 'enable': v:true,
\ }
\ },
\ },
\ },
With completor, this configuration is never passed - obviously - to the languages server (is there a way to do that?).
Note: for the json example it can be worked around by specifying
"$shcema"
as the first key, but that doesn't work with yamls, completion returned using$1
placeholders are not correctly interpreted
With completor, this configuration is never passed - obviously - to the languages server (is there a way to do that?).
Looking for a way to pass configurations to LSP servers as well, any workarounds?
Update completor to the latest and the LSP workspace configuration can be set using the following settings:
let g:completor_filetype_map = {}
let g:completor_filetype_map.json = {
\ 'ft': 'lsp',
\ 'cmd': 'vscode-json-languageserver --stdio',
\ 'insertText': 'label',
\ 'config': {
\ 'json': {
\ 'format': { 'enable': v:false },
\ 'schemas': [
\ {'fileMatch': ['package.json'], 'url': 'http://json.schemastore.org/package'},
\ ]
\ }
\ }
\ }