Skip to content

Commit

Permalink
Add support for server side filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
deathbeam committed Feb 17, 2024
1 parent 8054ced commit 07700a2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ require("autocomplete.signature").setup {

-- LSP autocompletion
require("autocomplete.lsp").setup {
server_side_filtering = true, -- Use LSP filtering instead of vim's
debounce_delay = 100
}

Expand Down
5 changes: 3 additions & 2 deletions lua/autocomplete/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ local function text_changed(client, bufnr)

local char = line:sub(col, col)
local cmp_start = vim.fn.match(line:sub(1, col), '\\k*$')
local prefix = line:sub(cmp_start + 1, col)
local prefix = M.config.server_side_filtering and "" or line:sub(cmp_start + 1, col)
local params = vim.lsp.util.make_position_params(0, client.offset_encoding)

-- Check if we are triggering completion automatically or on trigger character
Expand Down Expand Up @@ -117,7 +117,8 @@ local function text_changed(client, bufnr)
end

M.config = {
debounce_delay = 100
server_side_filtering = true, -- Use LSP filtering instead of vim's
debounce_delay = 100,
}

function M.capabilities()
Expand Down

0 comments on commit 07700a2

Please sign in to comment.