diff options
| author | Gian12315 <giancarlo.cytro@gmail.com> | 2020-11-21 21:27:55 -0600 |
|---|---|---|
| committer | Gian12315 <giancarlo.cytro@gmail.com> | 2020-11-21 21:27:55 -0600 |
| commit | 0bdefd4b56c1c66c7316c67972e3406162c6f5e9 (patch) | |
| tree | cddebcc479628b9e540e5347517ced90cf3a8aa6 /lua/lspconfig/texlab.lua | |
| parent | Merge pull request #405 from mjlbach/feature/specify-unzip-dependency (diff) | |
| download | nvim-lspconfig-0bdefd4b56c1c66c7316c67972e3406162c6f5e9.tar nvim-lspconfig-0bdefd4b56c1c66c7316c67972e3406162c6f5e9.tar.gz nvim-lspconfig-0bdefd4b56c1c66c7316c67972e3406162c6f5e9.tar.bz2 nvim-lspconfig-0bdefd4b56c1c66c7316c67972e3406162c6f5e9.tar.lz nvim-lspconfig-0bdefd4b56c1c66c7316c67972e3406162c6f5e9.tar.xz nvim-lspconfig-0bdefd4b56c1c66c7316c67972e3406162c6f5e9.tar.zst nvim-lspconfig-0bdefd4b56c1c66c7316c67972e3406162c6f5e9.zip | |
Tring to implement forward search
Diffstat (limited to 'lua/lspconfig/texlab.lua')
| -rw-r--r-- | lua/lspconfig/texlab.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lua/lspconfig/texlab.lua b/lua/lspconfig/texlab.lua index b6e08927..1a31285d 100644 --- a/lua/lspconfig/texlab.lua +++ b/lua/lspconfig/texlab.lua @@ -9,6 +9,13 @@ local texlab_build_status = vim.tbl_add_reverse_lookup { Cancelled = 3; } +local texlab_forward_status = vim.tbl_add_reverse_lookup { + Success = 0; + Error = 1; + Failure = 2; + Unconfigured = 3; +} + local function buf_build(bufnr) bufnr = util.validate_bufnr(bufnr) local params = { textDocument = { uri = vim.uri_from_bufnr(bufnr) } } @@ -19,6 +26,16 @@ local function buf_build(bufnr) end) end +local function buf_search(bufnr) + bufnr = util.validate_bufnr(bufnr) + local params = { textDocument = { uri = vim.uri_from_bufnr(bufnr) }, position = { line = 10, character = 10 } + lsp.buf_request(bufnr, 'textDocument/forwardSearch', params, + function(err, _, result, _) + if err then error(tostring(err)) end + print("Search "..texlab_build_status[result.status]) + end) +end + -- bufnr isn't actually required here, but we need a valid buffer in order to -- be able to find the client for buf_request. -- TODO find a client by looking through buffers for a valid client? @@ -66,6 +83,12 @@ configs.texlab = { end; description = "Build the current buffer"; }; + TexlabForward = { + function() + buf_search(0) + end; + description = "Forward search current position"; + } }; docs = { description = [[ |
