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

fix: handle zipfile uri with yarn pnp and neovim #179

Merged
merged 1 commit into from
Jul 3, 2024
Merged

Conversation

yioneko
Copy link
Owner

@yioneko yioneko commented Jun 24, 2024

Resolve #177.

Extra steps to make it work in neovim:

Set init_options.hostInfo = "neovim" to make the yarn sdk aware of the client type and send zipfile:/// uris.

Make sure the neovim builtin zip plugin is enabled. Edit a random zip file to test if it is working.

Add the following snippet to config to fix zip plugin not handling zipfile:/ uri:

vim.api.nvim_create_autocmd("BufReadCmd", {
  pattern = "zipfile:/[^/]*",
  callback = function(args)
    -- the uri is like zipfile:/a/b/c
    local uri = args.match --[[@as string]]
    -- transform it to be zipfile:///a/b/c
    vim.fn["zip#Read"](uri:gsub("^zipfile:", "zipfile://"), 1)
  end,
})

@yioneko yioneko merged commit a6bb7f7 into main Jul 3, 2024
6 checks passed
@release-please release-please bot mentioned this pull request Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not working Goto Definition hotkey with project with yarn pnp
1 participant