diff options
| author | Kyren223 <contact@kyren.codes> | 2026-06-23 13:57:40 +0300 |
|---|---|---|
| committer | Kyren223 <contact@kyren.codes> | 2026-06-23 13:57:40 +0300 |
| commit | 9ad2a8e0486e6f8b522d303c54a0fb8294b79cd0 (patch) | |
| tree | 53034b4cfe8be33e540184501684f35dab756c47 /.config/nvim/lua/plugins/blink-cmp.lua | |
| parent | 1e9ddece1574c79213588aef496026d875fa8168 (diff) | |
Sort jdtls code actions and completions based on packages I prefer, and
add static import to certain Kapi procs
Diffstat (limited to '.config/nvim/lua/plugins/blink-cmp.lua')
| -rw-r--r-- | .config/nvim/lua/plugins/blink-cmp.lua | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/.config/nvim/lua/plugins/blink-cmp.lua b/.config/nvim/lua/plugins/blink-cmp.lua index fdf6d87..0c3f6d5 100644 --- a/.config/nvim/lua/plugins/blink-cmp.lua +++ b/.config/nvim/lua/plugins/blink-cmp.lua @@ -108,6 +108,32 @@ return { end, items) end, }, + + lsp = { + name = 'lsp', + module = 'blink.cmp.sources.lsp', + transform_items = function(ctx, items) + if vim.bo[ctx.bufnr].filetype == 'java' then + local java_package_weights = require('plugins.nvim-jdtls').java_package_weights + + for _, item in ipairs(items) do + -- jdtls puts the fully qualified package path inside 'detail' + local detail = item.detail or '' + if detail ~= '' then + for pattern, weight in pairs(java_package_weights) do + pattern = '^' .. pattern + if detail:match(pattern) then + item.score_offset = weight + break -- Match found, move to the next item + end + end + end + end + end + + return items + end, + }, }, }, |
