Json extension for coc.nvim
Published Package Summary
coc-json
Json language server extension for coc.nvim.
The server code is extracted from VSCode, which uses vscode-json-languageservice
For highlight of jsonc filetype, you may need jsonc.vim
Install
In your vim/neovim, run the following command:
:CocInstall coc-json
Features
Same as VSCode.
All features of vscode-json-languageservice are supported.
doCompletionfor JSON properties and values based on the document's JSON schema.doHoverfor values based on descriptions in the document's JSON schema.- Document Symbols for quick navigation to properties in the document.
- Document Colors for showing color decorators on values representing colors.
- Code Formatting supporting ranges and formatting the whole document.
- Diagnostics (Validation) are pushed for all open documents
- syntax errors
- structural validation based on the document's JSON schema.
FAQ
How to suppress error [json 521] [e] Comments are not permitted in JSON?
You can configure your vim to make that file with jsonc filetype to allow comment.
How to add custom schema definitions/properties?
You have two choices:
- use
$schemain your json. - create json schema file and then configure
json.schemasin yourcoc-settings.json, check out https://github.com/neoclide/coc-json/blob/06ea3ace3d0c0a8deaa70942d63345718f029612/package.json#L84
Quotes are hidden?
This is not caused by coc-json, you may checkout the conceallevel option.
License
MIT
- Json extension for coc.nvim
- onLanguage:json
- onLanguage:jsonc
- onCommand:json.clearCache
Want to build, test, or contribute to coc.nvim extensions? Explore our official SDK and testing toolkits.
Open Developer GuideVersion History
This published npm package does not include a history.md or changelog.md file. Browse its npm versions or repository releases for available release information.
Contributed Commands
All contributes.commands entries from the published package manifest for coc-json@1.9.8.
| Command (:CocCommand) | Description |
|---|---|
| json.sort | Soct JSON document |
| json.clearCache | Clear schema cache |
| json.retryResolveSchema | Retry schema resolve |
| json.selectSchema | Select JSON schema |
| json.showSchemaList | Show associated schemas |
| json.copy | Copy JSON path |
| json.validate | Validate JSON content against a schema |
| json.configureTrustedDomains | Configure trusted schema domains |
Configuration Schema
All contributes.configuration entries from the published package manifest, including each raw property schema for coc-settings.json.
Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable json language server"
}Raw JSON Schema
{
"type": "array",
"items": {
"type": "object",
"default": {
"url": "schemaURL",
"fileMatch": [
"/my-file"
]
},
"properties": {
"url": {
"type": "string",
"default": "/user.schema.json",
"markdownDescription": "Schema URL or path."
},
"schema": {
"$ref": "http://json-schema.org/draft-04/schema#",
"description": "Url of json schema, support file/url protocol."
},
"fileMatch": {
"type": "array",
"items": {
"type": "string",
"default": "MyFile.json",
"markdownDescription": "File pattern to match."
},
"minItems": 1,
"markdownDescription": "File patterns to match."
}
}
},
"scope": "resource",
"default": [],
"description": "Schemas associations for json files"
}Raw JSON Schema
{
"type": "array",
"items": {
"type": "string"
},
"default": []
}Raw JSON Schema
{
"enum": [
"off",
"messages",
"verbose"
],
"type": "string",
"default": "off"
}Raw JSON Schema
{
"type": "boolean",
"scope": "window",
"default": true,
"description": "Enable format for json server"
}Raw JSON Schema
{
"type": "boolean",
"scope": "window",
"default": true,
"description": "Enable/disable JSON validation."
}Raw JSON Schema
{
"type": "boolean",
"scope": "window",
"default": false,
"description": "Keep all existing new lines when formatting."
}Raw JSON Schema
{
"type": "number",
"default": 5000,
"description": "The maximum number of outline symbols and folding regions computed (limited for performance reasons)."
}Raw JSON Schema
{
"enum": [
"error",
"warning",
"ignore"
],
"type": "string",
"scope": "window",
"description": "Severity of problems when comments are not permitted in JSON."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable builtin schemas from https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/api/json/catalog.json"
}Raw JSON Schema
{
"tags": [
"usesOnlineServices"
],
"type": "boolean",
"default": true,
"description": "When enabled, JSON schemas can be fetched from http and https locations."
}Raw JSON Schema
{
"enum": [
"error",
"warning",
"ignore"
],
"type": "string",
"scope": "window",
"description": "Severity of problems when a schema cannot be resolved."
}Raw JSON Schema
{
"enum": [
"error",
"warning",
"ignore"
],
"type": "string",
"scope": "window",
"description": "Severity of trailing comma problems."
}Raw JSON Schema
{
"enum": [
"error",
"warning",
"ignore"
],
"type": "string",
"scope": "window",
"description": "Severity of problems from schema validation."
}Raw JSON Schema
{
"tags": [
"usesOnlineServices"
],
"type": "object",
"default": {},
"markdownDescription": "Trusted domains for downloading JSON schemas. Keys can be full domains, full URIs or wildcard patterns (`https://*.example.com`, `*`), values indicate trusted (`true`) or blocked (`false`).",
"additionalProperties": {
"type": "boolean"
}
}