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 53 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;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
17
flake.lock
17
flake.lock
|
@ -1730,6 +1730,7 @@
|
|||
"touch-gestures-src": "touch-gestures-src",
|
||||
"trash-d-src": "trash-d-src",
|
||||
"vimplugin-easytables-src": "vimplugin-easytables-src",
|
||||
"vimplugin-ts-error-translator-src": "vimplugin-ts-error-translator-src",
|
||||
"wpaperd": "wpaperd",
|
||||
"xresources-theme-src": "xresources-theme-src"
|
||||
}
|
||||
|
@ -2056,6 +2057,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"vimplugin-ts-error-translator-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1712269172,
|
||||
"narHash": "sha256-NJ0qfKvkwZ/0GolAeATlQLyQ7nGN6Z6q3uRqI+73wPk=",
|
||||
"owner": "dmmulroy",
|
||||
"repo": "ts-error-translator.nvim",
|
||||
"rev": "11ae55b28bde02663b5f983f59b0e3fd9c4e845b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "dmmulroy",
|
||||
"repo": "ts-error-translator.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"wpaperd": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
|
|
@ -354,6 +354,13 @@
|
|||
repo = "easytables.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
vimplugin-ts-error-translator-src = {
|
||||
type = "github";
|
||||
owner = "dmmulroy";
|
||||
repo = "ts-error-translator.nvim";
|
||||
flake = false;
|
||||
};
|
||||
#
|
||||
|
||||
# Nix tools
|
||||
|
|
Loading…
Reference in a new issue