Explorar el Código

nixpkgs/neovim: fix extra dot in autocomplete

Thomas Dy hace 1 año
padre
commit
c5aa9e25bc
Se han modificado 2 ficheros con 16 adiciones y 0 borrados
  1. 3 0
      .config/nixpkgs/neovim/lsp.lua
  2. 13 0
      .config/nixpkgs/neovim/plugins.lua

+ 3 - 0
.config/nixpkgs/neovim/lsp.lua

@@ -47,6 +47,9 @@ if vim.fn.executable("deno") == 1 then
 else
   require('typescript').setup({
     server = {
+      init_options = {
+        completionDisableFilterText = true,
+      },
       flags = {
         debounce_text_changes = 150,
       },

+ 13 - 0
.config/nixpkgs/neovim/plugins.lua

@@ -89,6 +89,19 @@ require('mini.completion').setup({
   lsp_completion = {
     source_func = 'omnifunc',
     auto_setup = false,
+
+    -- workaround from https://github.com/echasnovski/mini.nvim/issues/306#issuecomment-1517954136
+    process_items = function(items, base)
+      -- Remove dots as prefix from `textEdit.newText` as it is used verbatim
+      for _, item in ipairs(items) do
+        local new_text = (item.textEdit or {}).newText
+        if type(new_text) == 'string' then
+          item.textEdit.newText = new_text:gsub('^%.+', '')
+        end
+      end
+
+      return MiniCompletion.default_process_items(items, base)
+    end,
   },
 });