From c9e2adbbc8fd7a5398c8c66d21f0e02dc7b60203 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Mon, 8 Nov 2021 23:13:05 +0100 Subject: Add new lunarvin updates --- .config/nvim/lua/lsp/templates.lua | 41 ++++++++------------------------------ 1 file changed, 8 insertions(+), 33 deletions(-) (limited to '.config/nvim/lua/lsp/templates.lua') 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) -- cgit v1.2.3-70-g09d2