yegappan / lsp

Language Server Protocol (LSP) plugin for Vim9
MIT License
447 stars 43 forks source link

[Question] is it possible to send requests to the language server? #524

Open saccarosium opened 1 month ago

saccarosium commented 1 month ago

Hi, I'm working on a re-implementation of mattn/vim-lsp-settings and neovim/nvim-lspconfig for this plugin. But I'm not sure how to - or even possible to - send requests to the language server. Something like this:

call lsp#send_request(l:server, {
    \ 'method': 'textDocument/switchSourceHeader',
    \ 'params': {
    \   'uri': lsp#utils#get_buffer_uri(),     
    \ },
    \ 'on_notification': function('s:handle_document_switch_source_header', [l:ctx, l:server, 'header/source', l:has_extension]),
    \ })

or

clangd_client.request('textDocument/switchSourceHeader', params, function(err, result)
      if err then
        error(tostring(err))
      end
      if not result then
        print 'Corresponding file cannot be determined'
        return
      end
      vim.api.nvim_command('edit ' .. vim.uri_to_fname(result))
    end, bufnr)