aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-lsp-installer/server.lua11
-rw-r--r--lua/nvim-lsp-installer/servers/eslintls/init.lua72
2 files changed, 45 insertions, 38 deletions
diff --git a/lua/nvim-lsp-installer/server.lua b/lua/nvim-lsp-installer/server.lua
index 2e1a477c..d707d141 100644
--- a/lua/nvim-lsp-installer/server.lua
+++ b/lua/nvim-lsp-installer/server.lua
@@ -52,9 +52,14 @@ function M.Server:setup(opts)
-- We require the lspconfig server here in order to do it as late as possible.
-- The reason for this is because once a lspconfig server has been imported, it's
-- automatically registered with lspconfig and causes it to show up in :LspInfo and whatnot.
- require("lspconfig")[self.name].setup(vim.tbl_deep_extend("force", self._default_options, opts or {}))
- if self._post_setup then
- self._post_setup()
+ local lsp_server = require("lspconfig")[self.name]
+ if lsp_server then
+ lsp_server.setup(vim.tbl_deep_extend("force", self._default_options, opts or {}))
+ if self._post_setup then
+ self._post_setup()
+ end
+ else
+ error(("Unable to setup server %q: Could not find lspconfig server entry."):format(self.name))
end
end
diff --git a/lua/nvim-lsp-installer/servers/eslintls/init.lua b/lua/nvim-lsp-installer/servers/eslintls/init.lua
index 1d0c874b..84051304 100644
--- a/lua/nvim-lsp-installer/servers/eslintls/init.lua
+++ b/lua/nvim-lsp-installer/servers/eslintls/init.lua
@@ -20,45 +20,47 @@ return server.Server:new {
local lspconfig = require "lspconfig"
local configs = require "lspconfig/configs"
- configs.eslintls = {
- default_config = {
- filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact" },
- root_dir = lspconfig.util.root_pattern(".eslintrc*", "package.json", ".git"),
- -- Refer to https://github.com/Microsoft/vscode-eslint#settings-options for documentation.
- settings = {
- validate = "on",
- run = "onType",
- codeAction = {
- disableRuleComment = {
- enable = true,
- -- "sameLine" might not work as expected, see https://github.com/williamboman/nvim-lsp-installer/issues/4
- location = "separateLine",
+ if not configs.eslintls then
+ configs.eslintls = {
+ default_config = {
+ filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact" },
+ root_dir = lspconfig.util.root_pattern(".eslintrc*", "package.json", ".git"),
+ -- Refer to https://github.com/Microsoft/vscode-eslint#settings-options for documentation.
+ settings = {
+ validate = "on",
+ run = "onType",
+ codeAction = {
+ disableRuleComment = {
+ enable = true,
+ -- "sameLine" might not work as expected, see https://github.com/williamboman/nvim-lsp-installer/issues/4
+ location = "separateLine",
+ },
+ showDocumentation = {
+ enable = true,
+ },
},
- showDocumentation = {
- enable = true,
+ rulesCustomizations = {},
+ -- Automatically determine working directory by locating .eslintrc config files.
+ --
+ -- It's recommended not to change this.
+ workingDirectory = { mode = "auto" },
+ -- If nodePath is a non-null/undefined value the eslint LSP runs into runtime exceptions.
+ --
+ -- It's recommended not to change this.
+ nodePath = "",
+ -- The "workspaceFolder" is a VSCode concept. We set it to the root
+ -- directory to not restrict the LPS server when it traverses the
+ -- file tree when locating a .eslintrc config file.
+ --
+ -- It's recommended not to change this.
+ workspaceFolder = {
+ uri = "/",
+ name = "root",
},
},
- rulesCustomizations = {},
- -- Automatically determine working directory by locating .eslintrc config files.
- --
- -- It's recommended not to change this.
- workingDirectory = { mode = "auto" },
- -- If nodePath is a non-null/undefined value the eslint LSP runs into runtime exceptions.
- --
- -- It's recommended not to change this.
- nodePath = "",
- -- The "workspaceFolder" is a VSCode concept. We set it to the root
- -- directory to not restrict the LPS server when it traverses the
- -- file tree when locating a .eslintrc config file.
- --
- -- It's recommended not to change this.
- workspaceFolder = {
- uri = "/",
- name = "root",
- },
},
- },
- }
+ }
+ end
end,
default_options = {
cmd = { "node", path.concat { root_dir, "server", "out", "eslintServer.js" }, "--stdio" },