Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
127 lines
3.5 KiB
Lua
127 lines
3.5 KiB
Lua
local util = require 'lspconfig.util'
|
|
|
|
local texlab_build_status = vim.tbl_add_reverse_lookup {
|
|
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,
|
|
}
|
|
|
|
local function buf_build(bufnr)
|
|
bufnr = util.validate_bufnr(bufnr)
|
|
local texlab_client = util.get_active_client_by_name(bufnr, 'texlab')
|
|
local params = {
|
|
textDocument = { uri = vim.uri_from_bufnr(bufnr) },
|
|
}
|
|
if texlab_client then
|
|
texlab_client.request('textDocument/build', params, function(err, result)
|
|
if err then
|
|
error(tostring(err))
|
|
end
|
|
print('Build ' .. texlab_build_status[result.status])
|
|
end, bufnr)
|
|
else
|
|
print 'method textDocument/build is not supported by any servers active on the current buffer'
|
|
end
|
|
end
|
|
|
|
local function buf_search(bufnr)
|
|
bufnr = util.validate_bufnr(bufnr)
|
|
local texlab_client = util.get_active_client_by_name(bufnr, 'texlab')
|
|
local params = {
|
|
textDocument = { uri = vim.uri_from_bufnr(bufnr) },
|
|
position = { line = vim.fn.line '.' - 1, character = vim.fn.col '.' },
|
|
}
|
|
if texlab_client then
|
|
texlab_client.request('textDocument/forwardSearch', params, function(err, result)
|
|
if err then
|
|
error(tostring(err))
|
|
end
|
|
print('Search ' .. texlab_forward_status[result.status])
|
|
end, bufnr)
|
|
else
|
|
print 'method textDocument/forwardSearch is not supported by any servers active on the current buffer'
|
|
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?
|
|
-- local function build_cancel_all(bufnr)
|
|
-- bufnr = util.validate_bufnr(bufnr)
|
|
-- local params = { token = "texlab-build-*" }
|
|
-- lsp.buf_request(bufnr, 'window/progress/cancel', params, function(err, method, result, client_id)
|
|
-- if err then error(tostring(err)) end
|
|
-- print("Cancel result", vim.inspect(result))
|
|
-- end)
|
|
-- end
|
|
|
|
return {
|
|
default_config = {
|
|
cmd = { 'texlab' },
|
|
filetypes = { 'tex', 'plaintex', 'bib' },
|
|
root_dir = function(fname)
|
|
return util.root_pattern '.latexmkrc'(fname) or util.find_git_ancestor(fname)
|
|
end,
|
|
single_file_support = true,
|
|
settings = {
|
|
texlab = {
|
|
rootDirectory = nil,
|
|
build = {
|
|
executable = 'latexmk',
|
|
args = { '-pdf', '-interaction=nonstopmode', '-synctex=1', '%f' },
|
|
onSave = false,
|
|
forwardSearchAfter = false,
|
|
},
|
|
auxDirectory = '.',
|
|
forwardSearch = {
|
|
executable = nil,
|
|
args = {},
|
|
},
|
|
chktex = {
|
|
onOpenAndSave = false,
|
|
onEdit = false,
|
|
},
|
|
diagnosticsDelay = 300,
|
|
latexFormatter = 'latexindent',
|
|
latexindent = {
|
|
['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',
|
|
},
|
|
TexlabForward = {
|
|
function()
|
|
buf_search(0)
|
|
end,
|
|
description = 'Forward search from current position',
|
|
},
|
|
},
|
|
docs = {
|
|
description = [[
|
|
https://github.com/latex-lsp/texlab
|
|
|
|
A completion engine built from scratch for (La)TeX.
|
|
|
|
See https://github.com/latex-lsp/texlab/wiki/Configuration for configuration options.
|
|
]],
|
|
},
|
|
}
|