optional ltex languagetool secret
This commit is contained in:
parent
7a5c8428c9
commit
44bb3db121
|
@ -52,12 +52,7 @@ M.ltex = {
|
|||
"html",
|
||||
"xhtml",
|
||||
},
|
||||
languageToolOrg = {
|
||||
apiKey = require "custom.secret.languagetool_token",
|
||||
username = "accounts@cscherr.de",
|
||||
languageToolHttpServerUrl = "https://api.languagetoolplus.com/v2/",
|
||||
},
|
||||
languageToolHttpServerUrl = "https://api.languagetoolplus.com/v2/",
|
||||
-- load token and additional languagetool items later
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -170,4 +165,17 @@ M.textlsp = {
|
|||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- load secrets
|
||||
-- the secret module should just return a string with the token
|
||||
local available, token = require("custom.utils").try_require "custom.secret.languagetool_token"
|
||||
if available then
|
||||
M.ltex.languageToolOrg = {
|
||||
apiKey = token,
|
||||
username = "accounts@cscherr.de",
|
||||
languageToolHttpServerUrl = "https://api.languagetoolplus.com/v2/",
|
||||
}
|
||||
M.ltex.languageToolHttpServerUrl = "https://api.languagetoolplus.com/v2/"
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -30,38 +30,25 @@ M.treesitter = {
|
|||
|
||||
M.mason = {
|
||||
ensure_installed = {
|
||||
-- general purpose
|
||||
"purpose",
|
||||
|
||||
-- lua stuff
|
||||
"lua-language-server",
|
||||
"stylua",
|
||||
|
||||
-- web dev stuff
|
||||
"css-lsp",
|
||||
"html-lsp",
|
||||
"typescript-language-server",
|
||||
"deno",
|
||||
"prettier",
|
||||
|
||||
-- c/cpp stuff
|
||||
"clangd",
|
||||
"clang-format",
|
||||
"cmake-language-server",
|
||||
|
||||
-- rust
|
||||
"rust-analyzer",
|
||||
"taplo",
|
||||
|
||||
-- python
|
||||
"pyright",
|
||||
|
||||
-- english??
|
||||
-- "write-good",
|
||||
|
||||
-- shell
|
||||
"shellcheck",
|
||||
"bash-language-server",
|
||||
"ltex-ls",
|
||||
"shellcheck",
|
||||
"taplo",
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ M.tokenize_args = function(raw)
|
|||
local in_str = false
|
||||
local str_seek
|
||||
for c in string.gmatch(raw, ".") do -- iterate through all chars
|
||||
if c == ' ' and not in_str then
|
||||
if c == " " and not in_str then
|
||||
if string.len(current) > 0 then
|
||||
table.insert(t, current)
|
||||
current = ""
|
||||
|
@ -50,18 +50,34 @@ end
|
|||
--- @param t any variable
|
||||
--- @return string t_dumped t dumped to string
|
||||
M.dump = function(t)
|
||||
if type(t) == 'table' then
|
||||
local s = '{ '
|
||||
if type(t) == "table" then
|
||||
local s = "{ "
|
||||
for k, v in pairs(t) do
|
||||
if type(k) ~= 'number' then k = '"' .. k .. '"' end
|
||||
if type(k) ~= "number" then
|
||||
k = '"' .. k .. '"'
|
||||
end
|
||||
if k ~= 1 then
|
||||
s = s .. ', '
|
||||
s = s .. ", "
|
||||
end
|
||||
s = s .. '[' .. k .. '] = \'' .. M.dump(v) .. '\''
|
||||
s = s .. "[" .. k .. "] = '" .. M.dump(v) .. "'"
|
||||
end
|
||||
return s .. ' }'
|
||||
return s .. " }"
|
||||
else
|
||||
return tostring(t)
|
||||
end
|
||||
end
|
||||
|
||||
--- Try to require a module
|
||||
--- @param module string module name
|
||||
--- @return boolean available is the module available?
|
||||
--- @return any loaded_module the loaded module if it is available
|
||||
M.try_require = function(module)
|
||||
local available, loaded_module = pcall(require, module)
|
||||
if not available then
|
||||
return available, nil
|
||||
else
|
||||
return available, loaded_module
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
Loading…
Reference in New Issue