coc-yaml
coc-yaml copied to clipboard
yaml.schema incorrectly flags property
My coc-settings.json file has the following setting:
{
"yaml.schemas": {}
}
That's not a typo. I do not have any yaml schemas configured in my coc-settings.json file.
The Problem
When I edit a yaml file in .semaphore/deploy.yml
, coc-yaml flags all the top-level properties as invalid with the following message:
[yaml-schema: https://raw.githubusercontent.com/deployphp/deployer/master/src/schema.json] [E] Property version is not allowed.
Why is coc-yaml pulling a schema from deployphp/deployer? This doesn't happen for all yaml files.
Might be fixed on latest coc-yaml, also checkout the verbose output from your language server.
Updated to latest coc-yaml. Problem still occurs.
To duplicate, create a file named test-deploy.yml
with the following contents:
version: v1.0
With this, coc-yaml will flag version
as invalid using the yaml-schema mentioned in this issue.
What's funny is when I rename the file to deploy-test.yml
. Using this filename, coc-yaml does not complain.
Seems like coc-yaml is trying to guess and download a yaml schema based on the last word in the filename.
Should be problem of your language server, checkout https://github.com/neoclide/coc.nvim/wiki/Debug-language-server#using-output-channel
Here's the output from the yaml LSP output channel:
[Trace - 11:09:38 AM] Sending request 'initialize - (0)'.
Params: {
"processId": 22987,
"rootPath": "/home/stuff/lsp-testing",
"rootUri": "file:///home/stuff/lsp-testing",
"capabilities": {
"workspace": {
"applyEdit": true,
"workspaceEdit": {
"documentChanges": true,
"resourceOperations": [
"create",
"rename",
"delete"
],
"failureHandling": "textOnlyTransactional"
},
"didChangeConfiguration": {
"dynamicRegistration": true
},
"didChangeWatchedFiles": {
"dynamicRegistration": true
},
"symbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
},
"tagSupport": {
"valueSet": [
1
]
}
},
"executeCommand": {
"dynamicRegistration": true
},
"configuration": true,
"workspaceFolders": true
},
"textDocument": {
"publishDiagnostics": {
"relatedInformation": true,
"versionSupport": false,
"tagSupport": {
"valueSet": [
1,
2
]
}
},
"synchronization": {
"dynamicRegistration": true,
"willSave": true,
"willSaveWaitUntil": true,
"didSave": true
},
"completion": {
"dynamicRegistration": true,
"contextSupport": true,
"completionItem": {
"snippetSupport": true,
"commitCharactersSupport": true,
"documentationFormat": [
"markdown",
"plaintext"
],
"deprecatedSupport": true,
"preselectSupport": true
},
"completionItemKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
]
}
},
"hover": {
"dynamicRegistration": true,
"contentFormat": [
"markdown",
"plaintext"
]
},
"signatureHelp": {
"dynamicRegistration": true,
"signatureInformation": {
"documentationFormat": [
"markdown",
"plaintext"
],
"parameterInformation": {
"labelOffsetSupport": true
}
}
},
"definition": {
"dynamicRegistration": true
},
"references": {
"dynamicRegistration": true
},
"documentHighlight": {
"dynamicRegistration": true
},
"documentSymbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
},
"hierarchicalDocumentSymbolSupport": true,
"tagSupport": {
"valueSet": [
1
]
}
},
"codeAction": {
"dynamicRegistration": true,
"isPreferredSupport": true,
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"",
"quickfix",
"refactor",
"refactor.extract",
"refactor.inline",
"refactor.rewrite",
"source",
"source.organizeImports"
]
}
}
},
"codeLens": {
"dynamicRegistration": true
},
"formatting": {
"dynamicRegistration": true
},
"rangeFormatting": {
"dynamicRegistration": true
},
"onTypeFormatting": {
"dynamicRegistration": true
},
"rename": {
"dynamicRegistration": true,
"prepareSupport": true
},
"documentLink": {
"dynamicRegistration": true,
"tooltipSupport": true
},
"typeDefinition": {
"dynamicRegistration": true
},
"implementation": {
"dynamicRegistration": true
},
"declaration": {
"dynamicRegistration": true
},
"colorProvider": {
"dynamicRegistration": true
},
"foldingRange": {
"dynamicRegistration": true,
"rangeLimit": 5000,
"lineFoldingOnly": true
},
"selectionRange": {
"dynamicRegistration": true
}
},
"window": {
"workDoneProgress": true
}
},
"trace": "verbose",
"workspaceFolders": [
{
"uri": "file:///home/stuff/lsp-testing",
"name": "Desktop"
}
],
"clientInfo": {
"name": "coc.nvim",
"version": "0.0.79"
}
}
[Trace - 11:09:39 AM] Received response 'initialize - (0)' in 196ms.
Result: {
"capabilities": {
"textDocumentSync": 1,
"completionProvider": {
"resolveProvider": false
},
"hoverProvider": true,
"documentSymbolProvider": true,
"documentFormattingProvider": false,
"documentRangeFormattingProvider": false,
"documentLinkProvider": {},
"workspace": {
"workspaceFolders": {
"changeNotifications": true,
"supported": true
}
}
}
}
[Trace - 11:09:39 AM] Sending notification 'initialized'.
Params: {}
[Trace - 11:09:39 AM] Sending notification 'workspace/didChangeConfiguration'.
Params: {
"settings": {
"yaml": {
"execArgv": [
"--nolazy",
"--inspect-brk=6045"
],
"trace": {
"server": "verbose"
},
"schemas": {},
"format": {
"enable": false,
"singleQuote": false,
"bracketSpacing": true,
"proseWrap": "preserve"
},
"validate": true,
"hover": true,
"completion": true,
"customTags": []
},
"http": {
"proxyStrictSSL": true
},
"[yaml]": {}
}
}
[Trace - 11:09:39 AM] Sending notification 'textDocument/didOpen'.
Params: {
"textDocument": {
"uri": "file:///home/stuff/lsp-testing/test-deploy.yml",
"languageId": "yaml",
"version": 1,
"text": "version: v1.0\n"
}
}
[Trace - 11:09:39 AM] Sending notification 'json/schemaAssociations'.
Params: []
[Trace - 11:09:39 AM] Sending notification 'yaml/registerCustomSchemaRequest'.
No parameters provided.
[Trace - 11:09:39 AM] Sending notification 'yaml/registerVSCodeContentRequest'.
No parameters provided.
[Trace - 11:09:39 AM] Received request 'client/registerCapability - (0)'.
Params: {
"registrations": [
{
"id": "96e76749-c1b1-4379-8d36-219c037b8659",
"method": "workspace/didChangeWorkspaceFolders",
"registerOptions": {}
}
]
}
[Trace - 11:09:39 AM] Sending response 'client/registerCapability - (0)'. Processing request took 1ms
No result returned.
[Trace - 11:09:39 AM] Received request 'custom/schema/request - (1)'.
Params: "file:///home/stuff/lsp-testing/test-deploy.yml"
[Trace - 11:09:39 AM] Sending response 'custom/schema/request - (1)'. Processing request took 0ms
Result: []
[Trace - 11:09:39 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///home/stuff/lsp-testing/test-deploy.yml",
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 0,
"character": 7
}
},
"message": "Property version is not allowed.",
"severity": 1,
"source": "yaml-schema: https://raw.githubusercontent.com/deployphp/deployer/master/src/schema.json"
}
]
}
This is my coc-settings.json
file:
{
"yaml.trace.server": "verbose"
}
Confirmed this to be an issue with the following versions
coc-yaml 1.3.0 vim: NVIM v0.4.4 node: v14.15.1 coc.nvim: 0.0.80-7642d33d6
This is happening for me as well, file name build-and-deploy.yml
. This is a python project, the file is a github actions file.
coc: 0.0.80 coc-yaml: 1.3.0 node: v14.15.5 nvim: NVIM v0.4.4
This seems to be an issue with how https://www.schemastore.org/api/json/catalog.json is parsed.
GitHub Workflow
has .github/workflows/**.yml
defined but if your file ends in deploy.yml
, it's caught first by Deployer Recipe
Appreciate this issue has been open for a while, found it whilst googling as I have the same problem.
I have a GCP cloudbuild.yaml
file that I just could not get the LSP to point the right schema at, because it ended in build.yaml
it kept pointing the hammerkit schema at it. ¯_(ツ)_/¯
I am just adding that the latest release of the language server has nothing about this in their changelog so I suspect it's not been fixed. In any case, I have found a workaround that suits me:
I disable the schema store in my global config: "yaml.schemaStore.enable": false
Then do the mapping as normal in local:
"yaml.schemas": {
"http://json.schemastore.org/cloudbuild": ["cloudbuild.yaml"]
}
Hope this helps anyone else who might still have the issue.
Any solution to ignoring the Deployer Recipe
schema?
The solution for me was to :CocConfig
and add:
{
"yaml.schemaStore.enable": false,
"yaml.schemas": {}
}
My "solution" was to add this as a header to all my GitHub Actions workflow files... :/
# yaml-language-server: $schema=http://json-schema.org/draft-07/schema
There is yaml.selectSchema
command to choose another schema