-
-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
question: where to put configurations? #28
Comments
in |
hey @iamcco, what I meant was, where do I put this JSON file, do I reference it somewhere in vimrc? I get that |
@thisguychris Where to config |
This lsp config is pretty rough, but should work (thanks @lithammer): nvim_lsp.diagnosticls.setup{
filetypes = { "javascript", "javascript.jsx" },
init_options = {
filetypes = {
javascript = "eslint",
["javascript.jsx"] = "eslint",
javascriptreact = "eslint",
typescriptreact = "eslint",
},
linters = {
eslint = {
sourceName = "eslint",
command = "./node_modules/.bin/eslint",
rootPatterns = { ".git" },
debounce = 100,
args = {
"--stdin",
"--stdin-filename",
"%filepath",
"--format",
"json",
},
parseJson = {
errorsRoot = "[0].messages",
line = "line",
column = "column",
endLine = "endLine",
endColumn = "endColumn",
message = "${message} [${ruleId}]",
security = "severity",
};
securities = {
[2] = "error",
[1] = "warning"
}
}
}
}
} |
You can see my current configuration here: https://github.com/walialu/neovimfiles/blob/e68391c1d98b3da2f8adfe1583f258a17295537b/nvim/lua/lsp_config.lua#L46 |
I'm using neivim's built-in LSP client, and I have a config as follows for checking shell scripts
I have the following plugins installed: Plug 'neovim/nvim-lspconfig'
Plug 'nvim-lua/completion-nvim'
Plug 'nvim-lua/diagnostic-nvim' I open a shell script, nothing happens. Where am I supposed to find the diagnostic information? |
@smartding that config doesn't generate any diagnostics. I assume you want |
Hey @smartding, you need to config shellcheck to check your files. You can look at my configuration over here (this is how I configured shellcheck): |
thank @lithammer @walialu , I figured it out after reading the README in diagnostic-languageserver. Here's my config: require'nvim_lsp'.diagnosticls.setup{
on_attach=on_attach_vim,
filetypes = { "sh", },
init_options = {
filetypes = {
sh = "shellcheck",
},
formatFiletypes = {
sh = "shfmt",
},
formatters = {
shfmt = {
command = "shfmt",
args = {
"-i",
"2",
"-bn",
"-ci",
"-sr",
},
}
},
linters = {
shellcheck = {
command = "shellcheck",
rootPatterns = {},
isStdout = true,
isStderr = false,
debounce = 100,
args = { "--format=gcc", "-"},
offsetLine = 0,
offsetColumn = 0,
sourceName = "shellcheck",
formatLines = 1,
formatPattern = {
"^([^:]+):(\\d+):(\\d+):\\s+([^:]+):\\s+(.*)$",
{
line = 2,
column = 3,
endline = 2,
endColumn = 3,
message = {5},
security = 4
}
},
securities = {
error ="error",
warning = "warning",
note = "info"
},
}
}
}
} |
@smartding Do you know how to show diagnostic messages from formatters like |
@nyngwang |
Hi, Sorry for the naive question. I'm trying to use
neovim
's built-in LSP, and this plugin is in the readme for diagnostic. I was hoping I can use this to enable linting viaeslint
.I do see the configuration, but I'm not sure where to put them? Is there an example repo on how this is setup? Thanks!
The text was updated successfully, but these errors were encountered: