feat(nvim): setup ts-error-translator.nvim
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
772374b0fd
commit
9b749922ea
6 changed files with 29 additions and 10 deletions
|
@ -24,7 +24,7 @@ in {
|
||||||
lua
|
lua
|
||||||
*/
|
*/
|
||||||
''
|
''
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
pattern = 'sh',
|
pattern = 'sh',
|
||||||
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,10 +14,10 @@ in
|
||||||
*/
|
*/
|
||||||
''
|
''
|
||||||
vim.filetype.add({
|
vim.filetype.add({
|
||||||
pattern = { [".*/hypr/.*%.conf"] = "hyprlang" },
|
pattern = { ['.*/hypr/.*%.conf'] = 'hyprlang' },
|
||||||
});
|
});
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
pattern = 'hyprlang',
|
pattern = 'hyprlang',
|
||||||
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
||||||
});
|
});
|
||||||
|
|
|
@ -31,7 +31,7 @@ in
|
||||||
lua
|
lua
|
||||||
*/
|
*/
|
||||||
''
|
''
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
pattern = 'java',
|
pattern = 'java',
|
||||||
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,10 +3,17 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
stylelint-lsp,
|
stylelint-lsp,
|
||||||
|
vimplugin-ts-error-translator-src,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (config.vars) neovimIde;
|
inherit (config.vars) neovimIde;
|
||||||
inherit (pkgs) vimPlugins;
|
inherit (pkgs) vimPlugins;
|
||||||
|
|
||||||
|
buildPlugin = pname: src:
|
||||||
|
pkgs.vimUtils.buildVimPlugin {
|
||||||
|
inherit pname src;
|
||||||
|
version = src.shortRev;
|
||||||
|
};
|
||||||
in
|
in
|
||||||
lib.mkIf neovimIde {
|
lib.mkIf neovimIde {
|
||||||
programs = {
|
programs = {
|
||||||
|
@ -27,26 +34,34 @@ in
|
||||||
lua
|
lua
|
||||||
*/
|
*/
|
||||||
''
|
''
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
pattern = { 'javascript', 'typescript', 'css', 'scss' },
|
pattern = { 'javascript', 'typescript', 'css', 'scss' },
|
||||||
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
||||||
});
|
});
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
pattern = 'html',
|
pattern = 'html',
|
||||||
command = 'setlocal ts=2 sw=2 expandtab',
|
command = 'setlocal ts=2 sw=2 expandtab',
|
||||||
});
|
});
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
pattern = 'scss',
|
pattern = 'scss',
|
||||||
command = 'setlocal iskeyword+=@-@',
|
command = 'setlocal iskeyword+=@-@',
|
||||||
});
|
});
|
||||||
|
|
||||||
local lsp = require('lspconfig');
|
local lsp = require('lspconfig');
|
||||||
local coq = require('coq');
|
local coq = require('coq');
|
||||||
local tsserver = require("typescript-tools");
|
local tsserver = require('typescript-tools');
|
||||||
|
|
||||||
tsserver.setup(coq.lsp_ensure_capabilities({}));
|
tsserver.setup(coq.lsp_ensure_capabilities({
|
||||||
|
handlers = {
|
||||||
|
-- format error code with better error message
|
||||||
|
['textDocument/publishDiagnostics'] = function(err, result, ctx, config)
|
||||||
|
require('ts-error-translator').translate_diagnostics(err, result, ctx, config)
|
||||||
|
vim.lsp.diagnostic.on_publish_diagnostics(err, result, ctx, config)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
lsp.eslint.setup(coq.lsp_ensure_capabilities({
|
lsp.eslint.setup(coq.lsp_ensure_capabilities({
|
||||||
-- auto-save
|
-- auto-save
|
||||||
|
@ -72,7 +87,7 @@ in
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
require('lspconfig').stylelint_lsp.setup(coq.lsp_ensure_capabilities({
|
lsp.stylelint_lsp.setup(coq.lsp_ensure_capabilities({
|
||||||
settings = {
|
settings = {
|
||||||
stylelintplus = {},
|
stylelintplus = {},
|
||||||
},
|
},
|
||||||
|
@ -81,6 +96,10 @@ in
|
||||||
|
|
||||||
plugins = [
|
plugins = [
|
||||||
vimPlugins.typescript-tools-nvim
|
vimPlugins.typescript-tools-nvim
|
||||||
|
|
||||||
|
{
|
||||||
|
plugin = buildPlugin "ts-error-translator" vimplugin-ts-error-translator-src;
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
BIN
flake.lock
BIN
flake.lock
Binary file not shown.
BIN
flake.nix
BIN
flake.nix
Binary file not shown.
Loading…
Reference in a new issue