Closed Omochice closed 1 year ago
replace on toml
diff --git a/config/nvim/rc/dein_lazy.toml b/config/nvim/rc/dein_lazy.toml
index 8f70021..40ca44a 100644
--- a/config/nvim/rc/dein_lazy.toml
+++ b/config/nvim/rc/dein_lazy.toml
@@ -276,6 +276,7 @@ let g:lsp_settings_filetype_objc = ['clangd']
let g:lsp_settings_filetype_typescript = [<SID>is_node_project() ? 'typescript-language-server' : 'deno']
"""
on_event = ["BufRead", "BufNewFile"]
+if = "!has('nvim')"
[[plugins]]
repo = "mattn/vim-lsp-settings"
@@ -284,6 +285,68 @@ let g:lsp_settings_enable_suggestions = v:false
"""
on_source = "vim-lsp"
+[[plugins]]
+repo = "neovim/nvim-lspconfig"
+on_event = ["BufRead", "BufNewFile"]
+if = "has('nvim')"
+
+[[plugins]]
+repo = "williamboman/mason.nvim"
+lua_source = """
+require("mason").setup()
+"""
+depends = ["nvim-lspconfig", "mason-lspconfig.nvim"]
+on_cmd = "Mason"
+if = "has('nvim')"
+
+[[plugins]]
+repo = "williamboman/mason-lspconfig.nvim"
+on_source = "mason.vim"
+lua_source = '''
+-- https://zenn.dev/kawarimidoll/articles/2b57745045b225
+-- ref: Shougo/shougo-s-github
+require('mason-lspconfig').setup_handlers({
+ function(server_name)
+ local nvim_lsp = require('lspconfig')
+ local node_root_dir = nvim_lsp.util.root_pattern('package.json')
+ local is_node_repo = node_root_dir(vim.api.nvim_buf_get_name(0)) ~= nil
+
+ local opts = {}
+
+ if server_name == 'vtsls' then
+ -- Must be node directory
+ if not is_node_repo then
+ return
+ end
+
+ opts.root_dir = node_root_dir
+ elseif server_name == 'denols' then
+ -- Must not be node directory
+ if is_node_repo then
+ return
+ end
+
+ opts.init_options = {
+ lint = true,
+ unstable = true,
+ suggest = {
+ imports = {
+ hosts = {
+ ['https://deno.land'] = true,
+ ['https://cdn.nest.land'] = true,
+ ['https://crux.land'] = true
+ }
+ }
+ }
+ }
+ end
+
+ nvim_lsp[server_name].setup(opts)
+ end
+})
+'''
+if = "has('nvim')"
+
diff --git a/config/nvim/rc/ddc.toml b/config/nvim/rc/ddc.toml
index 8a028d0..4af55e1 100644
--- a/config/nvim/rc/ddc.toml
+++ b/config/nvim/rc/ddc.toml
@@ -12,9 +12,9 @@ vimx.g.ddc_source_options = {
}
}
-vimx.g.ddc_sources = {
+local sources = {
snippet = { "vsnip" },
- lsp = { "vim-lsp" },
+ lsp = vimx.fn.has("nvim") and { "nvim-lsp" } or { "vim-lsp" },
["in-vim"] = { "around", "buffer" },
["out-vim"] = { "rg" },
}
@@ -37,7 +37,7 @@ vimx.keymap.set(
{
expr = true,
callback = function()
- vimx.fn.ddc.map.manual_complete({ "vim-lsp" })
+ vimx.fn.ddc.map.manual_complete(sources.lsp)
end
}
)
@@ -49,7 +49,7 @@ lua_source = """
local vimx = require("artemis")
vimx.fn.ddc.custom.patch_global(
"sources",
- { "vsnip", "vim-lsp", "around", "buffer", "rg", }
+ { "vsnip", "nvim-lsp", "around", "buffer", "rg", }
)
-- TODO: なんかよくわからんけどluaだといけない
@@ -62,7 +62,7 @@ vimx.cmd "call ddc#custom#patch_global('sourceOptions', g:ddc_source_options)"
vimx.fn.ddc.custom.patch_filetype(
{ "toml", "vim" },
"sources",
- { "vsnip", "necovim", "vim-lsp", "around", "buffer", "rg" }
+ { "vsnip", "necovim", "nvim-lsp", "around", "buffer", "rg" }
)
vimx.fn.ddc.custom.patch_filetype(
@@ -115,6 +115,19 @@ vimx.g.ddc_source_options["vim-lsp"] = {
"""
depends = ["vim-lsp"]
on_source = "ddc.vim"
+if = "!has('nvim')"
+
+[[plugins]]
+repo = "Shougo/ddc-source-nvim-lsp"
+on_souce = "ddc.vim"
+lua_source = """
+local vimx = require("artemis")
+vimx.g.ddc_source_options["nvim-lsp"] = {
+ mark = "[LSP]",
+ forceCompletionPattern = [[\..?|:|->|\w+/]],
+}
+"""
+if = "has('nvim')"
[[plugins]]
repo = "Shougo/ddc-around"
not work above.
denols needs "single_file_support" ...?
work vim.lsp.buf.format etc. but not integrate with ddc yet.
TODO: diagnostics
diagnostics: DONE
but, using ddu-lsp is better...?
using ddu-lsp 👌🏻
SSIA