fannheyward / coc-deno

Deno extension for coc.nvim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Valid `deno.jsonc` `fmt` configuration in deno project causes coc-deno / coc.nvim to complain and not work correctly

filmaj opened this issue Β· comments

Hello, me again πŸ‘‹ πŸ˜…

Thank you for your responsiveness and support in my other issues filed. Your help has been valuable and I very much appreciate it πŸ™ πŸ™‡

I work on various deno-related projects and samples at my day job. Here is one such project: https://github.com/slack-samples/deno-request-time-off/

If you clone down the main branch, and e.g. vim manifest.ts, at least on my machine / my vim setup, I see the following error message on startup - sometimes before even having the ability to run :CocCommand deno.initializeWorkspace, sometimes after running initializeWorkspace:

[coc.nvim] Unable to update formatter configuration: Failed to parse "fmt" configuration

Briefly I see another message that seems to complain about the semiColons fmt option, but it disappears and is replaced by the above message.

The :messages output is empty but the output of :CocInfo is:

## versions

vim version: VIM - Vi IMproved 9.0 9001550
node version: v20.2.0
coc.nvim version: 0.0.82-b7375d5f 2023-01-30 05:09:03 +0800
coc.nvim directory: /Users/fmaj/src/dotfiles/.vim/bundle/coc.nvim
term: iTerm.app
platform: darwin

## Log of coc.nvim

2023-06-22T09:30:46.085 INFO (pid:29298) [plugin] - coc.nvim initialized with node: v20.2.0 after 232
2023-06-22T09:30:46.089 INFO (pid:29298) [services] - LanguageClient ESLint state change: stopped => starting
2023-06-22T09:30:46.114 INFO (pid:29298) [services] - service tsserver started
2023-06-22T09:30:46.120 INFO (pid:29298) [language-client-index] - Language server "eslint" started with 29304
2023-06-22T09:30:46.242 INFO (pid:29298) [services] - LanguageClient ESLint state change: starting => running
2023-06-22T09:30:46.245 INFO (pid:29298) [services] - service eslint started
2023-06-22T09:30:46.307 INFO (pid:29298) [core-watchman] - watchman watching project: /Users/fmaj/src/deno-request-time-off
2023-06-22T09:30:54.266 INFO (pid:29298) [attach] - receive notification: runCommand [ 'deno.initializeWorkspace' ]
2023-06-22T09:30:58.331 INFO (pid:29298) [configurations] - Add folder configuration from file: /Users/fmaj/src/deno-request-time-off/.vim/coc-settings.json
2023-06-22T09:30:58.336 INFO (pid:29298) [configuration-shape] - modify configuration file: /Users/fmaj/src/deno-request-time-off/.vim/coc-settings.json deno.enable true
2023-06-22T09:30:58.340 INFO (pid:29298) [configuration-shape] - modify configuration file: /Users/fmaj/src/deno-request-time-off/.vim/coc-settings.json deno.lint true
2023-06-22T09:30:58.344 INFO (pid:29298) [configuration-shape] - modify configuration file: /Users/fmaj/src/deno-request-time-off/.vim/coc-settings.json deno.unstable false
2023-06-22T09:30:58.353 INFO (pid:29298) [configuration-shape] - modify configuration file: /Users/fmaj/src/deno-request-time-off/.vim/coc-settings.json tsserver.enable false
2023-06-22T09:30:58.362 INFO (pid:29298) [services] - LanguageClient deno state change: stopped => starting
2023-06-22T09:30:58.362 WARN (pid:29298) [commands] - Command deno.initializeWorkspace already registered
2023-06-22T09:30:58.377 INFO (pid:29298) [language-client-index] - Language server "deno" started with 29440
2023-06-22T09:30:58.990 INFO (pid:29298) [services] - LanguageClient deno state change: starting => running
2023-06-22T09:30:58.994 INFO (pid:29298) [services] - service deno started
2023-06-22T09:31:58.924 INFO (pid:29298) [attach] - receive notification: highlight []
2023-06-22T09:32:00.349 INFO (pid:29298) [attach] - receive notification: showInfo []

At this point, the deno LSP is not useful within the example project I linked to above, I think because the deno.jsonc file was unable to be parsed completely, so the importMap configuration was not applied, and so all the import-map-based imports throughout the project cannot be resolved.

If, however, I modify the project to remove the fmt section from the project's deno.jsonc, everything works as expected.

The deno.jsonc from this sample projects includes a $schema property, so the coc-json extension is active and assures me the deno.jsonc file is valid and passes the official deno schema for deno.jsonc.

Not sure if this is the right place to report the issue.

Unable to update formatter configuration

What's your deno version? I can't reproduce it. This error message is came from deno LS.

Yes you are right: I was using deno v1.26.1. Upgrading to 1.34.3 fixed the issue.

It is not ideal that the deno project's tooling does not use stable versioning yet. Hopefully after deno 2, the tooling stabilizes so that the APIs can be more consistent and predictable.

Thank you for your help πŸ™‡