JSON language service extracted from VSCode to be reused, e.g in the Monaco editor.
Installations
npm install vscode-json-languageservice
Developer
Microsoft
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
20.16.0
NPM Version
10.8.1
Statistics
270 Stars
650 Commits
113 Forks
29 Watching
17 Branches
118 Contributors
Updated on 27 Nov 2024
Languages
TypeScript (99.75%)
JavaScript (0.25%)
Total Downloads
Cumulative downloads
Total Downloads
141,297,674
Last day
-1.4%
259,080
Compared to previous day
Last week
0.3%
1,407,711
Compared to previous week
Last month
10.9%
5,899,432
Compared to previous month
Last year
50.6%
48,607,470
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
vscode-json-languageservice
JSON language service extracted from VSCode to be reused, e.g in the Monaco editor.
Why?
The vscode-json-languageservice contains the language smarts behind the JSON editing experience of Visual Studio Code and the Monaco editor.
- doValidation analyses an input string and returns syntax and lint errors.
- doComplete provides completion proposals for a given location.
- doResolve resolves a completion proposals.
- doHover provides a hover text for a given location.
- findDocumentSymbols provides all symbols in the given document.
- findDocumentColors provides all color symbols in the given document.
- getColorPresentations returns available color formats for a color symbol.
- format formats the code at the given range.
- getFoldingRanges gets folding ranges for the given document.
- getSelectionRanges gets selection ranges for a given location.
- getMatchingSchemas matches a document against its schema and returns all AST nodes along with the matching sub schemas.
- parseJSONDocument creates a JSON document from source code.
- newJSONDocument creates a JSON document from an AST.
For the complete API see jsonLanguageService.ts and jsonLanguageTypes.ts
Installation
npm install --save vscode-json-languageservice
Sample usage
See sample.ts for an example on how to use the JSON language service.
To run the sample use yarn sample
Development
git clone https://github.com/microsoft/vscode-json-languageservice
cd vscode-json-languageservice
yarn
Use yarn test
to compile and run tests
How can I run and debug the service?
- open the folder in VSCode.
- set breakpoints, e.g. in
jsonCompletion.ts
- run the Unit tests from the run viewlet and wait until a breakpoint is hit:
How can I run and debug the service inside an instance of VSCode?
- run VSCode out of sources setup as described here: https://github.com/Microsoft/vscode/wiki/How-to-Contribute
- use
yarn link vscode-json-languageservice
invscode/extensions/json-language-features/server
to run VSCode with the latest changes fromvscode-json-languageservice
- run VSCode out of source (
vscode/scripts/code.sh|bat
) and open a.json
file - in VSCode window that is open on the
vscode-json-languageservice
sources, run commandDebug: Attach to Node process
and pick thecode-oss
process with thejson-language-features
path - set breakpoints, e.g. in
jsonCompletion.ts
- in the instance run from sources, invoke code completion in the
.json
file
No vulnerabilities found.
Reason
all changesets reviewed
Reason
security policy file detected
Details
- Info: security policy file detected: SECURITY.md:1
- Info: Found linked content: SECURITY.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1
- Info: Found text in security policy: SECURITY.md:1
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE.md:0
- Warn: project license file does not contain an FSF or OSI license.
Reason
1 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
Reason
1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/node.js.yml:1
- Info: no jobLevel write permissions found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/microsoft/vscode-json-languageservice/node.js.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/microsoft/vscode-json-languageservice/node.js.yml/main?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/node.js.yml:26
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 30 are checked with a SAST tool
Score
5.4
/10
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More