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
|
||||
*/
|
||||
''
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = 'sh',
|
||||
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
||||
});
|
||||
|
|
|
@ -14,10 +14,10 @@ in
|
|||
*/
|
||||
''
|
||||
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',
|
||||
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
||||
});
|
||||
|
|
|
@ -31,7 +31,7 @@ in
|
|||
lua
|
||||
*/
|
||||
''
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = 'java',
|
||||
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
||||
});
|
||||
|
|
|
@ -3,10 +3,17 @@
|
|||
pkgs,
|
||||
lib,
|
||||
stylelint-lsp,
|
||||
vimplugin-ts-error-translator-src,
|
||||
...
|
||||
}: let
|
||||
inherit (config.vars) neovimIde;
|
||||
inherit (pkgs) vimPlugins;
|
||||
|
||||
buildPlugin = pname: src:
|
||||
pkgs.vimUtils.buildVimPlugin {
|
||||
inherit pname src;
|
||||
version = src.shortRev;
|
||||
};
|
||||
in
|
||||
lib.mkIf neovimIde {
|
||||
programs = {
|
||||
|
@ -27,26 +34,34 @@ in
|
|||
lua
|
||||
*/
|
||||
''
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = { 'javascript', 'typescript', 'css', 'scss' },
|
||||
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
||||
});
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = 'html',
|
||||
command = 'setlocal ts=2 sw=2 expandtab',
|
||||
});
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = 'scss',
|
||||
command = 'setlocal iskeyword+=@-@',
|
||||
});
|
||||
|
||||
local lsp = require('lspconfig');
|
||||
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({
|
||||
-- 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 = {
|
||||
stylelintplus = {},
|
||||
},
|
||||
|
@ -81,6 +96,10 @@ in
|
|||
|
||||
plugins = [
|
||||
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