massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-json / node_modules / vscode-json-languageservice / README.md
1 # vscode-json-languageservice
2
3 JSON language service extracted from VSCode to be reused, e.g in the Monaco editor.
4
5 [![npm Package](https://img.shields.io/npm/v/vscode-json-languageservice.svg?style=flat-square)](https://www.npmjs.org/package/vscode-json-languageservice)
6 [![NPM Downloads](https://img.shields.io/npm/dm/vscode-json-languageservice.svg)](https://npmjs.org/package/vscode-json-languageservice)
7 [![Build Status](https://travis-ci.org/Microsoft/vscode-json-languageservice.svg?branch=master)](https://travis-ci.org/Microsoft/vscode-json-languageservice)
8 [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
10 ## Why?
11
12 The _vscode-json-languageservice_ contains the language smarts behind the JSON editing experience of Visual Studio Code
13 and the Monaco editor.
14
15 - _doValidation_ analyses an input string and returns syntax and lint errors.
16 - _doComplete_ provides completion proposals for a given location.
17 - _doResolve_ resolves a completion proposals.
18 - _doHover_ provides a hover text for a given location.
19 - _findDocumentSymbols_ provides all symbols in the given document.
20 - _findDocumentColors_ provides all color symbols in the given document.
21 - _getColorPresentations_ returns available color formats for a color symbol.
22 - _format_ formats the code at the given range.
23 - _getFoldingRanges_ gets folding ranges for the given document.
24 - _getSelectionRanges_ gets selection ranges for a given location.
25 - _getMatchingSchemas_ matches a document against its schema and returns all AST nodes along with the matching sub schemas.
26 - _parseJSONDocument_ creates a JSON document from source code.
27 - _newJSONDocument_ creates a JSON document from an AST.
28
29 For the complete API see [jsonLanguageService.ts](./src/jsonLanguageService.ts) and [jsonLanguageTypes.ts](./src/jsonLanguageTypes.ts)
30
31 ## Installation
32
33     npm install --save vscode-json-languageservice
34
35 ## Sample usage
36
37 See [sample.ts](./src/example/sample.ts) for an example on how to use the JSON language service.
38
39 To run the sample use `yarn sample`
40
41 ## Development
42
43     git clone https://github.com/microsoft/vscode-json-languageservice
44     cd vscode-json-languageservice
45     yarn
46
47 Use `yarn test` to compile and run tests
48
49
50 ### How can I run and debug the service?
51
52 - open the folder in VSCode.
53 - set breakpoints, e.g. in `jsonCompletion.ts`
54 - run the Unit tests from the run viewlet and wait until a breakpoint is hit:
55   ![image](https://user-images.githubusercontent.com/6461412/94239202-bdad4e80-ff11-11ea-99c3-cb9dbeb1c0b2.png)
56
57 ### How can I run and debug the service inside an instance of VSCode?
58
59 - run VSCode out of sources setup as described here: https://github.com/Microsoft/vscode/wiki/How-to-Contribute
60 - use `yarn link vscode-json-languageservice` in `vscode/extensions/json-language-features/server` to run VSCode with the latest changes from `vscode-json-languageservice`
61 - run VSCode out of source (`vscode/scripts/code.sh|bat`) and open a `.json` file
62 - 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
63   ![image](https://user-images.githubusercontent.com/6461412/94242925-061b3b00-ff17-11ea-8c17-8da15268f1a1.png)
64 - set breakpoints, e.g. in `jsonCompletion.ts`
65 - in the instance run from sources, invoke code completion in the `.json` file