Code Monkey home page Code Monkey logo

Comments (7)

Omochice avatar Omochice commented on May 29, 2024

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"

from dotfiles.

Omochice avatar Omochice commented on May 29, 2024

not work above.

from dotfiles.

Omochice avatar Omochice commented on May 29, 2024

denols needs "single_file_support" ...?

from dotfiles.

Omochice avatar Omochice commented on May 29, 2024

work vim.lsp.buf.format etc.
but not integrate with ddc yet.

from dotfiles.

Omochice avatar Omochice commented on May 29, 2024

TODO: diagnostics

from dotfiles.

Omochice avatar Omochice commented on May 29, 2024

diagnostics: DONE

but, using ddu-lsp is better...?

from dotfiles.

Omochice avatar Omochice commented on May 29, 2024

using ddu-lsp 👌🏻

from dotfiles.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.