Hello:
I have Visual Studio Code 1.38.0-insider and YAML 0.5.1.
Every time I paste code I receive a range formatting error in the Outputs window of the console.
I've tried opening a workspace, a folder, and an individual file - all with the same results.
I enabled YAML Server Trace and this is the output that I'm seeing right around the error message. It does not seem to matter if I'm pasting real YAML - or any other text - the error message is always the same:
[Trace - 9:14:58 AM] Sending request 'textDocument/rangeFormatting - (16)'.
Params: {
"textDocument": {
"uri": "file:///d%3A/GitRepos/CFInfra/dns-zone.yaml"
},
"range": {
"start": {
"line": 151,
"character": 0
},
"end": {
"line": 151,
"character": 17
}
},
"options": {
"tabSize": 2,
"insertSpaces": true
}
}
[Trace - 9:14:58 AM] Received response 'textDocument/rangeFormatting - (16)' in 1ms. Request failed: Unhandled method textDocument/rangeFormatting (-32601).
[Error - 9:14:58 AM] Request textDocument/rangeFormatting failed.
Message: Unhandled method textDocument/rangeFormatting
Code: -32601
[Trace - 9:14:58 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///d%3A/GitRepos/CFInfra/dns-zone.yaml",
"diagnostics": [
{
"message": "can not read a block mapping entry; a multiline key may not be an implicit key",
"range": {
"start": {
"line": 151,
"character": 5102
},
"end": {
"line": 151,
"character": 5102
}
},
"severity": 1
},
{
"message": "bad indentation of a mapping entry",
"range": {
"start": {
"line": 151,
"character": 5102
},
"end": {
"line": 151,
"character": 5102
}
},
"severity": 1
},
{
"message": "incomplete explicit mapping pair; a key node is missed",
"range": {
"start": {
"line": 151,
"character": 5104
},
"end": {
"line": 151,
"character": 5104
}
},
"severity": 1
},
{
"message": "bad indentation of a mapping entry",
"range": {
"start": {
"line": 165,
"character": 5539
},
"end": {
"line": 165,
"character": 5539
}
},
"severity": 1
},
{
"message": "bad indentation of a mapping entry",
"range": {
"start": {
"line": 179,
"character": 5957
},
"end": {
"line": 179,
"character": 5957
}
},
"severity": 1
},
{
"message": "bad indentation of a mapping entry",
"range": {
"start": {
"line": 190,
"character": 6218
},
"end": {
"line": 190,
"character": 6218
}
},
"severity": 1
},
{
"message": "bad indentation of a mapping entry",
"range": {
"start": {
"line": 202,
"character": 6577
},
"end": {
"line": 202,
"character": 6577
}
},
"severity": 1
},
{
"message": "bad indentation of a mapping entry",
"range": {
"start": {
"line": 213,
"character": 6919
},
"end": {
"line": 213,
"character": 6919
}
},
"severity": 1
},
{
"message": "bad indentation of a mapping entry",
"range": {
"start": {
"line": 224,
"character": 7261
},
"end": {
"line": 224,
"character": 7261
}
},
"severity": 1
},
{
"message": "bad indentation of a mapping entry",
"range": {
"start": {
"line": 235,
"character": 7564
},
"end": {
"line": 235,
"character": 7564
}
},
"severity": 1
},
{
"message": "bad indentation of a mapping entry",
"range": {
"start": {
"line": 246,
"character": 7874
},
"end": {
"line": 246,
"character": 7874
}
},
"severity": 1
},
{
"message": "bad indentation of a mapping entry",
"range": {
"start": {
"line": 257,
"character": 8197
},
"end": {
"line": 257,
"character": 8197
}
},
"severity": 1
},
{
"message": "bad indentation of a mapping entry",
"range": {
"start": {
"line": 268,
"character": 8512
},
"end": {
"line": 268,
"character": 8512
}
},
"severity": 1
},
{
"message": "bad indentation of a mapping entry",
"range": {
"start": {
"line": 279,
"character": 8804
},
"end": {
"line": 279,
"character": 8804
}
},
"severity": 1
},
{
"message": "bad indentation of a mapping entry",
"range": {
"start": {
"line": 290,
"character": 9103
},
"end": {
"line": 290,
"character": 9103
}
},
"severity": 1
},
{
"message": "bad indentation of a mapping entry",
"range": {
"start": {
"line": 301,
"character": 9386
},
"end": {
"line": 301,
"character": 9386
}
},
"severity": 1
},
{
"message": "bad indentation of a mapping entry",
"range": {
"start": {
"line": 312,
"character": 9700
},
"end": {
"line": 312,
"character": 9700
}
},
"severity": 1
}
]
}
Every time pasted code +1
Version: 1.37.1
Commit: f06011ac164ae4dc8e753a3fe7f9549844d15e35
Date: 2019-08-15T16:16:34.800Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Darwin x64 18.7.0
YAML 0.5.1.
[Trace - 5:00:59 PM] Sending request 'textDocument/rangeFormatting - (3)'.
Params: {
"textDocument": {
"uri": "file:///Users/dylan/Projects/SomeProject/release_notes/20190826150200.yml"
},
"range": {
"start": {
"line": 2,
"character": 4
},
"end": {
"line": 2,
"character": 24
}
},
"options": {
"tabSize": 2,
"insertSpaces": true
}
}
[Trace - 5:00:59 PM] Received response 'textDocument/rangeFormatting - (3)' in 1ms. Request failed: Unhandled method textDocument/rangeFormatting (-32601).
[Error - 5:00:59 PM] Request textDocument/rangeFormatting failed.
Message: Unhandled method textDocument/rangeFormatting
Code: -32601
[Trace - 5:00:59 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///Users/dylan/Projects/Acnit/release_notes/20190826150200.yml",
"diagnostics": []
}
This problem disappears if in the VSCODE YAML extension settings, formatting is turned off.

