LTeX_extra
is a plugin for Neovim that provide the functions that are called on LSP code actions by ltex-ls
:
addToDictionary
,
disableRule
,
hideFalsePositive
.
Also, LTeX_extra
provide extra features.
Cover your eyes. In the next demos there are many orthographic horrors. Screencast recorded using my macros tool.
Provide functions for add to dictionary
, disable rules
and hidde false positives
.
Maybe you want mapping the LPS Code Action method.
Check the docs: neovim suggested configuration
01-CodeAction.mp4
Config you path, give you compatibility with official vscode extension.
02-CustomPath.mp4
Autoload exported data for required languages.
03-Autoload.mp4
Reload exported data on demand: require("ltex_extra").reload()
04-Update.mp4
This plugin requires an instance of ltex_ls
language server available to attach.
ltex-ls
is available at mason.nvim
.
Install the plugin with your favorite plugin manager using {"barreiroleo/ltex-extra.nvim"}
.
Then add require("ltex_extra").setup()
to your config in a proper place.
We suggest to you two ways:
-
Call the
setup
fromon_attach
function of your server. Example withlspconfig
, minor changes are required formason
handler:require("lspconfig").ltex.setup { capabilities = your_capabilities, on_attach = function(client, bufnr) -- rest of your on_attach process. require("ltex_extra").setup { your_opts } end, settings = { ltex = { your settings } } }
-
Use the handler which
ltex_extra
provide to call the server. Example of use withlazy.nvim
:return { "barreiroleo/ltex_extra.nvim", ft = { "markdown", "tex" }, dependencies = { "neovim/nvim-lspconfig" }, -- yes, you can use the opts field, just I'm showing the setup explicitly config = function() require("ltex_extra").setup { your_ltex_extra_opts, server_opts = { capabilities = your_capabilities, on_attach = function(client, bufnr) -- your on_attach process end, settings = { ltex = { your settings } } }, } end }
Here are the settings available on ltex_extra
. You don't need explicit define each
one, just modify what you need.
Notes: You can pass to set up only the arguments that you are interested in.
At the moment, if you define stuff in dictionary
, disabledRules
and
hiddenFalsePositives
in your ltex
settings, they haven't backup.
require("ltex_extra").setup {
-- table <string> : languages for witch dictionaries will be loaded, e.g. { "es-AR", "en-US" }
-- https://valentjn.github.io/ltex/supported-languages.html#natural-languages
load_langs = {}, -- en-US as default
-- boolean : whether to load dictionaries on startup
init_check = true,
-- string : relative or absolute path to store dictionaries
-- e.g. subfolder in the project root or the current working directory: ".ltex"
-- e.g. shared files for all projects: vim.fn.expand("~") .. "/.local/share/ltex"
path = "", -- project root or current working directory
-- string : "none", "trace", "debug", "info", "warn", "error", "fatal"
log_level = "none",
-- table : configurations of the ltex language server.
-- Only if you are calling the server from ltex_extra
server_opts = nil
}
Thanks to these people for your time, effort and ideas.
-
Lspsaga:
Some users reported an issue with code actions when called from lspsaga. I'm not using lspsaga, so PR are very welcome.
Screen.Recording.2022-11-13.at.12.49.54.mov
Thanks to @felipejoribeiro for the screenrecording