# VSCode JSON Language Server
[![NPM Version](https://img.shields.io/npm/v/vscode-json-languageserver.svg)](https://npmjs.org/package/vscode-json-languageserver)
[![NPM Downloads](https://img.shields.io/npm/dm/vscode-json-languageserver.svg)](https://npmjs.org/package/vscode-json-languageserver)
[![NPM Version](https://img.shields.io/npm/l/vscode-json-languageserver.svg)](https://npmjs.org/package/vscode-json-languageserver)
The JSON Language server provides language-specific smarts for editing, validating and understanding JSON documents. It runs as a separate executable and implements the [language server protocol](https://microsoft.github.io/language-server-protocol/overview) to be connected by any code editor or IDE.
## Capabilities
### Server capabilities
The JSON language server supports requests on documents of language id `json` and `jsonc`.
- `json` documents are parsed and validated following the [JSON specification](https://tools.ietf.org/html/rfc7159).
- `jsonc` documents additionally accept single line (`//`) and multi-line comments (`/* ... */`). JSONC is a VSCode specific file format, intended for VSCode configuration files, without any aspirations to define a new common file format.
The server implements the following capabilities of the language server protocol:
- [Code completion](https://microsoft.github.io/language-server-protocol/specification#textDocument_completion) for JSON properties and values based on the document's [JSON schema](http://json-schema.org/) or based on existing properties and values used at other places in the document. JSON schemas are configured through the server configuration options.
- [Hover](https://microsoft.github.io/language-server-protocol/specification#textDocument_hover) for values based on descriptions in the document's [JSON schema](http://json-schema.org/).
- [Document Symbols](https://microsoft.github.io/language-server-protocol/specification#textDocument_documentSymbol) for quick navigation to properties in the document.
- [Document Colors](https://microsoft.github.io/language-server-protocol/specification#textDocument_documentColor) for showing color decorators on values representing colors and [Color Presentation](https://microsoft.github.io/language-server-protocol/specification#textDocument_colorPresentation) for color presentation information to support color pickers. The location of colors is defined by the document's [JSON schema](http://json-schema.org/). All values marked with `"format": "color-hex"` (VSCode specific, non-standard JSON Schema extension) are considered color values. The supported color formats are `#rgb[a]` and `#rrggbb[aa]`.
- [Code Formatting](https://microsoft.github.io/language-server-protocol/specification#textDocument_rangeFormatting) supporting ranges and formatting the whole document.
- [Folding Ranges](https://microsoft.github.io/language-server-protocol/specification#textDocument_foldingRange) for all folding ranges in the document.
- Semantic Selection for semantic selection for one or multiple cursor positions.
- [Goto Definition](https://microsoft.github.io/language-server-protocol/specification#textDocument_definition) for $ref references in JSON schemas
- [Diagnostics (Validation)](https://microsoft.github.io/language-server-protocol/specification#textDocument_publishDiagnostics) are pushed for all open documents
- syntax errors
- structural validation based on the document's [JSON schema](http://json-schema.org/).
In order to load JSON schemas, the JSON server uses NodeJS `http` and `fs` modules. For all other features, the JSON server only relies on the documents and settings provided by the client through the LSP.
### Client requirements:
The JSON language server expects the client to only send requests and notifications for documents of language id `json` and `jsonc`.
The JSON language server has the following dependencies on the client's capabilities:
- Code completion requires that the client capability has *snippetSupport*. If not supported by the client, the server will not offer the completion capability.
- Formatting support requires the client to support *dynamicRegistration* for *rangeFormatting*. If not supported by the client, the server will not offer the format capability.
## Configuration
### Initialization options
The client can send the following initialization options to the server:
- `provideFormatter: boolean | undefined`. If defined, the value defines whether the server provides the `documentRangeFormattingProvider` capability on initialization. If undefined, the setting `json.format.enable` is used to determine whether formatting is provided. The formatter will then be registered through dynamic registration. If the client does not support dynamic registration, no formatter will be available.
- `handledSchemaProtocols`: The URI schemas handles by the server. See section `Schema configuration` below.
- `customCapabilities`: Additional non-LSP client capabilities:
- `rangeFormatting: { editLimit: x } }`: For performance reasons, limit the number of edits returned by the range formatter to `x`.
### Settings
Clients may send a `workspace/didChangeConfiguration` notification to notify the server of settings changes.
The server supports the following settings:
- http
- `proxy`: The URL of the proxy server to use when fetching schema. When undefined or empty, no proxy is used.
- `proxyStrictSSL`: Whether the proxy server certificate should be verified against the list of supplied CAs.
- json
- `format`
- `enable`: Whether the server should register the formatting support. This option is only applicable if the client supports *dynamicRegistration* for *rangeFormatting* and `initializationOptions.provideFormatter` is not defined.
- `schemas`: Configures association of file names to schema URL or schemas and/or associations of schema URL to schema content.
- `fileMatch`: an array of file names or paths (separated by `/`). `*` can be used as a wildcard. Exclusion patterns can also be defined and start with '!'. A file matches when there at least one matching pattern and the last matching pattern is not an exclusion pattern.
- `url`: The URL of the schema, optional when also a schema is provided.
- `schema`: The schema content.
- `resultLimit`: The max number foldig ranges and otline symbols to be computed (for performance reasons)
```json
{
"http": {
"proxy": "",
"proxyStrictSSL": true
},
"json": {
"format": {
"enable": true
},
"schemas": [
{
"fileMatch": [
"foo.json",
"*.superfoo.json"
],
"url": "http://json.schemastore.org/foo",
"schema": {
"type": "array"
}
}
]
}
}
```
### Schema configuration and custom schema content delivery
[JSON schemas](http://json-schema.org/) are essential for code assist, hovers, color decorators to work and are required for structural validation.
To find the schema for a given JSON document, the server uses the following mechanisms:
- JSON documents can define the schema URL using a `$schema` property
- The settings define a schema association based on the documents URL. Settings can either associate a schema URL to a file or path pattern, and they can directly provide a schema.
- Additionally, schema associations can also be provided by a custom 'schemaAssociations' configuration call.
Schemas are identified by URLs. To load the content of a schema, the JSON language server either tries to load from that URI or path itself or delegates to the client.
The `initializationOptions.handledSchemaProtocols` initialization option defines which URLs are handled by the server. Requests for all other URIs are sent to the client.
`ha
没有合适的资源?快使用搜索试试~ 我知道了~
vscode-1.46.0.tar源码文件
需积分: 1 0 下载量 183 浏览量
2024-05-21
18:47:31
上传
评论
收藏 10.26MB GZ 举报
温馨提示
共2000个文件
ts:735个
json:564个
js:194个
vscode-1.46.0.tar源码文件vscode-1.46.0.tar源码文件 vscode-1.46.0.tar源码文件vscode-1.46.0.tar源码文件 vscode-1.46.0.tar源码文件vscode-1.46.0.tar源码文件 vscode-1.46.0.tar源码文件vscode-1.46.0.tar源码文件 vscode-1.46.0.tar源码文件vscode-1.46.0.tar源码文件 vscode-1.46.0.tar源码文件vscode-1.46.0.tar源码文件 vscode-1.46.0.tar源码文件vscode-1.46.0.tar源码文件 vscode-1.46.0.tar源码文件vscode-1.46.0.tar源码文件 vscode-1.46.0.tar源码文件vscode-1.46.0.tar源码文件 vscode-1.46.0.tar源码文件vscode-1.46.0.tar源码文件 vscode-1.46.0.tar源码文件vscode-1.46.0.tar源码文件
资源推荐
资源详情
资源评论
收起资源包目录
vscode-1.46.0.tar源码文件 (2000个子文件)
_code 3KB
inno-big-250.bmp 1.25MB
inno-big-225.bmp 730KB
inno-big-200.bmp 580KB
inno-big-175.bmp 445KB
inno-big-150.bmp 332KB
inno-big-125.bmp 217KB
inno-big-100.bmp 151KB
inno-small-250.bmp 57KB
inno-small-225.bmp 43KB
inno-small-200.bmp 34KB
inno-small-175.bmp 26KB
inno-small-150.bmp 20KB
inno-small-125.bmp 13KB
inno-small-100.bmp 9KB
test.c 818B
code.cmd 136B
code 1KB
es6.code-search 3KB
ts36031.code-search 625B
shared.code-snippets 1KB
test-78769.cpp 1KB
test.cpp 675B
test-92369.cpp 506B
test-80644.cpp 108B
test-23630.cpp 38B
test-23850.cpp 34B
auth.css 22KB
notebook.css 22KB
settingsEditor2.css 16KB
tabstitlecontrol.css 15KB
extensionEditor.css 13KB
suggest.css 12KB
review.css 10KB
searchview.css 8KB
style.css 8KB
standalone-tokens.css 7KB
keybindingsEditor.css 7KB
debugViewlet.css 7KB
issueReporter.css 7KB
terminal.css 7KB
welcomePage.css 7KB
markers.css 6KB
panelpart.css 6KB
activityaction.css 6KB
quickInput.css 6KB
scmViewlet.css 5KB
preferences.css 5KB
extensionsViewlet.css 5KB
feedback.css 5KB
findWidget.css 5KB
views.css 5KB
menu.css 5KB
settingsWidgets.css 5KB
notificationsList.css 4KB
walkThroughPart.css 4KB
markdown.css 4KB
xterm.css 4KB
notabstitlecontrol.css 4KB
paneview.css 4KB
welcomeOverlay.css 4KB
extension.css 4KB
searchEditor.css 4KB
searchEditor.css 4KB
titlebarpart.css 3KB
dialog.css 3KB
selectBoxCustom.css 3KB
statusbarpart.css 3KB
editorgroupview.css 3KB
titlecontrol.css 3KB
test.css 3KB
debug.contribution.css 3KB
processExplorer.css 3KB
highlight.css 3KB
list.css 3KB
simpleFindReplaceWidget.css 3KB
explorerviewlet.css 3KB
timelinePane.css 3KB
extensionActions.css 3KB
scrollbars.css 3KB
hover.css 3KB
openeditors.css 3KB
iconlabel.css 3KB
bulkEdit.css 3KB
parameterHints.css 3KB
part.css 2KB
repl.css 2KB
main.css 2KB
colorPicker.css 2KB
runtimeExtensionsEditor.css 2KB
actionbar.css 2KB
inputBox.css 2KB
watermark.css 2KB
breadcrumbscontrol.css 2KB
diffEditor.css 2KB
findInput.css 2KB
activitybarpart.css 2KB
peekViewWidget.css 2KB
gotoErrorWidget.css 2KB
debugHover.css 2KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
alin、m
- 粉丝: 104
- 资源: 49
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功