neoclide / coc.nvim

Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Other
24.47k stars 956 forks source link

Failed to load extension on runtimepath (markdownlint) #3963

Closed SichangHe closed 2 years ago

SichangHe commented 2 years ago

Result from CocInfo

## versions

vim version: NVIM v0.7.2
node version: v18.7.0
coc.nvim version: 0.0.81-34400214 2022-07-31 19:00:40 +0800
coc.nvim directory: /Users/username/.local/share/dein/repos/github.com/neoclide/coc.nvim_release
term: alacritty
platform: darwin

## Log of coc.nvim

2022-08-01T23:12:22.971 ERROR (pid:75546) [extensions] - Error on createExtension coc-markdownlint from /Users/username/.local/share/dein/repos/github.com/fannheyward/coc-markdownlint/lib/index.js ReferenceError: URL is not defined
    at node_modules/markdownlint/lib/rules.js (/Users/username/.local/share/dein/repos/github.com/fannheyward/coc-markdownlint/lib/index.js:8289:33)
    at __require (/Users/username/.local/share/dein/repos/github.com/fannheyward/coc-markdownlint/lib/index.js:9:50)
    at node_modules/markdownlint/lib/markdownlint.js (/Users/username/.local/share/dein/repos/github.com/fannheyward/coc-markdownlint/lib/index.js:8303:17)
    at __require (/Users/username/.local/share/dein/repos/github.com/fannheyward/coc-markdownlint/lib/index.js:9:50)
    at Object.<anonymous> (/Users/username/.local/share/dein/repos/github.com/fannheyward/coc-markdownlint/lib/index.js:13109:35)
    at Module._compile (/Users/username/.local/share/dein/repos/github.com/neoclide/coc.nvim_release/build/index.js:61021:28)
    at Module._extensions..js (node:internal/modules/cjs/loader:1174:10)
    at Module.load (node:internal/modules/cjs/loader:998:32)
    at Module._load (node:internal/modules/cjs/loader:839:12)
    at Module.require (node:internal/modules/cjs/loader:1022:19)
2022-08-01T23:12:22.974 INFO (pid:75546) [plugin] - coc.nvim initialized with node: v18.7.0 after 52ms
2022-08-01T23:14:49.885 INFO (pid:75546) [attach] - receive notification: showInfo []

Describe the bug

If I install markdownlint using :CocInstall coc-markdownlint, it works. If I install markdownlint to ~/.local/share/dein/repos/github.com/fannheyward/coc-markdownlint using dein, and then add it to runtimepath, and then load coc, it fails to load.

Reproduce the bug

  1. git clone markdownlint to ~/.local/share/dein/repos/github.com/fannheyward/coc-markdownlint, coc to ~/.local/share/dein/repos/github.com/neoclide/coc.nvim_release
  2. Minimum ~/.config/nvim/init.lua:
    vim.opt.runtimepath:append('~/.local/share/dein/repos/github.com/fannheyward/coc-markdownlint')
    vim.opt.runtimepath:append('~/.local/share/dein/repos/github.com/neoclide/coc.nvim_release')
  3. Open a markdown file.
SichangHe commented 2 years ago

The Fix for me

Go to /Users/username/.local/share/dein/repos/github.com/fannheyward/coc-markdownlint/lib/index.js:8289 which says

      rule["information"] = new URL(`${homepage}/blob/v${version}/doc/Rules.md#${name}`);

and comment it out…

fannheyward commented 2 years ago

It's not a runtimepath issue, but global module.

SichangHe commented 2 years ago

I have read the issues you linked, but I have not figured out how to properly fix this issue. Could you please provide some information regarding that?

fannheyward commented 2 years ago

@SichangHe this has been fixed in coc.nvim latest release.

SichangHe commented 2 years ago

I see. I can confirm. Forgot to update coc.nvim as well. Thank you very much.