New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vscode-json-languageservice

Package Overview
Dependencies
Maintainers
7
Versions
165
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vscode-json-languageservice - npm Package Compare versions

Comparing version

to
3.10.0

lib/esm/services/jsonLinks.js

4

CHANGELOG.md

@@ -0,1 +1,5 @@

3.10.0 / 2020-11-03
=================
* new API `findLinks` return links for local `$ref` links. Replaces `findDefinition` which no longer returns results ( kept for API compatibility)
3.9.0 / 2020-09-28

@@ -2,0 +6,0 @@ =================

import { Thenable, ASTNode, Color, ColorInformation, ColorPresentation, LanguageServiceParams, LanguageSettings, DocumentLanguageSettings, FoldingRange, JSONSchema, SelectionRange, FoldingRangesContext, DocumentSymbolsContext, ColorInformationContext as DocumentColorsContext, TextDocument, Position, CompletionItem, CompletionList, Hover, Range, SymbolInformation, Diagnostic, TextEdit, FormattingOptions, DocumentSymbol, DefinitionLink, MatchingSchema } from './jsonLanguageTypes';
import { DocumentLink } from 'vscode-languageserver-types';
export declare type JSONDocument = {

@@ -27,3 +28,4 @@ root: ASTNode | undefined;

findDefinition(document: TextDocument, position: Position, doc: JSONDocument): Thenable<DefinitionLink[]>;
findLinks(document: TextDocument, doc: JSONDocument): Thenable<DocumentLink[]>;
}
export declare function getLanguageService(params: LanguageServiceParams): LanguageService;

5

lib/esm/jsonLanguageService.js

@@ -16,3 +16,3 @@ /*---------------------------------------------------------------------------------------------

import { Range, TextEdit } from './jsonLanguageTypes';
import { findDefinition } from './services/jsonDefinition';
import { findLinks } from './services/jsonLinks';
export * from './jsonLanguageTypes';

@@ -52,3 +52,4 @@ export function getLanguageService(params) {

getSelectionRanges: getSelectionRanges,
findDefinition: findDefinition,
findDefinition: function () { return Promise.resolve([]); },
findLinks: findLinks,
format: function (d, r, o) {

@@ -55,0 +56,0 @@ var range = undefined;

import { Thenable, ASTNode, Color, ColorInformation, ColorPresentation, LanguageServiceParams, LanguageSettings, DocumentLanguageSettings, FoldingRange, JSONSchema, SelectionRange, FoldingRangesContext, DocumentSymbolsContext, ColorInformationContext as DocumentColorsContext, TextDocument, Position, CompletionItem, CompletionList, Hover, Range, SymbolInformation, Diagnostic, TextEdit, FormattingOptions, DocumentSymbol, DefinitionLink, MatchingSchema } from './jsonLanguageTypes';
import { DocumentLink } from 'vscode-languageserver-types';
export declare type JSONDocument = {

@@ -27,3 +28,4 @@ root: ASTNode | undefined;

findDefinition(document: TextDocument, position: Position, doc: JSONDocument): Thenable<DefinitionLink[]>;
findLinks(document: TextDocument, doc: JSONDocument): Thenable<DocumentLink[]>;
}
export declare function getLanguageService(params: LanguageServiceParams): LanguageService;

@@ -21,3 +21,3 @@ /*---------------------------------------------------------------------------------------------

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "./services/jsonCompletion", "./services/jsonHover", "./services/jsonValidation", "./services/jsonDocumentSymbols", "./parser/jsonParser", "./services/configuration", "./services/jsonSchemaService", "./services/jsonFolding", "./services/jsonSelectionRanges", "jsonc-parser", "./jsonLanguageTypes", "./services/jsonDefinition", "./jsonLanguageTypes"], factory);
define(["require", "exports", "./services/jsonCompletion", "./services/jsonHover", "./services/jsonValidation", "./services/jsonDocumentSymbols", "./parser/jsonParser", "./services/configuration", "./services/jsonSchemaService", "./services/jsonFolding", "./services/jsonSelectionRanges", "jsonc-parser", "./jsonLanguageTypes", "./services/jsonLinks", "./jsonLanguageTypes"], factory);
}

@@ -39,3 +39,3 @@ })(function (require, exports) {

var jsonLanguageTypes_1 = require("./jsonLanguageTypes");
var jsonDefinition_1 = require("./services/jsonDefinition");
var jsonLinks_1 = require("./services/jsonLinks");
__exportStar(require("./jsonLanguageTypes"), exports);

@@ -75,3 +75,4 @@ function getLanguageService(params) {

getSelectionRanges: jsonSelectionRanges_1.getSelectionRanges,
findDefinition: jsonDefinition_1.findDefinition,
findDefinition: function () { return Promise.resolve([]); },
findLinks: jsonLinks_1.findLinks,
format: function (d, r, o) {

@@ -78,0 +79,0 @@ var range = undefined;

{
"name": "vscode-json-languageservice",
"version": "3.9.1",
"version": "3.10.0",
"description": "Language service for JSON",

@@ -5,0 +5,0 @@ "main": "./lib/umd/jsonLanguageService.js",

# vscode-json-languageservice
JSON language service extracted from VSCode to be reused, e.g in the Monaco editor.

@@ -9,35 +10,36 @@

Why?
----
## 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 proposal
- *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
- use *parseJSONDocument* create a JSON document from source code, or *newJSONDocument* to create the document from an AST.
- _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](./src/jsonLanguageService.ts) and [jsonLanguageTypes.ts](./src/jsonLanguageTypes.ts)
For the complete API see [jsonLanguageService.ts](./src/jsonLanguageService.ts) and [jsonLanguageTypes.ts](./src/jsonLanguageTypes.ts)
## Installation
Installation
------------
npm install --save vscode-json-languageservice
Development
-----------
## Development
git clone https://github.com/microsoft/vscode-json-languageservice
cd vscode-json-languageservice
yarn
- clone this repo, run yarn
- `yarn test` to compile and run tests
Use `yarn test` to compile and run tests
How can I run and debug the service?
### How can I run and debug the service?

@@ -47,7 +49,6 @@ - open the folder in VSCode.

- run the Unit tests from the run viewlet and wait until a breakpoint is hit:
![image](https://user-images.githubusercontent.com/6461412/94239202-bdad4e80-ff11-11ea-99c3-cb9dbeb1c0b2.png)
![image](https://user-images.githubusercontent.com/6461412/94239202-bdad4e80-ff11-11ea-99c3-cb9dbeb1c0b2.png)
### How can I run and debug the service inside an instance of VSCode?
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

@@ -57,4 +58,4 @@ - use `yarn link vscode-json-languageservice` in `vscode/extensions/json-language-features/server` to run VSCode with the latest changes from `vscode-json-languageservice`

- in VSCode window that is open on the `vscode-json-languageservice` sources, run command `Debug: Attach to Node process` and pick the `code-oss` process with the `json-language-features` path
![image](https://user-images.githubusercontent.com/6461412/94242925-061b3b00-ff17-11ea-8c17-8da15268f1a1.png)
![image](https://user-images.githubusercontent.com/6461412/94242925-061b3b00-ff17-11ea-8c17-8da15268f1a1.png)
- set breakpoints, e.g. in `jsonCompletion.ts`
- in the instance run from sources, invoke code completion in the `.json` file