summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/lsp/templates.lua
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2021-11-08 23:13:05 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2021-11-08 23:13:05 +0100
commitc9e2adbbc8fd7a5398c8c66d21f0e02dc7b60203 (patch)
tree274263ba15e0197180af8bb681e22c4780d5de05 /.config/nvim/lua/lsp/templates.lua
parente4ea22e223bbd6b4091610c6fa093862cbd32f75 (diff)
Add new lunarvin updates
Diffstat (limited to '.config/nvim/lua/lsp/templates.lua')
-rw-r--r--.config/nvim/lua/lsp/templates.lua41
1 files changed, 8 insertions, 33 deletions
diff --git a/.config/nvim/lua/lsp/templates.lua b/.config/nvim/lua/lsp/templates.lua
index 2cce567..084c1f9 100644
--- a/.config/nvim/lua/lsp/templates.lua
+++ b/.config/nvim/lua/lsp/templates.lua
@@ -2,7 +2,7 @@ local M = {}
local Log = require "core.log"
local utils = require "utils"
-local get_supported_filetypes = require("lsp.utils").get_supported_filetypes
+local lsp_utils = require "lsp.utils"
local ftplugin_dir = options.lsp.templates_dir
@@ -15,48 +15,23 @@ function M.remove_template_files()
end
end
----Checks if a server is ignored by default because of a conflict
----Only TSServer is enabled by default for the javascript-family
----@param server_name string
-function M.is_ignored(server_name, filetypes)
- --TODO: this is easy to be made configurable once stable
- filetypes = filetypes or get_supported_filetypes(server_name)
-
- if vim.tbl_contains(filetypes, "javascript") then
- if server_name == "tsserver" then
- return false
- else
- return true
- end
- end
-
- local blacklist = {
- "jedi_language_server",
- "pylsp",
- "sqlls",
- "sqls",
- "angularls",
- "ansiblels",
- }
- return vim.tbl_contains(blacklist, server_name)
-end
-
---Generates an ftplugin file based on the server_name in the selected directory
---@param server_name string name of a valid language server, e.g. pyright, gopls, tsserver, etc.
---@param dir string the full path to the desired directory
function M.generate_ftplugin(server_name, dir)
- -- we need to go through lspconfig to get the corresponding filetypes currently
- local filetypes = get_supported_filetypes(server_name) or {}
- if not filetypes then
+ local has_custom_provider, _ = pcall(require, "lsp/providers/" .. server_name)
+ if
+ vim.tbl_contains(options.lsp.override, server_name) and not has_custom_provider
+ then
return
end
- if M.is_ignored(server_name, filetypes) then
+ -- we need to go through lspconfig to get the corresponding filetypes currently
+ local filetypes = lsp_utils.get_supported_filetypes(server_name) or {}
+ if not filetypes then
return
end
- -- print("got associated filetypes: " .. vim.inspect(filetypes))
-
for _, filetype in ipairs(filetypes) do
local filename = join_paths(dir, filetype .. ".lua")
local setup_cmd = string.format([[require("lsp.manager").setup(%q)]], server_name)