Skip to content

align_to_component is misaligned when using tab indentation at the first level #405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
jheroy opened this issue Nov 29, 2024 · 0 comments
Closed
2 tasks done
Labels
bug Something isn't working windows Module which displays UI

Comments

@jheroy
Copy link

jheroy commented Nov 29, 2024

Make sure you have done the following

  • I have updated to the latest version of blink.cmp
  • I have read the README

Bug Description

image

I've temporarily fixed it with the following code.

diff --git a/lua/blink/cmp/completion/windows/menu.lua b/lua/blink/cmp/completion/windows/menu.lua
index 32af8d3..6cef7b0 100644
--- a/lua/blink/cmp/completion/windows/menu.lua
+++ b/lua/blink/cmp/completion/windows/menu.lua
@@ -109,7 +109,16 @@ function menu.update_position()
   -- place the window at the start col of the current text we're fuzzy matching against
   -- so the window doesnt move around as we type
   local cursor_col = vim.api.nvim_win_get_cursor(0)[2]
+  local current_indent = vim.fn.indent(vim.fn.line('.'))
+  local tabstop = vim.api.nvim_get_option("tabstop")
   local col = context.bounds.start_col - cursor_col - (context.bounds.length == 0 and 0 or 1) - border_size.left
+  if current_indent == tabstop then
+    col = context.bounds.start_col - cursor_col - border_size.left
+  else
+  end
+
+
   local row = pos.direction == 's' and 1 or -pos.height - border_size.vertical
   vim.api.nvim_win_set_config(winnr, { relative = 'cursor', row = row, col = col - start_col })
   vim.api.nvim_win_set_height(winnr, pos.height)

Relevant configuration

No response

neovim version

NVIM v0.10.2 Build type: RelWithDebInfo LuaJIT 2.1.1727870382 Run "nvim -V1 -v" for more info

blink.cmp version: branch, tag, or commit

main

@jheroy jheroy added the bug Something isn't working label Nov 29, 2024
@Saghen Saghen added the windows Module which displays UI label Nov 29, 2024
@Saghen Saghen closed this as completed in e88da6a Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working windows Module which displays UI
Projects
None yet
Development

No branches or pull requests

2 participants