coc-yaml cannot resolve $ref for ansiblem.json schema
Coc-yaml 1.8.0 reports the following error every time I open a *.yml file related to Ansible tasks.
[E][cocyaml] $ref '%2F%24defs%2Ftasks' in 'https://raw.githubusercontent.com/ansible-community/schemas/main/f/ansible.json' can not be resolved.
I have not seen this error in previous coc-yaml versions.
My setup is:
- vim 9.0
- coc-yaml 1.8.0
- vim plugins
- neoclide/coc.nvim, 'release' branch
- pearofducks/ansible-vim
- dense-analysis/ale
My :CocConfig is:
{
"diagnostic.displayByAle": true,
"suggest.autoTrigger": "always",
"suggest.triggerCompletionWait": 400,
"languageserver": {}
}
These are the CoC extensions I install via .vimrc:
let g:coc_global_extensions = [
\'coc-docker',
\'coc-go',
\'coc-json',
\'coc-pyright',
\'coc-sh',
\'coc-yaml',
\]
My knowledge about this topic is very limited, the URL for the ansible.json schema exists and there is a section for /$defs/tasks in it.
Seems language server issue. Checkout https://github.com/neoclide/coc.nvim/wiki/Debug-language-server#using-output-channel
Thanks for the tips.
I have added "yaml.trace.server": "verbose", to :CocConfig, I get this log when opening one of the affected yml files and run :CocCommand workspace.showOutput yaml:
[Trace - 12:47:31 PM] Sending request 'initialize - (0)'.
Params: {
"processId": 180505,
"rootPath": "/home/user/repo/my-ansible",
"rootUri": "file:///home/user/repo/my-ansible",
"capabilities": {
"workspace": {
"applyEdit": true,
"workspaceEdit": {
"documentChanges": true,
"resourceOperations": [
"create",
"rename",
"delete"
],
"failureHandling": "undo",
"normalizesLineEndings": true,
"changeAnnotationSupport": {
"groupsOnLabel": false
}
},
"didChangeConfiguration": {
"dynamicRegistration": true
},
"didChangeWatchedFiles": {
"dynamicRegistration": true
},
"codeLens": {
"refreshSupport": true
},
"executeCommand": {
"dynamicRegistration": true
},
"configuration": true,
"fileOperations": {
"dynamicRegistration": true,
"didCreate": true,
"didRename": true,
"didDelete": true,
"willCreate": true,
"willRename": true,
"willDelete": true
},
"semanticTokens": {
"refreshSupport": true
},
"inlayHint": {
"refreshSupport": true
},
"inlineValue": {
"refreshSupport": true
},
"diagnostics": {
"refreshSupport": 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
]
},
"resolveSupport": {
"properties": [
"location.range"
]
}
},
"workspaceFolders": true
},
"textDocument": {
"publishDiagnostics": {
"relatedInformation": true,
"versionSupport": true,
"tagSupport": {
"valueSet": [
1,
2
]
},
"codeDescriptionSupport": true,
"dataSupport": true
},
"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,
"insertReplaceSupport": true,
"tagSupport": {
"valueSet": [
1
]
},
"resolveSupport": {
"properties": [
"documentation",
"detail",
"additionalTextEdits"
]
},
"labelDetailsSupport": true,
"insertTextModeSupport": {
"valueSet": [
1,
2
]
}
},
"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
]
},
"insertTextMode": 2,
"completionList": {
"itemDefaults": [
"commitCharacters",
"editRange",
"insertTextFormat",
"insertTextMode"
]
}
},
"hover": {
"dynamicRegistration": true,
"contentFormat": [
"markdown",
"plaintext"
]
},
"signatureHelp": {
"dynamicRegistration": true,
"contextSupport": true,
"signatureInformation": {
"documentationFormat": [
"markdown",
"plaintext"
],
"activeParameterSupport": true,
"parameterInformation": {
"labelOffsetSupport": true
}
}
},
"references": {
"dynamicRegistration": true
},
"definition": {
"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
]
},
"labelSupport": true
},
"codeAction": {
"dynamicRegistration": true,
"isPreferredSupport": true,
"disabledSupport": true,
"dataSupport": true,
"honorsChangeAnnotations": false,
"resolveSupport": {
"properties": [
"edit"
]
},
"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
},
"callHierarchy": {
"dynamicRegistration": true
},
"linkedEditingRange": {
"dynamicRegistration": true
},
"semanticTokens": {
"dynamicRegistration": true,
"tokenTypes": [
"namespace",
"type",
"class",
"enum",
"interface",
"struct",
"typeParameter",
"parameter",
"variable",
"property",
"enumMember",
"event",
"function",
"method",
"macro",
"keyword",
"modifier",
"comment",
"string",
"number",
"regexp",
"decorator",
"operator"
],
"tokenModifiers": [
"declaration",
"definition",
"readonly",
"static",
"deprecated",
"abstract",
"async",
"modification",
"documentation",
"defaultLibrary"
],
"formats": [
"relative"
],
"requests": {
"range": true,
"full": {
"delta": true
}
},
"multilineTokenSupport": false,
"overlappingTokenSupport": false,
"serverCancelSupport": false,
"augmentsSyntaxTokens": false
},
"inlayHint": {
"dynamicRegistration": true,
"resolveSupport": {
"properties": [
"tooltip",
"textEdits",
"label.tooltip",
"label.location",
"label.command"
]
}
},
"inlineValue": {
"dynamicRegistration": true
},
"diagnostic": {
"dynamicRegistration": true,
"relatedDocumentSupport": false
},
"typeHierarchy": {
"dynamicRegistration": true
}
},
"window": {
"showMessage": {
"messageActionItem": {
"additionalPropertiesSupport": true
}
},
"showDocument": {
"support": true
},
"workDoneProgress": true
},
"general": {
"regularExpressions": {
"engine": "ECMAScript",
"version": "ES2020"
},
"markdown": {
"parser": "marked",
"version": "4.0.10"
},
"positionEncodings": [
"utf-16"
]
}
},
"trace": "verbose",
"workspaceFolders": [
{
"uri": "file:///home/user/repo/my-ansible",
"name": "spider-ansible-roles"
}
],
"locale": "en_US",
"clientInfo": {
"name": "coc.nvim",
"version": "0.0.82"
}
}
[Trace - 12:47:32 PM] Received response 'initialize - (0)' in 232ms.
Result: {
"capabilities": {
"textDocumentSync": 2,
"completionProvider": {
"resolveProvider": false
},
"hoverProvider": true,
"documentSymbolProvider": true,
"documentFormattingProvider": false,
"documentOnTypeFormattingProvider": {
"firstTriggerCharacter": "\n"
},
"documentRangeFormattingProvider": false,
"definitionProvider": true,
"documentLinkProvider": {},
"foldingRangeProvider": false,
"codeActionProvider": true,
"codeLensProvider": {
"resolveProvider": false
},
"executeCommandProvider": {
"commands": [
"jumpToSchema"
]
},
"workspace": {
"workspaceFolders": {
"changeNotifications": true,
"supported": true
}
}
}
}
[Trace - 12:47:32 PM] Sending notification 'initialized'.
Params: {}
[Trace - 12:47:32 PM] Sending notification 'textDocument/didOpen'.
Params: {
"textDocument": {
"uri": "file:///home/user/repo/my-ansible/roles/myrole/tasks/main.yml",
"languageId": "yaml",
"version": 1,
"text": "---\n# this is almost a check\n- name: Scratch space folder\n file:\n path: \"{{scratch_path }}\"\n state: directory\n owner: root\n mode: \"0775\"\n\n- name: Generate conf\n template:\n src: file.conf.j2\n dest: /etc/file.conf\n owner: \"{{ user }}\"\n group: \"{{ user }}\"\n mode: \"0644\"\n notify: restart_service\n\n- name: Enable service\n service:\n name: service\n state: started\n enabled: true\n"
}
}
[Trace - 12:47:32 PM] Sending notification 'json/schemaAssociations'.
Params: [
[]
]
[Trace - 12:47:32 PM] Sending notification 'yaml/registerCustomSchemaRequest'.
Params: [
null
]
[Trace - 12:47:32 PM] Sending notification 'yaml/registerVSCodeContentRequest'.
Params: [
null
]
[Trace - 12:47:32 PM] Sending notification 'yaml/supportSchemaSelection'.
Params: [
null
]
[Trace - 12:47:32 PM] Received request 'client/registerCapability - (0)'.
Params: {
"registrations": [
{
"id": "11314704-cea4-48cb-aea7-e81be26f2366",
"method": "workspace/didChangeWorkspaceFolders",
"registerOptions": {}
}
]
}
[Trace - 12:47:32 PM] Sending response 'client/registerCapability - (0)'. Processing request took 0ms
No result returned.
[Trace - 12:47:32 PM] Received request 'client/registerCapability - (1)'.
Params: {
"registrations": [
{
"id": "39f2ef03-4669-4f25-95ed-5a41809ad960",
"method": "workspace/didChangeConfiguration",
"registerOptions": {}
}
]
}
[Trace - 12:47:32 PM] Sending response 'client/registerCapability - (1)'. Processing request took 0ms
No result returned.
[Trace - 12:47:32 PM] Received request 'workspace/configuration - (2)'.
Params: {
"items": [
{
"section": "yaml"
},
{
"section": "http"
},
{
"section": "[yaml]"
}
]
}
[Trace - 12:47:32 PM] Sending response 'workspace/configuration - (2)'. Processing request took 0ms
Result: [
{
"enable": true,
"execArgv": [],
"trace": {
"server": "verbose"
},
"schemas": {},
"statusText": "Yaml",
"format": {
"enable": false,
"singleQuote": false,
"bracketSpacing": true,
"proseWrap": "preserve",
"printWidth": 80
},
"validate": true,
"hover": true,
"completion": true,
"customTags": [],
"schemaStore": {
"enable": true,
"url": "https://www.schemastore.org/api/json/catalog.json"
},
"disableAdditionalProperties": false,
"disableDefaultProperties": false,
"maxItemsComputed": 5000
},
{
"proxy": "",
"proxyStrictSSL": true,
"proxyAuthorization": null,
"proxyCA": null
},
null
]
[Trace - 12:47:32 PM] Received request 'custom/schema/request - (3)'.
Params: [
"file:///home/user/repo/my-ansible/roles/myrole/tasks/main.yml"
]
[Trace - 12:47:32 PM] Sending response 'custom/schema/request - (3)'. Processing request took 0ms
Result: []
[Trace - 12:47:32 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///home/user/repo/my-ansible/roles/myrole/tasks/main.yml",
"diagnostics": []
}
[Trace - 12:47:33 PM] Received notification 'yaml/schema/store/initialized'.
Params: {}
[Trace - 12:47:33 PM] Sending request 'yaml/get/jsonSchema - (1)'.
Params: [
"file:///home/user/repo/my-ansible/roles/myrole/tasks/main.yml"
]
[Trace - 12:47:33 PM] Received request 'custom/schema/request - (4)'.
Params: [
"file:///home/user/repo/my-ansible/roles/myrole/tasks/main.yml"
]
[Trace - 12:47:33 PM] Sending response 'custom/schema/request - (4)'. Processing request took 0ms
Result: []
[Trace - 12:47:33 PM] Received response 'yaml/get/jsonSchema - (1)' in 115ms.
Result: [
{
"name": "Ansible Schemas Bundle 22.4",
"uri": "https://raw.githubusercontent.com/ansible-community/schemas/main/f/ansible.json#%2F%24defs%2Ftasks"
}
]
[Trace - 12:47:33 PM] Received request 'custom/schema/request - (5)'.
Params: [
"file:///home/user/repo/my-ansible/roles/myrole/tasks/main.yml"
]
[Trace - 12:47:33 PM] Sending response 'custom/schema/request - (5)'. Processing request took 0ms
Result: []
[Trace - 12:47:33 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///home/user/repo/my-ansible/roles/myrole/tasks/main.yml",
"diagnostics": [
{
"range": {
"start": {
"line": 2,
"character": 0
},
"end": {
"line": 2,
"character": 1
}
},
"message": "$ref '%2F%24defs%2Ftasks' in 'https://raw.githubusercontent.com/ansible-community/schemas/main/f/ansible.json' can not be resolved.",
"severity": 1,
"code": 768,
"source": "YAML"
}
]
}
this seems to be a duplicate of https://github.com/neoclide/coc-yaml/issues/64