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

telescope hoogle_signature open in browser with <C-b> with wrong url #336

Closed
Pcrab opened this issue Jan 20, 2024 · 2 comments
Closed

telescope hoogle_signature open in browser with <C-b> with wrong url #336

Pcrab opened this issue Jan 20, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@Pcrab
Copy link

Pcrab commented Jan 20, 2024

Neovim version (nvim -v)

v0.10.0-dev-2085+g310fb2efc-Homebrew

Operating system/version

macOS 14.2.1

Output of :checkhealth haskell-tools

==============================================================================
haskell-tools: require("haskell-tools.health").check()

Checking for Lua dependencies ~
- OK [nvim-telescope/telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) installed.

Checking external dependencies ~
- OK haskell-language-server: found haskell-language-server version: 2.5.0.0 (GHC: 9.2.8) (PATH: /Users/pangxw/.local/share/ghcup/hls/2.5.0.0/lib/haskell-language-server-2.5.0.0/bin/haskell-language-server-wrapper)
- OK hoogle: found Hoogle 5.0.18.4, https://hoogle.haskell.org/
- OK fast-tags: found fast-tags, version 2.0.2
- OK curl: found curl 8.4.0 (x86_64-apple-darwin23.0) libcurl/8.4.0 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.12 nghttp2/1.55.1
- OK haskell-debug-adapter: found haskell-debug-adapter-0.0.39.0
- OK ghci-dap: found The Glorious Glasgow Haskell Compilation System, version 9.4.8

Checking config ~
- OK No errors found in config.

Checking for conflicting plugins ~
- OK No conflicting plugins detected.

How to reproduce the issue

Open telescope with <CMD>lua require('haskell-tools').hoogle.hoogle_signature()<CR>, select any item, and press <C-b> to open doc in browser.

The browser will open a tab with url like https://hackage.haskell.org/package/base-4.19.0.0/docs/Prelude.html%5C#v:putStrLn, which is wrong. There shouldn't be a %5C between pathname and the hash.

Expected behaviour

open browser with correct url

Actual behaviour

with additional escape character \ (%5C)

Log files

No response

The minimal config used to reproduce this issue.

-- Minimal nvim config with lazy
-- Assumes a directory in $NVIM_DATA_MINIMAL
-- Start with
--
-- export NVIM_DATA_MINIMAL=$(mktemp -d)
-- export NVIM_APP_NAME="nvim-ht-minimal"
-- nvim -u minimal.lua
--
-- Then exit out of neovim and start again.

-- Ignore default config
local config_path = vim.fn.stdpath("config")
vim.opt.rtp:remove(config_path)

-- Ignore default plugins
local data_path = vim.fn.stdpath("data")
local pack_path = data_path .. "/site"
vim.opt.packpath:remove(pack_path)

-- bootstrap lazy.nvim
data_path = assert(os.getenv("NVIM_DATA_MINIMAL"), "$NVIM_DATA_MINIMAL environment variable not set!")
local lazypath = data_path .. "/lazy/lazy.nvim"
local uv = vim.uv
	---@diagnostic disable-next-line: deprecated
	or vim.loop
if not uv.fs_stat(lazypath) then
	vim.fn.system({
		"git",
		"clone",
		"--filter=blob:none",
		"git@github.com:folke/lazy.nvim.git",
		"--branch=stable",
		lazypath,
	})
end
vim.opt.rtp:prepend(lazypath)

local lazy = require("lazy")

lazy.setup({
	{
		"mrcjkb/haskell-tools.nvim",
		version = "^3", -- Recommended
		init = function()
			-- Configure haskell-tools.nvim here
			vim.g.haskell_tools = {}
		end,
		dependencies = {
			-- Uncomment or add any optional dependencies needed to reproduce the issue
			"nvim-lua/plenary.nvim",
			"nvim-telescope/telescope.nvim",
			-- 'akinsho/toggleterm.nvim',
		},
		ft = { "haskell", "lhaskell", "cabal", "cabalproject" },
		keys = {
			{
				"<leader>hs",
				"<CMD>lua require('haskell-tools').hoogle.hoogle_signature()<CR>",
				desc = "Hoogle signature",
				ft = { "haskell" },
			},
			{
				"<leader>rr",
				"<CMD>lua require('haskell-tools').repl.toggle()<CR>",
				desc = "Toggle GHCi repl",
				ft = { "haskell", "lhaskell" },
			},
			{
				"<leader>rq",
				"<CMD>lua require('haskell-tools').repl.toggle()<CR>",
				desc = "Close GHCi repl",
				ft = { "haskell", "lhaskell" },
			},
		},
	},
	-- Add any other plugins needed to reproduce the issue.
	-- see https://github.com/folke/lazy.nvim#-lazynvim for details.
}, { root = data_path, state = data_path .. "/lazy-state.json", lockfile = data_path .. "/lazy-lock.json" })
@Pcrab Pcrab added the bug Something isn't working label Jan 20, 2024
@Pcrab
Copy link
Author

Pcrab commented Jan 20, 2024

OS.open_browser(vim.fn.fnameescape(entry.url) or entry.url)

If I change it to OS.open_browser(entry.url), then everything works fine.

@mrcjkb
Copy link
Owner

mrcjkb commented Jan 20, 2024

Hey 👋

Thanks for reporting!
Fixed with 2faa2c8.

@mrcjkb mrcjkb closed this as completed Jan 20, 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
Projects
None yet
Development

No branches or pull requests

2 participants