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

default rootUri #274

Closed
mattn opened this issue Feb 1, 2019 · 8 comments
Closed

default rootUri #274

mattn opened this issue Feb 1, 2019 · 8 comments

Comments

@mattn
Copy link
Collaborator

mattn commented Feb 1, 2019

castwide/solargraph#151

rootUr should be able to set null for default behavior.

@mattn mattn added the bug label Feb 1, 2019
@prabirshrestha
Copy link
Owner

Read the spec seems like all version v1,v2 and v3 supports null. We should fix it.

@prabirshrestha
Copy link
Owner

Now that I think of it this case was already supported when I implemented it.

vim-lsp/autoload/lsp.vim

Lines 380 to 392 in e090d84

let l:server_info = l:server['server_info']
if has_key(l:server_info, 'root_uri')
let l:root_uri = l:server_info['root_uri'](l:server_info)
else
let l:root_uri = lsp#utils#get_default_root_uri()
endif
if empty(l:root_uri)
let l:msg = s:new_rpc_error('ignore initialization lsp server due to empty root_uri', { 'server_name': a:server_name, 'lsp_id': l:server['lsp_id'] })
call lsp#log(l:msg)
call a:cb(l:msg)
return
endif

If you provide root_uri as function.

function! s:find_root_uri(server_name) abort
    " add your custom logic here
    " return empty string if you want to vim-lsp to ignore initialization
endfunction

 au User lsp_setup call lsp#register_server({
        \ 'name': 'solargraph',
        \ 'cmd': {server_info->['solargraph']},
        \ 'root_uri': function('s:find_root_uri'),
        \ 'whitelist': ['python'],
        \ })

Does it mean let l:root_uri = lsp#utils#get_default_root_uri() is not a good default instead?

If there was a plugin specific to solargraph, then it is easier for the users then users don't need to do to much. I actually have created org for these sort of plugins. https://github.com/vimlsp. Unforutnately vim-lsp was taken already.

Plug 'vimlsp/solargraph'

@mattn mattn removed the bug label Feb 1, 2019
@mattn
Copy link
Collaborator Author

mattn commented Feb 1, 2019

Cool. Now I sent e-mail to GitHub to ask that we can use vim-lsp if they are not active.

@prabirshrestha
Copy link
Owner

That would be great.

@mattn
Copy link
Collaborator Author

mattn commented Feb 2, 2019

Unfortunately, vim-lsp seems to be active on private repos.

@prabirshrestha
Copy link
Owner

@mattn Did 'root_uri': function('s:find_root_uri'), solve the issue?

@mattn
Copy link
Collaborator Author

mattn commented Feb 9, 2019

I am convinced that it will work, but solargraph still does not go well. Hmm. I tried {x->0}. But i don't try other yet.

@prabirshrestha
Copy link
Owner

Closing for now. I think it should be possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants