valentjn / vscode-ltex

LTeX: Grammar/spell checker :mag::heavy_check_mark: for VS Code using LanguageTool with support for LaTeX :mortar_board:, Markdown :pencil:, and others
https://valentjn.github.io/ltex
Mozilla Public License 2.0
817 stars 29 forks source link

Windows 10/11 + vim 9.0.392: ERR_INVALID_FILE_URL_PATH #704

Open fermifunktion opened 2 years ago

fermifunktion commented 2 years ago

Describe the bug Using Vim 9.0.392 with Win10/Win11, coc-ltex is not working. I did the install the exact same way as under GNU/Arch Linux, where coc-ltex is working properly.

Steps to reproduce Steps to reproduce the behavior:

  1. open vim via vim test.tex in Win10/Win11.
  2. type This are an example.
  3. Nothing happens.
  4. typing :CocInfo display the following error message:
``` ## versions vim version: VIM - Vi IMproved 9.0 9000392 node version: v16.17.0 coc.nvim version: 0.0.82-b797c032 2022-09-04 21:59:01 +0800 coc.nvim directory: C:\Users\Administrator\vimfiles\plugged\coc.nvim term: undefined platform: win32 ## Log of coc.nvim 2022-09-06T12:18:39.128 ERROR (pid:6924) [extensions] - Error on createExtension coc-ltex from C:\Users\Administrator\AppData\Local\coc\extensions\node_modules\coc-ltex\dist\extension.js TypeError [ERR_INVALID_FILE_URL_PATH]: File URL path must be absolute at new NodeError (node:internal/errors:387:5) at getPathFromURLWin32 (node:internal/url:1407:11) at fileURLToPath (node:internal/url:1437:22) at Module.3246 (C:\Users\Administrator\AppData\Local\coc\extensions\node_modules\coc-ltex\dist\extension.js:21303:117) at __webpack_require__ (C:\Users\Administrator\AppData\Local\coc\extensions\node_modules\coc-ltex\dist\extension.js:21486:42) at Object.265 (C:\Users\Administrator\AppData\Local\coc\extensions\node_modules\coc-ltex\dist\extension.js:16923:38) at __webpack_require__ (C:\Users\Administrator\AppData\Local\coc\extensions\node_modules\coc-ltex\dist\extension.js:21486:42) at Object.7015 (C:\Users\Administrator\AppData\Local\coc\extensions\node_modules\coc-ltex\dist\extension.js:19542:39) at __webpack_require__ (C:\Users\Administrator\AppData\Local\coc\extensions\node_modules\coc-ltex\dist\extension.js:21486:42) at C:\Users\Administrator\AppData\Local\coc\extensions\node_modules\coc-ltex\dist\extension.js:21526:37 { code: 'ERR_INVALID_FILE_URL_PATH' } 2022-09-06T12:18:39.156 INFO (pid:6924) [plugin] - coc.nvim initialized with node: v16.17.0 after 259ms 2022-09-06T12:18:39.190 INFO (pid:6924) [attach] - receive notification: highlight [] 2022-09-06T12:18:43.321 WARN (pid:6924) [completion] - Suggest not triggered with input "", minimal trigger input length: 1 [...] ```

LTeX configuration just installed ltex via :CocInstall coc-json coc-tsserver coc-vimtex coc-pyright coc-ltex in vim...

fermifunktion commented 2 years ago

In the file ..\coc-ltex\dist\extension.js at line 21303 I found a fully qualified path which does not exist:

const linux_dirname = external_node_path_namespaceObject.dirname((0,external_node_url_namespaceObject.fileURLToPath)("file:///home/runner/work/vscode-ltex/vscode-ltex/node_modules/clipboardy/lib/linux.js"));

in line 21416 the same for windows_dirname:

const windows_dirname = external_node_path_namespaceObject.dirname((0,external_node_url_namespaceObject.fileURLToPath)("file:///home/runner/work/vscode-ltex/vscode-ltex/node_modules/clipboardy/lib/windows.js"));

Maybe these two lines contribute to the error?

fermifunktion commented 2 years ago

after setting const linux_dirname = '~/' and const windows_dirname = '~/' coc-ltex starts to download ltex-ls and works properly. Maybe the paths in lines 21303 and 21416 should be rethought...

sl33k commented 2 years ago

Can confirm that this fixes the issues also for Windows 10 with neovim 0.7.3.

alihaiderismail commented 11 months ago

I've been pulling my hair for the last few hours trying to figure this out. Thank you for the fix. This worked on Vim 8.2 for me.