From 1b2a0856f4adfffc5c4e785a6779c62759c8c926 Mon Sep 17 00:00:00 2001 From: ray-x Date: Wed, 11 Jan 2023 21:16:46 +1100 Subject: [PATCH] [breaking] deprecate neodev setup inside navigator, please setup it as metioned in README.md --- README.md | 26 +++++++++++++++++-------- lua/navigator.lua | 24 +++-------------------- lua/navigator/lspclient/clients.lua | 11 +++-------- lua/navigator/lspclient/sumneko_lua.lua | 12 ------------ 4 files changed, 24 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index a25dd0b..59383c8 100644 --- a/README.md +++ b/README.md @@ -640,16 +640,26 @@ There are lots of plugins provides lsp support * [neodev](https://github.com/folke/neodev.nvim) Dev setup for lua development. Navigator help you setup neodev -Here is an example to setup rust with rust-tools + * setup with neodev +```lua +use {"folke/neodev.nvim", + ft = 'lua', + config = function() + require'neodev'.setup{} + end +} + +use {"ray-x/navigator.lua", + config=function() + require'navigator'.setup{} + end + } +``` + + + * Here is an example to setup rust with rust-tools ```lua -require'navigator'.setup({ - lsp = { - disable_lsp = { "rust_analyzer", "clangd" }, -- will not run rust_analyzer setup from navigator - ['neodev'] = { runtime_path=true } -- any non default neodev setups, if not empty, navigator will call neodev.setup - -- with those configures - }, -}) require('rust-tools').setup({ server = { diff --git a/lua/navigator.lua b/lua/navigator.lua index 4de99e1..32eb7d4 100755 --- a/lua/navigator.lua +++ b/lua/navigator.lua @@ -95,10 +95,7 @@ _NgConfigValues = { -- filetypes = {'typescript'} -- disable javascript etc, -- set to {} to disable the lspclient for all filetype }, - ['neodev'] = { -- navigator can use neodev settings to setup sumneko_lua - -- your setting for neodev here - -- navigator will setup neodev - }, + neodev = false, sumneko_lua = { -- sumneko_root_path = sumneko_root_path, -- sumneko_binary = sumneko_binary, @@ -158,23 +155,8 @@ _NgConfigValues = { } M.deprecated = function(cfg) - if cfg.code_action_prompt then - warn('code_action_prompt moved to lsp.code_action') - end - if cfg.code_lens_action_prompt then - warn('code_lens_action_prompt moved to lsp.code_lens_action') - end - - if cfg.lsp ~= nil and cfg.lsp.disable_format_ft ~= nil and cfg.lsp.disable_format_ft ~= {} then - warn('disable_format_ft renamed to disable_format_cap') - end - - if cfg.lsp ~= nil and cfg.lsp.code_lens == true then - warn('code_lens moved to lsp.code_lens_action') - end - - if cfg.lspinstall ~= nil then - warn('lspinstall deprecated, please use lsp-installer instead or use "lspinstall" branch') + if cfg.lsp ~= nil and cfg.lsp.neodev ~= false and cfg.lsp.neodev then + warn('neodev option deprecated, refer to README for more details') end end diff --git a/lua/navigator/lspclient/clients.lua b/lua/navigator/lspclient/clients.lua index f8e4a13..64c42c9 100644 --- a/lua/navigator/lspclient/clients.lua +++ b/lua/navigator/lspclient/clients.lua @@ -49,20 +49,12 @@ local disabled_ft = { local on_attach = require('navigator.lspclient.attach').on_attach -- gopls["ui.completion.usePlaceholders"] = true --- lua setup - -if _NgConfigValues.lsp['lua-dev'] ~= nil then - vim.notify('lua-dev is deprecated, please use neodev instead', vim.lsp.log_levels.WARN) -end - -require('navigator.lazyloader').load('neodev.nvim', 'folke/neodev.nvim') if _NgConfigValues.mason then require('navigator.lazyloader').load('mason.nvim', 'williamboman/mason.nvim') require('navigator.lazyloader').load('mason-lspconfig.nvim', 'williamboman/mason-lspconfig.nvim') end -local setups = require('navigator.lspclient.clients_default').defaults() local servers = require('navigator.lspclient.servers') local lsp_mason_servers = {} @@ -81,6 +73,8 @@ local ng_default_cfg = { -- check and load based on file type local function load_cfg(ft, client, cfg, loaded, starting) + + local setups = require('navigator.lspclient.clients_default').defaults() log(ft, client, loaded, starting) trace(cfg) if lspconfig[client] == nil then @@ -218,6 +212,7 @@ end local loaded = {} local function lsp_startup(ft, retry, user_lsp_opts) + local setups = require('navigator.lspclient.clients_default').defaults() retry = retry or false local path_sep = require('navigator.util').path_sep() local capabilities = update_capabilities() diff --git a/lua/navigator/lspclient/sumneko_lua.lua b/lua/navigator/lspclient/sumneko_lua.lua index d2b0bac..7caec4f 100644 --- a/lua/navigator/lspclient/sumneko_lua.lua +++ b/lua/navigator/lspclient/sumneko_lua.lua @@ -68,18 +68,6 @@ local function sumneko_lua() }, setup_jsonls = true, } - - local user_luadev = _NgConfigValues.lsp['neodev'] - if user_luadev then - luadevcfg = vim.tbl_deep_extend('force', luadevcfg, user_luadev) - end - require('navigator.lazyloader').load('neodev.nvim', 'folke/neodev.nvim') - - local ok, l = pcall(require, 'neodev') - if ok and l then - l.setup(luadevcfg) - end - return sumneko_cfg end