I think the issue is that the format on paste VSCode setting automatically tries to call the language server protocol range formatting even if a language server doesn't explicitly say if they support it or not. (In the yaml-language-server case its undefined).
I think I can turn this off in the yaml-language-server and we should be good to go
very very noisy bug! pleaaaassssss fix it with hotfix update for users, thank you.
@AliMD What version are you on? Should already be fixed.
@JPinkney I still see the bug, although the solution provided by @subzerochi works temporarily.
I'm running the latest version of VS Code on Mac and version 0.5.2 of this plugin.
VS Code:
Version: 1.37.1
Commit: f06011ac164ae4dc8e753a3fe7f9549844d15e35
Date: 2019-08-15T16:16:34.800Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Darwin x64 15.6.0
Steps to reproduce:
bindings:
http:
code: 200
createOrders:, hit enter and then Cmd+V.[Error - 12:38:48 PM] Request textDocument/rangeFormatting failed.
Message: Unhandled method textDocument/rangeFormatting
Code: -32601
Hope it helps!
@JPinkney Can we get a newer version on the VSCode market place? Currently stuck at 0.5.2
I've uploaded a beta release of the next version: https://github.com/redhat-developer/vscode-yaml/releases/tag/0.5.3-beta. If people try it out and it works I will go ahead with a release tomorrow.
@JPinkney This still occurs for me with 0.5.3-beta.
@danielroe Can you post all the contents of view -> output -> then selecting YAML Support from the dropdown?
The original problem was that rangeFormatting was being enabled dynamically when the formatter was turned on but now rangeFormatting is off no matter what. With that vsix on my end I can no longer reproduce
@JPinkney Apologies! Looks like it's my problem. I had to quit and start again, rather than just reload, before installing the vsix in order to get the new version. Now properly installed, it's working beautifully.
@danielroe No worries! I just wanted to make sure the fix wasn't a 'works on my machine'. I'll probably release this fix this friday
I was just about to uninstall it but I kinda need the Kubernetes extension now and it wouldn't let me uninstall this one.. Glad it'll be released soon :)
Most helpful comment
@JPinkney I still see the bug, although the solution provided by @subzerochi works temporarily.
I'm running the latest version of VS Code on Mac and version 0.5.2 of this plugin.
VS Code:
Steps to reproduce:
createOrders:, hit enter and then Cmd+V.Hope it helps!