diff options
Diffstat (limited to 'lua/lspconfig/texlab.lua')
| -rw-r--r-- | lua/lspconfig/texlab.lua | 125 |
1 files changed, 65 insertions, 60 deletions
diff --git a/lua/lspconfig/texlab.lua b/lua/lspconfig/texlab.lua index 6f47ca0a..02bd8419 100644 --- a/lua/lspconfig/texlab.lua +++ b/lua/lspconfig/texlab.lua @@ -1,39 +1,44 @@ -local configs = require 'lspconfig/configs' -local util = require 'lspconfig/util' +local configs = require "lspconfig/configs" +local util = require "lspconfig/util" local lsp = vim.lsp local texlab_build_status = vim.tbl_add_reverse_lookup { - Success = 0; - Error = 1; - Failure = 2; - Cancelled = 3; + Success = 0, + Error = 1, + Failure = 2, + Cancelled = 3, } local texlab_forward_status = vim.tbl_add_reverse_lookup { - Success = 0; - Error = 1; - Failure = 2; - Unconfigured = 3; + 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) } } - lsp.buf_request(bufnr, 'textDocument/build', params, - function(err, _, result, _) - if err then error(tostring(err)) end - print("Build "..texlab_build_status[result.status]) - end) + local params = { textDocument = { uri = vim.uri_from_bufnr(bufnr) } } + lsp.buf_request(bufnr, "textDocument/build", params, function(err, _, result, _) + if err then + error(tostring(err)) + end + print("Build " .. texlab_build_status[result.status]) + end) end local function buf_search(bufnr) bufnr = util.validate_bufnr(bufnr) - local params = { textDocument = { uri = vim.uri_from_bufnr(bufnr) }, position = { line = vim.fn.line('.')-1, character = vim.fn.col('.') }} - lsp.buf_request(bufnr, 'textDocument/forwardSearch', params, - function(err, _, result, _) - if err then error(tostring(err)) end - print("Search "..texlab_forward_status[result.status]) - end) + local params = { + textDocument = { uri = vim.uri_from_bufnr(bufnr) }, + position = { line = vim.fn.line "." - 1, character = vim.fn.col "." }, + } + lsp.buf_request(bufnr, "textDocument/forwardSearch", params, function(err, _, result, _) + if err then + error(tostring(err)) + end + print("Search " .. texlab_forward_status[result.status]) + end) end -- bufnr isn't actually required here, but we need a valid buffer in order to @@ -50,54 +55,54 @@ end configs.texlab = { default_config = { - cmd = {"texlab"}; - filetypes = {"tex", "bib"}; + cmd = { "texlab" }, + filetypes = { "tex", "bib" }, root_dir = function(filename) return util.path.dirname(filename) - end; + end, settings = { texlab = { - rootDirectory = nil; + rootDirectory = nil, build = { - executable = "latexmk"; - args = {"-pdf", "-interaction=nonstopmode", "-synctex=1", "%f"}; - onSave = false; - forwardSearchAfter = false; - }; - auxDirectory = '.'; + executable = "latexmk", + args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" }, + onSave = false, + forwardSearchAfter = false, + }, + auxDirectory = ".", forwardSearch = { - executable = nil; - args = {}; - }; + executable = nil, + args = {}, + }, chktex = { - onOpenAndSave = false; - onEdit = false; - }; - diagnosticsDelay = 300; - latexFormatter = 'latexindent'; + onOpenAndSave = false, + onEdit = false, + }, + diagnosticsDelay = 300, + latexFormatter = "latexindent", latexindent = { - ["local"] = nil; -- local is a reserved keyword - modifyLineBreaks = false; - }; - bibtexFormatter = 'texlab'; - formatterLineLength = 80; - }; - }; - }; + ["local"] = nil, -- local is a reserved keyword + modifyLineBreaks = false, + }, + bibtexFormatter = "texlab", + formatterLineLength = 80, + }, + }, + }, commands = { TexlabBuild = { function() buf_build(0) - end; - description = "Build the current buffer"; - }; + end, + description = "Build the current buffer", + }, TexlabForward = { function() - buf_search(0) - end; - description = "Forward search from current position"; - } - }; + buf_search(0) + end, + description = "Forward search from current position", + }, + }, docs = { description = [[ https://github.com/latex-lsp/texlab @@ -105,11 +110,11 @@ https://github.com/latex-lsp/texlab A completion engine built from scratch for (La)TeX. See https://github.com/latex-lsp/texlab/blob/master/docs/options.md for configuration options. -]]; +]], default_config = { - root_dir = "vim's starting directory"; - }; - }; + root_dir = "vim's starting directory", + }, + }, } configs.texlab.buf_build = buf_build |
