Closed englut closed 7 months ago
Can't reproduce, the formatting is working as expected.
"deno.trace.server": "verbose"
in your global coc-settings.jsoncall CocAction("format")
:CocCommand workspace.showOutput deno
textDocument/formatting
, any logs?4. search `textDocument/formatting`, any logs?
Here's what shows up in my
:CocCommand workspace.showOutput deno
[Trace - 09:40:04.540] Sending request 'textDocument/formatting - (1)'.
Params: {
"textDocument": {
"uri": "file:///<redacted>/deno/main.ts"
},
"options": {
"tabSize": 2,
"insertSpaces": true,
"insertFinalNewline": false
}
}
[Trace - 09:40:04.540] Received response 'textDocument/formatting - (1)' in 0ms.
No result returned.
@fannheyward The project is set up with deno init
so it's pretty boiler plate. It might be something with my neovim setup. But I'm not sure where to look. Any ideas on where I can dig would be greatly appreciated 🙏
My workspace .vim/coc-settings.json
shows this:
{
"deno.enable": true,
"deno.lint": true,
"deno.unstable": true,
"prettier.enable": false,
"tsserver.enable": false
}
The sending request means coc.nvim/coc-deno works as expected after format
action. There's no response means current document doesn't need to format.
:noa w
, this won't trigger formatting on savecall CocAction("format")
@fannheyward
1. made some unformatted content in main.ts, save with `:noa w`, this won't trigger formatting on save 2. `call CocAction("format")` 3. check response from the logs
I did the same. Still nothing.
There's no response means current document doesn't need to format.
Running deno fmt
on the file actually does fix the format issues. But call CocAction("format")
does not.
Have no idea about this, the trace logs shows client(coc.nvim+coc-deno) sends formatting request to deno server, the server returns empty response, client can do nothing.
I did a quick test:
deno init
a project:call CocAction('format')
[Trace - 09:08:02.325] Sending request 'textDocument/formatting - (9)'.
Params: {
"textDocument": {
"uri": "file:///Users/fannheyward/src/hello-deno/main.ts"
},
"options": {
"tabSize": 2,
"insertSpaces": true,
"insertFinalNewline": true
}
}
[Trace - 09:08:02.329] Received response 'textDocument/formatting - (9)' in 4ms.
Result: [
{
"range": {
"start": {
"line": 6,
"character": 0
},
"end": {
"line": 6,
"character": 9
}
},
"newText": ""
}
]
@fannheyward thanks for your help! I really appreciate it. Turns out it was just bad copy and paste of the official documentation for format rules.
https://docs.deno.com/runtime/manual/getting_started/configuration_file#fmt
{
"fmt": {
...
"include": ["src/"], <--- the folder here is why
"exclude": ["src/testdata/", "src/fixtures/**/*.ts"]
}
}
My bad!! Thanks again!
I'm trying to get
coc-deno
working in my deno project. The linter seems to work fine after I initialize the project, but the formatter doesn't seem to work.When I run
CocAction("format")
, nothing seems to happen in my deno project. Is there something I'm doing wrong?I've initialized the workspace with enable linting, enable unstable APIs and disable coc-prettier.