Skip to content
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

Using a Blob as a string Error when show document of function bytes_to_long #1320

Closed
2 tasks done
Ame-ReIori opened this issue Feb 26, 2025 · 3 comments · Fixed by #1384
Closed
2 tasks done

Using a Blob as a string Error when show document of function bytes_to_long #1320

Ame-ReIori opened this issue Feb 26, 2025 · 3 comments · Fixed by #1384
Labels
bug Something isn't working

Comments

@Ame-ReIori
Copy link

Make sure you have done the following

  • Updated to the latest version of blink.cmp
  • Searched for existing issues and documentation (try <C-k> on https://cmp.saghen.dev)

Bug Description

i want to import function bytes_to_long from package pycryptodome in python as follows:

from Crypto.Util.number import long_to_bytes, bytes_to_long

When showing document of bytes_to_long, the document window seems weird and error is detected. I put the error in the following image. It seems that the size of document window cannot be calculated correctly.

Image

Is it a configuration issue, or due to the document?

The bug can be reproduced as follows. First, install pycryptodome with pip3 install pycryptodome. Then in neovim, type "from Crypto.Util.number import long_to_bytes, bytes_to_long".

Relevant configuration

documentation = { auto_show = true, auto_show_delay_ms = 50, window = { border = "single" } },

neovim version

v0.11.0-dev-1636+ge3e1c1e765

blink.cmp version

18b352d

@Ame-ReIori Ame-ReIori added the bug Something isn't working label Feb 26, 2025
@Saghen Saghen closed this as completed Feb 26, 2025
@Saghen Saghen reopened this Feb 26, 2025
@Saghen
Copy link
Owner

Saghen commented Feb 26, 2025

Whoops, meant to mark a different issue as duplicate

@Saghen
Copy link
Owner

Saghen commented Mar 1, 2025

It's possible your neovim nightly is out of date. If that doesn't resolve it, send over a repro.lua and I can take another look, closing for now

@Saghen Saghen closed this as not planned Won't fix, can't repro, duplicate, stale Mar 1, 2025
@Ame-ReIori
Copy link
Author

I have updated my neovim to v0.11.0-dev-1893+g948179cb19. But the problem still exists. Here is the repro.lua.

-- Run with `nvim -u repro.lua`

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

---@diagnostic disable-next-line: missing-fields
require("lazy.minit").repro({
	spec = {
		{
			"saghen/blink.cmp",
			-- please test on `main` if possible
			-- otherwise, remove this line and set `version = '*'`
			build = "cargo build --release",
			event = "InsertEnter",
			dependencies = {
				{ "L3MON4D3/LuaSnip", version = "v2.*" },
				"xzbdmw/colorful-menu.nvim",
				"nvim-tree/nvim-web-devicons",
				"onsails/lspkind.nvim",
				"folke/lazydev.nvim",
			},
			opts = {
				completion = {
					list = { selection = { auto_insert = false } },
					keyword = { range = "full" },
					accept = { auto_brackets = { enabled = true } },
					documentation = { auto_show = true, auto_show_delay_ms = 50, window = { border = "single" } },
					menu = {
						border = "single",
						scrollbar = false,
						draw = {
							-- Aligns the keyword you've typed to a component in the menu
							align_to = "cursor", -- or 'none' to disable, or 'cursor' to align to the cursor
							-- Left and right padding, optionally { left, right } for different padding on each side
							padding = 1,
							-- Gap between columns
							gap = 1,
							columns = {
								{ "kind_icon", gap = 1 },
								{ "label", "source_name", gap = 1 },
							},
						},
					},
				},
			},
		},
		{
			"neovim/nvim-lspconfig",
			event = { "BufReadPost", "BufNewFile", "BufWritePre" },
			dependencies = {
				"williamboman/mason.nvim",
				"williamboman/mason-lspconfig.nvim",
				-- "hrsh7th/cmp-nvim-lsp",
				"saghen/blink.cmp",
			},
			opts = {},
			config = function(_, opts)
				local lspconfig = require("lspconfig")
				local mason_lspconfig = require("mason-lspconfig")
				local capabilities = require("blink.cmp").get_lsp_capabilities()
				capabilities.textDocument.completion.completionItem.snippetSupport = true
				capabilities.textDocument.foldingRange = {
					dynamicRegistration = false,
					lineFoldingOnly = true,
				}
				require("mason").setup({
					ui = {
						icons = {
							package_installed = "",
							package_pending = "",
							package_uninstalled = "",
						},
					},
				})
				mason_lspconfig.setup({
					ensure_installed = {
						"pyright",
					},
				})
				mason_lspconfig.setup_handlers({
					-- default handler for installed servers
					function(server_name)
						lspconfig[server_name].setup({
							capabilities = capabilities,
						})
					end,
					["pyright"] = function()
						lspconfig["pyright"].setup({
							capabilities = capabilities,
						})
					end,
				})
			end,
		},
	},
})

@Saghen Saghen reopened this Mar 3, 2025
soifou added a commit to soifou/blink.cmp that referenced this issue Mar 4, 2025
Resolves scrollbar rendering issues when LSP servers (e.g., Pyright)
sometimes return blob-type content in documentation. Converts blobs to
strings before computing line widths to ensure accurate documentation
window sizing.

Fix Saghen#1320
@Saghen Saghen closed this as completed in becb5d4 Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants