Merge monaco repositories
commit
5b763c4eb0
@ -0,0 +1,3 @@
|
||||
/node_modules/
|
||||
/out/
|
||||
/release/
|
@ -0,0 +1,12 @@
|
||||
/.vscode/
|
||||
/out/
|
||||
/scripts/
|
||||
/src/
|
||||
/test/
|
||||
/.gitignore
|
||||
/.npmignore
|
||||
/.prettierrc
|
||||
/.prettierignore
|
||||
/package-lock.json
|
||||
/webpack.dev.config.js
|
||||
/webpack.min.config.js
|
@ -0,0 +1,2 @@
|
||||
/out/
|
||||
/release/
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"arrowParens": "always",
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"semi": true,
|
||||
"useTabs": true,
|
||||
"printWidth": 100
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
"files.trimTrailingWhitespace": true,
|
||||
"search.exclude": {
|
||||
"**/node_modules": true,
|
||||
"**/release": true,
|
||||
"**/out": true
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Microsoft Corporation
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -0,0 +1,37 @@
|
||||
# Monaco CSS
|
||||
|
||||
CSS language plugin for the Monaco Editor. It provides the following features when editing CSS, LESS and SCSS files:
|
||||
|
||||
- Code completion
|
||||
- Hovers
|
||||
- Validation: Syntax errors and linting
|
||||
- Find definition, references & highlights for symbols in the same file
|
||||
- Document Symbols
|
||||
- Color Decorators
|
||||
|
||||
Linting an be configured through the API. See [here](https://github.com/Microsoft/monaco-css/blob/master/src/monaco.d.ts) for the API that the
|
||||
CSS plugin offers to configure the CSS/LESS/SCSS language support.
|
||||
|
||||
Internally the CSS plugin uses the [vscode-css-languageservice](https://github.com/Microsoft/vscode-css-languageservice)
|
||||
node module, providing the implementation of the functionally listed above. The same module is also used
|
||||
in [Visual Studio Code](https://github.com/Microsoft/vscode) to power the CSS, LESS and SCSS editing experience.
|
||||
|
||||
## Issues
|
||||
|
||||
Please file issues concering `monaco-css` in the [`monaco-editor` repository](https://github.com/Microsoft/monaco-editor/issues).
|
||||
|
||||
## Installing
|
||||
|
||||
This npm module is bundled and distributed in the [monaco-editor](https://www.npmjs.com/package/monaco-editor) npm module.
|
||||
|
||||
## Development
|
||||
|
||||
- `npm install .`
|
||||
- compile with `npm run compile`
|
||||
- watch with `npm run watch`
|
||||
- `npm run prepublishOnly`
|
||||
- open `$/monaco-css/test/index.html` in your favorite browser.
|
||||
|
||||
## License
|
||||
|
||||
[MIT](https://github.com/Microsoft/monaco-css/blob/master/LICENSE.md)
|
@ -0,0 +1,41 @@
|
||||
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.5 BLOCK -->
|
||||
|
||||
## Security
|
||||
|
||||
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
|
||||
|
||||
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](<https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)>), please report it to us as described below.
|
||||
|
||||
## Reporting Security Issues
|
||||
|
||||
**Please do not report security vulnerabilities through public GitHub issues.**
|
||||
|
||||
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).
|
||||
|
||||
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).
|
||||
|
||||
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
|
||||
|
||||
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
||||
|
||||
- Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
|
||||
- Full paths of source file(s) related to the manifestation of the issue
|
||||
- The location of the affected source code (tag/branch/commit or direct URL)
|
||||
- Any special configuration required to reproduce the issue
|
||||
- Step-by-step instructions to reproduce the issue
|
||||
- Proof-of-concept or exploit code (if possible)
|
||||
- Impact of the issue, including how an attacker might exploit the issue
|
||||
|
||||
This information will help us triage your report more quickly.
|
||||
|
||||
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs.
|
||||
|
||||
## Preferred Languages
|
||||
|
||||
We prefer all communications to be in English.
|
||||
|
||||
## Policy
|
||||
|
||||
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).
|
||||
|
||||
<!-- END MICROSOFT SECURITY.MD BLOCK -->
|
@ -0,0 +1,171 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/// <reference path="node_modules/monaco-editor-core/monaco.d.ts" />
|
||||
|
||||
declare namespace monaco.languages.css {
|
||||
export interface Options {
|
||||
readonly validate?: boolean;
|
||||
readonly lint?: {
|
||||
readonly compatibleVendorPrefixes?: 'ignore' | 'warning' | 'error';
|
||||
readonly vendorPrefix?: 'ignore' | 'warning' | 'error';
|
||||
readonly duplicateProperties?: 'ignore' | 'warning' | 'error';
|
||||
readonly emptyRules?: 'ignore' | 'warning' | 'error';
|
||||
readonly importStatement?: 'ignore' | 'warning' | 'error';
|
||||
readonly boxModel?: 'ignore' | 'warning' | 'error';
|
||||
readonly universalSelector?: 'ignore' | 'warning' | 'error';
|
||||
readonly zeroUnits?: 'ignore' | 'warning' | 'error';
|
||||
readonly fontFaceProperties?: 'ignore' | 'warning' | 'error';
|
||||
readonly hexColorLength?: 'ignore' | 'warning' | 'error';
|
||||
readonly argumentsInColorFunction?: 'ignore' | 'warning' | 'error';
|
||||
readonly unknownProperties?: 'ignore' | 'warning' | 'error';
|
||||
readonly ieHack?: 'ignore' | 'warning' | 'error';
|
||||
readonly unknownVendorSpecificProperties?: 'ignore' | 'warning' | 'error';
|
||||
readonly propertyIgnoredDueToDisplay?: 'ignore' | 'warning' | 'error';
|
||||
readonly important?: 'ignore' | 'warning' | 'error';
|
||||
readonly float?: 'ignore' | 'warning' | 'error';
|
||||
readonly idSelector?: 'ignore' | 'warning' | 'error';
|
||||
};
|
||||
/**
|
||||
* Configures the CSS data types known by the langauge service.
|
||||
*/
|
||||
readonly data?: CSSDataConfiguration;
|
||||
}
|
||||
export interface ModeConfiguration {
|
||||
/**
|
||||
* Defines whether the built-in completionItemProvider is enabled.
|
||||
*/
|
||||
readonly completionItems?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in hoverProvider is enabled.
|
||||
*/
|
||||
readonly hovers?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in documentSymbolProvider is enabled.
|
||||
*/
|
||||
readonly documentSymbols?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in definitions provider is enabled.
|
||||
*/
|
||||
readonly definitions?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in references provider is enabled.
|
||||
*/
|
||||
readonly references?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in references provider is enabled.
|
||||
*/
|
||||
readonly documentHighlights?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in rename provider is enabled.
|
||||
*/
|
||||
readonly rename?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in color provider is enabled.
|
||||
*/
|
||||
readonly colors?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in foldingRange provider is enabled.
|
||||
*/
|
||||
readonly foldingRanges?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in diagnostic provider is enabled.
|
||||
*/
|
||||
readonly diagnostics?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in selection range provider is enabled.
|
||||
*/
|
||||
readonly selectionRanges?: boolean;
|
||||
}
|
||||
export interface LanguageServiceDefaults {
|
||||
readonly languageId: string;
|
||||
readonly onDidChange: IEvent<LanguageServiceDefaults>;
|
||||
readonly modeConfiguration: ModeConfiguration;
|
||||
readonly options: Options;
|
||||
setOptions(options: Options): void;
|
||||
setModeConfiguration(modeConfiguration: ModeConfiguration): void;
|
||||
/** @deprecated Use options instead */
|
||||
readonly diagnosticsOptions: DiagnosticsOptions;
|
||||
/** @deprecated Use setOptions instead */
|
||||
setDiagnosticsOptions(options: DiagnosticsOptions): void;
|
||||
}
|
||||
/** @deprecated Use Options instead */
|
||||
export type DiagnosticsOptions = Options;
|
||||
export const cssDefaults: LanguageServiceDefaults;
|
||||
export const scssDefaults: LanguageServiceDefaults;
|
||||
export const lessDefaults: LanguageServiceDefaults;
|
||||
export interface CSSDataConfiguration {
|
||||
/**
|
||||
* Defines whether the standard CSS properties, at-directives, pseudoClasses and pseudoElements are shown.
|
||||
*/
|
||||
useDefaultDataProvider?: boolean;
|
||||
/**
|
||||
* Provides a set of custom data providers.
|
||||
*/
|
||||
dataProviders?: {
|
||||
[providerId: string]: CSSDataV1;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Custom CSS properties, at-directives, pseudoClasses and pseudoElements
|
||||
* https://github.com/microsoft/vscode-css-languageservice/blob/main/docs/customData.md
|
||||
*/
|
||||
export interface CSSDataV1 {
|
||||
version: 1 | 1.1;
|
||||
properties?: IPropertyData[];
|
||||
atDirectives?: IAtDirectiveData[];
|
||||
pseudoClasses?: IPseudoClassData[];
|
||||
pseudoElements?: IPseudoElementData[];
|
||||
}
|
||||
export type EntryStatus = 'standard' | 'experimental' | 'nonstandard' | 'obsolete';
|
||||
export interface IReference {
|
||||
name: string;
|
||||
url: string;
|
||||
}
|
||||
export interface IPropertyData {
|
||||
name: string;
|
||||
description?: string | MarkupContent;
|
||||
browsers?: string[];
|
||||
restrictions?: string[];
|
||||
status?: EntryStatus;
|
||||
syntax?: string;
|
||||
values?: IValueData[];
|
||||
references?: IReference[];
|
||||
relevance?: number;
|
||||
}
|
||||
export interface IAtDirectiveData {
|
||||
name: string;
|
||||
description?: string | MarkupContent;
|
||||
browsers?: string[];
|
||||
status?: EntryStatus;
|
||||
references?: IReference[];
|
||||
}
|
||||
export interface IPseudoClassData {
|
||||
name: string;
|
||||
description?: string | MarkupContent;
|
||||
browsers?: string[];
|
||||
status?: EntryStatus;
|
||||
references?: IReference[];
|
||||
}
|
||||
export interface IPseudoElementData {
|
||||
name: string;
|
||||
description?: string | MarkupContent;
|
||||
browsers?: string[];
|
||||
status?: EntryStatus;
|
||||
references?: IReference[];
|
||||
}
|
||||
export interface IValueData {
|
||||
name: string;
|
||||
description?: string | MarkupContent;
|
||||
browsers?: string[];
|
||||
status?: EntryStatus;
|
||||
references?: IReference[];
|
||||
}
|
||||
export interface MarkupContent {
|
||||
kind: MarkupKind;
|
||||
value: string;
|
||||
}
|
||||
export type MarkupKind = 'plaintext' | 'markdown';
|
||||
}
|
@ -0,0 +1,497 @@
|
||||
{
|
||||
"name": "monaco-css",
|
||||
"version": "3.9.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@types/minimatch": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz",
|
||||
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==",
|
||||
"dev": true
|
||||
},
|
||||
"ansi-styles": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-convert": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"array-differ": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz",
|
||||
"integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==",
|
||||
"dev": true
|
||||
},
|
||||
"array-union": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz",
|
||||
"integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==",
|
||||
"dev": true
|
||||
},
|
||||
"arrify": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz",
|
||||
"integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==",
|
||||
"dev": true
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
|
||||
"dev": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"buffer-from": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
|
||||
"integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==",
|
||||
"dev": true
|
||||
},
|
||||
"chalk": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
|
||||
"integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-styles": "^4.1.0",
|
||||
"supports-color": "^7.1.0"
|
||||
}
|
||||
},
|
||||
"color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-name": "~1.1.4"
|
||||
}
|
||||
},
|
||||
"color-name": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||
"dev": true
|
||||
},
|
||||
"commander": {
|
||||
"version": "2.20.3",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
|
||||
"dev": true
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
|
||||
"dev": true
|
||||
},
|
||||
"cross-spawn": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"path-key": "^3.1.0",
|
||||
"shebang-command": "^2.0.0",
|
||||
"which": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"end-of-stream": {
|
||||
"version": "1.4.4",
|
||||
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
|
||||
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"once": "^1.4.0"
|
||||
}
|
||||
},
|
||||
"execa": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz",
|
||||
"integrity": "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"cross-spawn": "^7.0.0",
|
||||
"get-stream": "^5.0.0",
|
||||
"human-signals": "^1.1.1",
|
||||
"is-stream": "^2.0.0",
|
||||
"merge-stream": "^2.0.0",
|
||||
"npm-run-path": "^4.0.0",
|
||||
"onetime": "^5.1.0",
|
||||
"signal-exit": "^3.0.2",
|
||||
"strip-final-newline": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"find-up": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
|
||||
"integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"locate-path": "^5.0.0",
|
||||
"path-exists": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"get-stream": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
|
||||
"integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"pump": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||
"dev": true
|
||||
},
|
||||
"human-signals": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz",
|
||||
"integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==",
|
||||
"dev": true
|
||||
},
|
||||
"husky": {
|
||||
"version": "5.1.3",
|
||||
"resolved": "https://registry.npmjs.org/husky/-/husky-5.1.3.tgz",
|
||||
"integrity": "sha512-fbNJ+Gz5wx2LIBtMweJNY1D7Uc8p1XERi5KNRMccwfQA+rXlxWNSdUxswo0gT8XqxywTIw7Ywm/F4v/O35RdMg==",
|
||||
"dev": true
|
||||
},
|
||||
"ignore": {
|
||||
"version": "5.1.8",
|
||||
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz",
|
||||
"integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==",
|
||||
"dev": true
|
||||
},
|
||||
"is-stream": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz",
|
||||
"integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==",
|
||||
"dev": true
|
||||
},
|
||||
"isexe": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
|
||||
"dev": true
|
||||
},
|
||||
"locate-path": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
|
||||
"integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"p-locate": "^4.1.0"
|
||||
}
|
||||
},
|
||||
"merge-stream": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
|
||||
"integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
|
||||
"dev": true
|
||||
},
|
||||
"mimic-fn": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
|
||||
"integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
|
||||
"dev": true
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
},
|
||||
"monaco-editor-core": {
|
||||
"version": "0.30.0",
|
||||
"resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.30.0.tgz",
|
||||
"integrity": "sha512-vFJ7BEOCqLv4xWgFW+UheI/PtccHHNht29lNmo79Re1kNhWCBLLb2nThjRMLPO1rd41vX9hhd9C07/iKOk9/jQ==",
|
||||
"dev": true
|
||||
},
|
||||
"monaco-languages": {
|
||||
"version": "2.11.0",
|
||||
"resolved": "https://registry.npmjs.org/monaco-languages/-/monaco-languages-2.11.0.tgz",
|
||||
"integrity": "sha512-fpeP8XUPejcdoUEMZ5bo4MW8VzEadhrsuyDtT48p2a2PSRT/CXptQm4eGnIfgxf5R95jrCZ0456c5dSEPBuktA==",
|
||||
"dev": true
|
||||
},
|
||||
"monaco-plugin-helpers": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/monaco-plugin-helpers/-/monaco-plugin-helpers-1.0.3.tgz",
|
||||
"integrity": "sha512-6AYI3ONAy8ki74qG2JqtFrLdiJHQlgeO5l4Rwr0OMyIpGXhc94y5rZuFxOtgGkxgSrZfHSwOt/MulUNZ/mOQOw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"typescript": "^2.7.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"typescript": {
|
||||
"version": "2.9.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz",
|
||||
"integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"mri": {
|
||||
"version": "1.1.6",
|
||||
"resolved": "https://registry.npmjs.org/mri/-/mri-1.1.6.tgz",
|
||||
"integrity": "sha512-oi1b3MfbyGa7FJMP9GmLTttni5JoICpYBRlq+x5V16fZbLsnL9N3wFqqIm/nIG43FjUFkFh9Epzp/kzUGUnJxQ==",
|
||||
"dev": true
|
||||
},
|
||||
"multimatch": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/multimatch/-/multimatch-4.0.0.tgz",
|
||||
"integrity": "sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/minimatch": "^3.0.3",
|
||||
"array-differ": "^3.0.0",
|
||||
"array-union": "^2.1.0",
|
||||
"arrify": "^2.0.1",
|
||||
"minimatch": "^3.0.4"
|
||||
}
|
||||
},
|
||||
"npm-run-path": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
|
||||
"integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"path-key": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"onetime": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
|
||||
"integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"mimic-fn": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"p-limit": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
|
||||
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"p-try": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"p-locate": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
|
||||
"integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"p-limit": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"p-try": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
|
||||
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
|
||||
"dev": true
|
||||
},
|
||||
"path-exists": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
|
||||
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
|
||||
"dev": true
|
||||
},
|
||||
"path-key": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
|
||||
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
|
||||
"dev": true
|
||||
},
|
||||
"prettier": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz",
|
||||
"integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==",
|
||||
"dev": true
|
||||
},
|
||||
"pretty-quick": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/pretty-quick/-/pretty-quick-3.1.0.tgz",
|
||||
"integrity": "sha512-DtxIxksaUWCgPFN7E1ZZk4+Aav3CCuRdhrDSFZENb404sYMtuo9Zka823F+Mgeyt8Zt3bUiCjFzzWYE9LYqkmQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "^3.0.0",
|
||||
"execa": "^4.0.0",
|
||||
"find-up": "^4.1.0",
|
||||
"ignore": "^5.1.4",
|
||||
"mri": "^1.1.5",
|
||||
"multimatch": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"pump": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
||||
"integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"end-of-stream": "^1.1.0",
|
||||
"once": "^1.3.1"
|
||||
}
|
||||
},
|
||||
"requirejs": {
|
||||
"version": "2.3.6",
|
||||
"resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.6.tgz",
|
||||
"integrity": "sha512-ipEzlWQe6RK3jkzikgCupiTbTvm4S0/CAU5GlgptkN5SO6F3u0UD0K18wy6ErDqiCyP4J4YYe1HuAShvsxePLg==",
|
||||
"dev": true
|
||||
},
|
||||
"shebang-command": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"shebang-regex": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"shebang-regex": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
|
||||
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
|
||||
"dev": true
|
||||
},
|
||||
"signal-exit": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
|
||||
"integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==",
|
||||
"dev": true
|
||||
},
|
||||
"source-map": {
|
||||
"version": "0.7.3",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
|
||||
"integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==",
|
||||
"dev": true
|
||||
},
|
||||
"source-map-support": {
|
||||
"version": "0.5.19",
|
||||
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz",
|
||||
"integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"buffer-from": "^1.0.0",
|
||||
"source-map": "^0.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"strip-final-newline": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz",
|
||||
"integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",
|
||||
"dev": true
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has-flag": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"terser": {
|
||||
"version": "5.7.0",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.7.0.tgz",
|
||||
"integrity": "sha512-HP5/9hp2UaZt5fYkuhNBR8YyRcT8juw8+uFbAme53iN9hblvKnLUTKkmwJG6ocWpIKf8UK4DoeWG4ty0J6S6/g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"commander": "^2.20.0",
|
||||
"source-map": "~0.7.2",
|
||||
"source-map-support": "~0.5.19"
|
||||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "4.3.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.2.tgz",
|
||||
"integrity": "sha512-zZ4hShnmnoVnAHpVHWpTcxdv7dWP60S2FsydQLV8V5PbS3FifjWFFRiHSWpDJahly88PRyV5teTSLoq4eG7mKw==",
|
||||
"dev": true
|
||||
},
|
||||
"vscode-css-languageservice": {
|
||||
"version": "5.1.8",
|
||||
"resolved": "https://registry.npmjs.org/vscode-css-languageservice/-/vscode-css-languageservice-5.1.8.tgz",
|
||||
"integrity": "sha512-Si1sMykS8U/p8LYgLGPCfZD1YFT0AtvUJQp9XJGw64DZWhtwYo28G2l64USLS9ge4ZPMZpwdpOK7PfbVKfgiiA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"vscode-languageserver-textdocument": "^1.0.1",
|
||||
"vscode-languageserver-types": "^3.16.0",
|
||||
"vscode-nls": "^5.0.0",
|
||||
"vscode-uri": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"vscode-languageserver-textdocument": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.2.tgz",
|
||||
"integrity": "sha512-T7uPC18+f8mYE4lbVZwb3OSmvwTZm3cuFhrdx9Bn2l11lmp3SvSuSVjy2JtvrghzjAo4G6Trqny2m9XGnFnWVA==",
|
||||
"dev": true
|
||||
},
|
||||
"vscode-languageserver-types": {
|
||||
"version": "3.16.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0.tgz",
|
||||
"integrity": "sha512-k8luDIWJWyenLc5ToFQQMaSrqCHiLwyKPHKPQZ5zz21vM+vIVUSvsRpcbiECH4WR88K2XZqc4ScRcZ7nk/jbeA==",
|
||||
"dev": true
|
||||
},
|
||||
"vscode-nls": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-5.0.0.tgz",
|
||||
"integrity": "sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==",
|
||||
"dev": true
|
||||
},
|
||||
"vscode-uri": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.2.tgz",
|
||||
"integrity": "sha512-jkjy6pjU1fxUvI51P+gCsxg1u2n8LSt0W6KrCNQceaziKzff74GoWmjVG46KieVzybO1sttPQmYfrwSHey7GUA==",
|
||||
"dev": true
|
||||
},
|
||||
"which": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"isexe": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "monaco-css",
|
||||
"version": "3.9.0",
|
||||
"description": "CSS, LESS and SCSS plugin for the Monaco Editor",
|
||||
"scripts": {
|
||||
"compile": "mrmdir ./out && tsc -p ./src/tsconfig.json && tsc -p ./src/tsconfig.esm.json && node ./scripts/dts && prettier --write ./monaco.d.ts",
|
||||
"watch": "tsc -p ./src --watch",
|
||||
"prepublishOnly": "mrmdir ./release && npm run compile && node ./scripts/release.js && node ./scripts/bundle && mcopy ./monaco.d.ts ./release/monaco.d.ts && mcopy ./out/esm/monaco.contribution.d.ts ./release/esm/monaco.contribution.d.ts && mcopy ./out/esm/fillers/monaco-editor-core.d.ts ./release/esm/fillers/monaco-editor-core.d.ts",
|
||||
"install-service-next": "npm install vscode-css-languageservice@next -f -D && npm install vscode-languageserver-types@next -f -D",
|
||||
"install-service-local": "npm install ../vscode-css-languageservice -f -D && npm install ../vscode-languageserver-node/types -f -D",
|
||||
"prettier": "prettier --write ."
|
||||
},
|
||||
"author": "Microsoft Corporation",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Microsoft/monaco-css"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Microsoft/monaco-css/issues"
|
||||
},
|
||||
"module": "./release/esm/monaco.contribution.js",
|
||||
"typings": "./release/esm/monaco.contribution.d.ts",
|
||||
"devDependencies": {
|
||||
"husky": "^5.1.3",
|
||||
"monaco-editor-core": "0.30.0",
|
||||
"monaco-languages": "2.11.0",
|
||||
"monaco-plugin-helpers": "^1.0.3",
|
||||
"prettier": "^2.2.1",
|
||||
"pretty-quick": "^3.1.0",
|
||||
"requirejs": "^2.3.6",
|
||||
"typescript": "4.3.2",
|
||||
"terser": "^5.7.0",
|
||||
"vscode-css-languageservice": "^5.1.8",
|
||||
"vscode-languageserver-types": "3.16.0",
|
||||
"vscode-languageserver-textdocument": "^1.0.2"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "pretty-quick --staged"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
const requirejs = require('requirejs');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const Terser = require('terser');
|
||||
const helpers = require('monaco-plugin-helpers');
|
||||
|
||||
const REPO_ROOT = path.resolve(__dirname, '..');
|
||||
|
||||
const sha1 = helpers.getGitVersion(REPO_ROOT);
|
||||
const semver = require('../package.json').version;
|
||||
const headerVersion = semver + '(' + sha1 + ')';
|
||||
|
||||
const BUNDLED_FILE_HEADER = [
|
||||
'/*!-----------------------------------------------------------------------------',
|
||||
' * Copyright (c) Microsoft Corporation. All rights reserved.',
|
||||
' * monaco-css version: ' + headerVersion,
|
||||
' * Released under the MIT license',
|
||||
' * https://github.com/Microsoft/monaco-css/blob/master/LICENSE.md',
|
||||
' *-----------------------------------------------------------------------------*/',
|
||||
''
|
||||
].join('\n');
|
||||
|
||||
bundleOne('monaco.contribution');
|
||||
bundleOne('cssMode', ['vs/language/css/monaco.contribution']);
|
||||
bundleOne('cssWorker');
|
||||
|
||||
function bundleOne(moduleId, exclude) {
|
||||
requirejs.optimize(
|
||||
{
|
||||
baseUrl: 'out/amd/',
|
||||
name: 'vs/language/css/' + moduleId,
|
||||
out: 'release/dev/' + moduleId + '.js',
|
||||
exclude: exclude,
|
||||
paths: {
|
||||
'vs/language/css': REPO_ROOT + '/out/amd',
|
||||
'vs/language/css/fillers/monaco-editor-core':
|
||||
REPO_ROOT + '/out/amd/fillers/monaco-editor-core-amd'
|
||||
},
|
||||
optimize: 'none',
|
||||
packages: [
|
||||
{
|
||||
name: 'vscode-css-languageservice',
|
||||
location: path.join(REPO_ROOT, 'node_modules/vscode-css-languageservice/lib/umd'),
|
||||
main: 'cssLanguageService'
|
||||
},
|
||||
{
|
||||
name: 'vscode-languageserver-types',
|
||||
location: path.join(REPO_ROOT, 'node_modules/vscode-languageserver-types/lib/umd'),
|
||||
main: 'main'
|
||||
},
|
||||
{
|
||||
name: 'vscode-languageserver-textdocument',
|
||||
location: path.join(REPO_ROOT, 'node_modules/vscode-languageserver-textdocument/lib/umd'),
|
||||
main: 'main'
|
||||
},
|
||||
{
|
||||
name: 'vscode-uri',
|
||||
location: path.join(REPO_ROOT, 'node_modules/vscode-uri/lib/umd'),
|
||||
main: 'index'
|
||||
},
|
||||
{
|
||||
name: 'vscode-nls',
|
||||
location: path.join(REPO_ROOT, '/out/amd/fillers'),
|
||||
main: 'vscode-nls'
|
||||
}
|
||||
]
|
||||
},
|
||||
async function (buildResponse) {
|
||||
const devFilePath = path.join(REPO_ROOT, 'release/dev/' + moduleId + '.js');
|
||||
const minFilePath = path.join(REPO_ROOT, 'release/min/' + moduleId + '.js');
|
||||
const fileContents = fs.readFileSync(devFilePath).toString();
|
||||
console.log();
|
||||
console.log(`Minifying ${devFilePath}...`);
|
||||
const result = await Terser.minify(fileContents, {
|
||||
output: {
|
||||
comments: 'some'
|
||||
}
|
||||
});
|
||||
console.log(`Done minifying ${devFilePath}.`);
|
||||
try {
|
||||
fs.mkdirSync(path.join(REPO_ROOT, 'release/min'));
|
||||
} catch (err) {}
|
||||
fs.writeFileSync(minFilePath, BUNDLED_FILE_HEADER + result.code);
|
||||
}
|
||||
);
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
const REPO_ROOT = path.join(__dirname, '../');
|
||||
const SRC_PATH = path.join(REPO_ROOT, 'out/amd/monaco.contribution.d.ts');
|
||||
const DST_PATH = path.join(REPO_ROOT, 'monaco.d.ts');
|
||||
|
||||
const lines = fs
|
||||
.readFileSync(SRC_PATH)
|
||||
.toString()
|
||||
.split(/\r\n|\r|\n/);
|
||||
let result = [
|
||||
`/*---------------------------------------------------------------------------------------------`,
|
||||
` * Copyright (c) Microsoft Corporation. All rights reserved.`,
|
||||
` * Licensed under the MIT License. See License.txt in the project root for license information.`,
|
||||
` *--------------------------------------------------------------------------------------------*/`,
|
||||
``,
|
||||
`/// <reference path="node_modules/monaco-editor-core/monaco.d.ts" />`,
|
||||
``,
|
||||
`declare namespace monaco.languages.css {`
|
||||
];
|
||||
for (let line of lines) {
|
||||
if (/^import/.test(line)) {
|
||||
continue;
|
||||
}
|
||||
line = line.replace(/ /g, '\t');
|
||||
line = line.replace(/declare /g, '');
|
||||
if (line.length > 0) {
|
||||
line = `\t${line}`;
|
||||
result.push(line);
|
||||
}
|
||||
}
|
||||
result.push(`}`);
|
||||
result.push(``);
|
||||
|
||||
fs.writeFileSync(DST_PATH, result.join('\n'));
|
@ -0,0 +1,26 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
const path = require('path');
|
||||
const helpers = require('monaco-plugin-helpers');
|
||||
|
||||
const REPO_ROOT = path.join(__dirname, '../');
|
||||
|
||||
helpers.packageESM({
|
||||
repoRoot: REPO_ROOT,
|
||||
esmSource: 'out/esm',
|
||||
esmDestination: 'release/esm',
|
||||
entryPoints: ['monaco.contribution.js', 'cssMode.js', 'css.worker.js'],
|
||||
resolveAlias: {
|
||||
'vscode-nls': path.join(REPO_ROOT, 'out/esm/fillers/vscode-nls.js')
|
||||
},
|
||||
resolveSkip: ['monaco-editor-core'],
|
||||
destinationFolderSimplification: {
|
||||
node_modules: '_deps',
|
||||
'vscode-languageserver-types/lib/esm': 'vscode-languageserver-types',
|
||||
'vscode-uri/lib/esm': 'vscode-uri',
|
||||
'vscode-css-languageservice/lib/esm': 'vscode-css-languageservice'
|
||||
}
|
||||
});
|
@ -0,0 +1,14 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as worker from 'monaco-editor-core/esm/vs/editor/editor.worker';
|
||||
import { CSSWorker } from './cssWorker';
|
||||
|
||||
self.onmessage = () => {
|
||||
// ignore the first message
|
||||
worker.initialize((ctx, createData) => {
|
||||
return new CSSWorker(ctx, createData);
|
||||
});
|
||||
};
|
@ -0,0 +1,122 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { WorkerManager } from './workerManager';
|
||||
import type { CSSWorker } from './cssWorker';
|
||||
import { LanguageServiceDefaults } from './monaco.contribution';
|
||||
import * as languageFeatures from './languageFeatures';
|
||||
import { Uri, IDisposable, languages } from './fillers/monaco-editor-core';
|
||||
|
||||
export function setupMode(defaults: LanguageServiceDefaults): IDisposable {
|
||||
const disposables: IDisposable[] = [];
|
||||
const providers: IDisposable[] = [];
|
||||
|
||||
const client = new WorkerManager(defaults);
|
||||
disposables.push(client);
|
||||
|
||||
const worker: languageFeatures.WorkerAccessor = (...uris: Uri[]): Promise<CSSWorker> => {
|
||||
return client.getLanguageServiceWorker(...uris);
|
||||
};
|
||||
|
||||
function registerProviders(): void {
|
||||
const { languageId, modeConfiguration } = defaults;
|
||||
|
||||
disposeAll(providers);
|
||||
|
||||
if (modeConfiguration.completionItems) {
|
||||
providers.push(
|
||||
languages.registerCompletionItemProvider(
|
||||
languageId,
|
||||
new languageFeatures.CompletionAdapter(worker)
|
||||
)
|
||||
);
|
||||
}
|
||||
if (modeConfiguration.hovers) {
|
||||
providers.push(
|
||||
languages.registerHoverProvider(languageId, new languageFeatures.HoverAdapter(worker))
|
||||
);
|
||||
}
|
||||
if (modeConfiguration.documentHighlights) {
|
||||
providers.push(
|
||||
languages.registerDocumentHighlightProvider(
|
||||
languageId,
|
||||
new languageFeatures.DocumentHighlightAdapter(worker)
|
||||
)
|
||||
);
|
||||
}
|
||||
if (modeConfiguration.definitions) {
|
||||
providers.push(
|
||||
languages.registerDefinitionProvider(
|
||||
languageId,
|
||||
new languageFeatures.DefinitionAdapter(worker)
|
||||
)
|
||||
);
|
||||
}
|
||||
if (modeConfiguration.references) {
|
||||
providers.push(
|
||||
languages.registerReferenceProvider(
|
||||
languageId,
|
||||
new languageFeatures.ReferenceAdapter(worker)
|
||||
)
|
||||
);
|
||||
}
|
||||
if (modeConfiguration.documentSymbols) {
|
||||
providers.push(
|
||||
languages.registerDocumentSymbolProvider(
|
||||
languageId,
|
||||
new languageFeatures.DocumentSymbolAdapter(worker)
|
||||
)
|
||||
);
|
||||
}
|
||||
if (modeConfiguration.rename) {
|
||||
providers.push(
|
||||
languages.registerRenameProvider(languageId, new languageFeatures.RenameAdapter(worker))
|
||||
);
|
||||
}
|
||||
if (modeConfiguration.colors) {
|
||||
providers.push(
|
||||
languages.registerColorProvider(
|
||||
languageId,
|
||||
new languageFeatures.DocumentColorAdapter(worker)
|
||||
)
|
||||
);
|
||||
}
|
||||
if (modeConfiguration.foldingRanges) {
|
||||
providers.push(
|
||||
languages.registerFoldingRangeProvider(
|
||||
languageId,
|
||||
new languageFeatures.FoldingRangeAdapter(worker)
|
||||
)
|
||||
);
|
||||
}
|
||||
if (modeConfiguration.diagnostics) {
|
||||
providers.push(new languageFeatures.DiagnosticsAdapter(languageId, worker, defaults));
|
||||
}
|
||||
if (modeConfiguration.selectionRanges) {
|
||||
providers.push(
|
||||
languages.registerSelectionRangeProvider(
|
||||
languageId,
|
||||
new languageFeatures.SelectionRangeAdapter(worker)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
registerProviders();
|
||||
|
||||
disposables.push(asDisposable(providers));
|
||||
|
||||
return asDisposable(disposables);
|
||||
}
|
||||
|
||||
function asDisposable(disposables: IDisposable[]): IDisposable {
|
||||
return { dispose: () => disposeAll(disposables) };
|
||||
}
|
||||
|
||||
function disposeAll(disposables: IDisposable[]) {
|
||||
while (disposables.length) {
|
||||
disposables.pop().dispose();
|
||||
}
|
||||
}
|
@ -0,0 +1,181 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import type { worker } from './fillers/monaco-editor-core';
|
||||
import * as cssService from 'vscode-css-languageservice';
|
||||
import { Options } from './monaco.contribution';
|
||||
|
||||
export class CSSWorker {
|
||||
// --- model sync -----------------------
|
||||
|
||||
private _ctx: worker.IWorkerContext;
|
||||
private _languageService: cssService.LanguageService;
|
||||
private _languageSettings: cssService.LanguageSettings;
|
||||
private _languageId: string;
|
||||
|
||||
constructor(ctx: worker.IWorkerContext, createData: ICreateData) {
|
||||
this._ctx = ctx;
|
||||
this._languageSettings = createData.options;
|
||||
this._languageId = createData.languageId;
|
||||
|
||||
const data = createData.options.data;
|
||||
|
||||
const useDefaultDataProvider = data?.useDefaultDataProvider;
|
||||
const customDataProviders: cssService.ICSSDataProvider[] = [];
|
||||
if (data?.dataProviders) {
|
||||
for (const id in data.dataProviders) {
|
||||
customDataProviders.push(cssService.newCSSDataProvider(data.dataProviders[id]));
|
||||
}
|
||||
}
|
||||
const lsOptions: cssService.LanguageServiceOptions = { customDataProviders, useDefaultDataProvider };
|
||||
|
||||
switch (this._languageId) {
|
||||
case 'css':
|
||||
this._languageService = cssService.getCSSLanguageService(lsOptions);
|
||||
break;
|
||||
case 'less':
|
||||
this._languageService = cssService.getLESSLanguageService(lsOptions);
|
||||
break;
|
||||
case 'scss':
|
||||
this._languageService = cssService.getSCSSLanguageService(lsOptions);
|
||||
break;
|
||||
default:
|
||||
throw new Error('Invalid language id: ' + this._languageId);
|
||||
}
|
||||
this._languageService.configure(this._languageSettings);
|
||||
}
|
||||
|
||||
// --- language service host ---------------
|
||||
|
||||
async doValidation(uri: string): Promise<cssService.Diagnostic[]> {
|
||||
let document = this._getTextDocument(uri);
|
||||
if (document) {
|
||||
let stylesheet = this._languageService.parseStylesheet(document);
|
||||
let diagnostics = this._languageService.doValidation(document, stylesheet);
|
||||
return Promise.resolve(diagnostics);
|
||||
}
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
async doComplete(uri: string, position: cssService.Position): Promise<cssService.CompletionList> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let stylesheet = this._languageService.parseStylesheet(document);
|
||||
let completions = this._languageService.doComplete(document, position, stylesheet);
|
||||
return Promise.resolve(completions);
|
||||
}
|
||||
async doHover(uri: string, position: cssService.Position): Promise<cssService.Hover> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let stylesheet = this._languageService.parseStylesheet(document);
|
||||
let hover = this._languageService.doHover(document, position, stylesheet);
|
||||
return Promise.resolve(hover);
|
||||
}
|
||||
async findDefinition(uri: string, position: cssService.Position): Promise<cssService.Location> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let stylesheet = this._languageService.parseStylesheet(document);
|
||||
let definition = this._languageService.findDefinition(document, position, stylesheet);
|
||||
return Promise.resolve(definition);
|
||||
}
|
||||
async findReferences(uri: string, position: cssService.Position): Promise<cssService.Location[]> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let stylesheet = this._languageService.parseStylesheet(document);
|
||||
let references = this._languageService.findReferences(document, position, stylesheet);
|
||||
return Promise.resolve(references);
|
||||
}
|
||||
async findDocumentHighlights(
|
||||
uri: string,
|
||||
position: cssService.Position
|
||||
): Promise<cssService.DocumentHighlight[]> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let stylesheet = this._languageService.parseStylesheet(document);
|
||||
let highlights = this._languageService.findDocumentHighlights(document, position, stylesheet);
|
||||
return Promise.resolve(highlights);
|
||||
}
|
||||
async findDocumentSymbols(uri: string): Promise<cssService.SymbolInformation[]> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let stylesheet = this._languageService.parseStylesheet(document);
|
||||
let symbols = this._languageService.findDocumentSymbols(document, stylesheet);
|
||||
return Promise.resolve(symbols);
|
||||
}
|
||||
async doCodeActions(
|
||||
uri: string,
|
||||
range: cssService.Range,
|
||||
context: cssService.CodeActionContext
|
||||
): Promise<cssService.Command[]> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let stylesheet = this._languageService.parseStylesheet(document);
|
||||
let actions = this._languageService.doCodeActions(document, range, context, stylesheet);
|
||||
return Promise.resolve(actions);
|
||||
}
|
||||
async findDocumentColors(uri: string): Promise<cssService.ColorInformation[]> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let stylesheet = this._languageService.parseStylesheet(document);
|
||||
let colorSymbols = this._languageService.findDocumentColors(document, stylesheet);
|
||||
return Promise.resolve(colorSymbols);
|
||||
}
|
||||
async getColorPresentations(
|
||||
uri: string,
|
||||
color: cssService.Color,
|
||||
range: cssService.Range
|
||||
): Promise<cssService.ColorPresentation[]> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let stylesheet = this._languageService.parseStylesheet(document);
|
||||
let colorPresentations = this._languageService.getColorPresentations(
|
||||
document,
|
||||
stylesheet,
|
||||
color,
|
||||
range
|
||||
);
|
||||
return Promise.resolve(colorPresentations);
|
||||
}
|
||||
async getFoldingRanges(
|
||||
uri: string,
|
||||
context?: { rangeLimit?: number }
|
||||
): Promise<cssService.FoldingRange[]> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let ranges = this._languageService.getFoldingRanges(document, context);
|
||||
return Promise.resolve(ranges);
|
||||
}
|
||||
async getSelectionRanges(
|
||||
uri: string,
|
||||
positions: cssService.Position[]
|
||||
): Promise<cssService.SelectionRange[]> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let stylesheet = this._languageService.parseStylesheet(document);
|
||||
let ranges = this._languageService.getSelectionRanges(document, positions, stylesheet);
|
||||
return Promise.resolve(ranges);
|
||||
}
|
||||
async doRename(
|
||||
uri: string,
|
||||
position: cssService.Position,
|
||||
newName: string
|
||||
): Promise<cssService.WorkspaceEdit> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let stylesheet = this._languageService.parseStylesheet(document);
|
||||
let renames = this._languageService.doRename(document, position, newName, stylesheet);
|
||||
return Promise.resolve(renames);
|
||||
}
|
||||
private _getTextDocument(uri: string): cssService.TextDocument {
|
||||
let models = this._ctx.getMirrorModels();
|
||||
for (let model of models) {
|
||||
if (model.uri.toString() === uri) {
|
||||
return cssService.TextDocument.create(
|
||||
uri,
|
||||
this._languageId,
|
||||
model.version,
|
||||
model.getValue()
|
||||
);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export interface ICreateData {
|
||||
languageId: string;
|
||||
options: Options
|
||||
}
|
||||
|
||||
export function create(ctx: worker.IWorkerContext, createData: ICreateData): CSSWorker {
|
||||
return new CSSWorker(ctx, createData);
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
// Resolves with the global monaco API
|
||||
|
||||
declare var define;
|
||||
|
||||
define([], function () {
|
||||
return (<any>self).monaco;
|
||||
});
|
@ -0,0 +1,6 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
export * from 'monaco-editor-core';
|
@ -0,0 +1,46 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
export interface Options {
|
||||
locale?: string;
|
||||
cacheLanguageResolution?: boolean;
|
||||
}
|
||||
export interface LocalizeInfo {
|
||||
key: string;
|
||||
comment: string[];
|
||||
}
|
||||
export interface LocalizeFunc {
|
||||
(info: LocalizeInfo, message: string, ...args: any[]): string;
|
||||
(key: string, message: string, ...args: any[]): string;
|
||||
}
|
||||
export interface LoadFunc {
|
||||
(file?: string): LocalizeFunc;
|
||||
}
|
||||
|
||||
function format(message: string, args: any[]): string {
|
||||
let result: string;
|
||||
|
||||
if (args.length === 0) {
|
||||
result = message;
|
||||
} else {
|
||||
result = message.replace(/\{(\d+)\}/g, (match, rest) => {
|
||||
let index = rest[0];
|
||||
return typeof args[index] !== 'undefined' ? args[index] : match;
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function localize(key: string | LocalizeInfo, message: string, ...args: any[]): string {
|
||||
return format(message, args);
|
||||
}
|
||||
|
||||
export function loadMessageBundle(file?: string): LocalizeFunc {
|
||||
return localize;
|
||||
}
|
||||
|
||||
export function config(opt?: Options | string): LoadFunc {
|
||||
return loadMessageBundle;
|
||||
}
|
@ -0,0 +1,725 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { LanguageServiceDefaults } from './monaco.contribution';
|
||||
import type { CSSWorker } from './cssWorker';
|
||||
import * as cssService from 'vscode-css-languageservice';
|
||||
import {
|
||||
languages,
|
||||
editor,
|
||||
IMarkdownString,
|
||||
Uri,
|
||||
Position,
|
||||
IRange,
|
||||
Range,
|
||||
CancellationToken,
|
||||
IDisposable,
|
||||
MarkerSeverity
|
||||
} from './fillers/monaco-editor-core';
|
||||
import { TextEdit } from 'vscode-css-languageservice';
|
||||
import { InsertReplaceEdit } from 'vscode-languageserver-types';
|
||||
|
||||
export interface WorkerAccessor {
|
||||
(first: Uri, ...more: Uri[]): Promise<CSSWorker>;
|
||||
}
|
||||
|
||||
// --- diagnostics --- ---
|
||||
|
||||
export class DiagnosticsAdapter {
|
||||
private _disposables: IDisposable[] = [];
|
||||
private _listener: { [uri: string]: IDisposable } = Object.create(null);
|
||||
|
||||
constructor(
|
||||
private _languageId: string,
|
||||
private _worker: WorkerAccessor,
|
||||
defaults: LanguageServiceDefaults
|
||||
) {
|
||||
const onModelAdd = (model: editor.IModel): void => {
|
||||
let modeId = model.getLanguageId();
|
||||
if (modeId !== this._languageId) {
|
||||
return;
|
||||
}
|
||||
|
||||
let handle: number;
|
||||
this._listener[model.uri.toString()] = model.onDidChangeContent(() => {
|
||||
window.clearTimeout(handle);
|
||||
handle = window.setTimeout(() => this._doValidate(model.uri, modeId), 500);
|
||||
});
|
||||
|
||||
this._doValidate(model.uri, modeId);
|
||||
};
|
||||
|
||||
const onModelRemoved = (model: editor.IModel): void => {
|
||||
editor.setModelMarkers(model, this._languageId, []);
|
||||
|
||||
let uriStr = model.uri.toString();
|
||||
let listener = this._listener[uriStr];
|
||||
if (listener) {
|
||||
listener.dispose();
|
||||
delete this._listener[uriStr];
|
||||
}
|
||||
};
|
||||
|
||||
this._disposables.push(editor.onDidCreateModel(onModelAdd));
|
||||
this._disposables.push(editor.onWillDisposeModel(onModelRemoved));
|
||||
this._disposables.push(
|
||||
editor.onDidChangeModelLanguage((event) => {
|
||||
onModelRemoved(event.model);
|
||||
onModelAdd(event.model);
|
||||
})
|
||||
);
|
||||
|
||||
defaults.onDidChange((_) => {
|
||||
editor.getModels().forEach((model) => {
|
||||
if (model.getLanguageId() === this._languageId) {
|
||||
onModelRemoved(model);
|
||||
onModelAdd(model);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
this._disposables.push({
|
||||
dispose: () => {
|
||||
for (let key in this._listener) {
|
||||
this._listener[key].dispose();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
editor.getModels().forEach(onModelAdd);
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this._disposables.forEach((d) => d && d.dispose());
|
||||
this._disposables = [];
|
||||
}
|
||||
|
||||
private _doValidate(resource: Uri, languageId: string): void {
|
||||
this._worker(resource)
|
||||
.then((worker) => {
|
||||
return worker.doValidation(resource.toString());
|
||||
})
|
||||
.then((diagnostics) => {
|
||||
const markers = diagnostics.map((d) => toDiagnostics(resource, d));
|
||||
let model = editor.getModel(resource);
|
||||
if (model && model.getLanguageId() === languageId) {
|
||||
editor.setModelMarkers(model, languageId, markers);
|
||||
}
|
||||
})
|
||||
.then(undefined, (err) => {
|
||||
console.error(err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function toSeverity(lsSeverity: number): MarkerSeverity {
|
||||
switch (lsSeverity) {
|
||||
case cssService.DiagnosticSeverity.Error:
|
||||
return MarkerSeverity.Error;
|
||||
case cssService.DiagnosticSeverity.Warning:
|
||||
return MarkerSeverity.Warning;
|
||||
case cssService.DiagnosticSeverity.Information:
|
||||
return MarkerSeverity.Info;
|
||||
case cssService.DiagnosticSeverity.Hint:
|
||||
return MarkerSeverity.Hint;
|
||||
default:
|
||||
return MarkerSeverity.Info;
|
||||
}
|
||||
}
|
||||
|
||||
function toDiagnostics(resource: Uri, diag: cssService.Diagnostic): editor.IMarkerData {
|
||||
let code = typeof diag.code === 'number' ? String(diag.code) : <string>diag.code;
|
||||
|
||||
return {
|
||||
severity: toSeverity(diag.severity),
|
||||
startLineNumber: diag.range.start.line + 1,
|
||||
startColumn: diag.range.start.character + 1,
|
||||
endLineNumber: diag.range.end.line + 1,
|
||||
endColumn: diag.range.end.character + 1,
|
||||
message: diag.message,
|
||||
code: code,
|
||||
source: diag.source
|
||||
};
|
||||
}
|
||||
|
||||
// --- completion ------
|
||||
|
||||
function fromPosition(position: Position): cssService.Position {
|
||||
if (!position) {
|
||||
return void 0;
|
||||
}
|
||||
return { character: position.column - 1, line: position.lineNumber - 1 };
|
||||
}
|
||||
|
||||
function fromRange(range: IRange): cssService.Range {
|
||||
if (!range) {
|
||||
return void 0;
|
||||
}
|
||||
return {
|
||||
start: {
|
||||
line: range.startLineNumber - 1,
|
||||
character: range.startColumn - 1
|
||||
},
|
||||
end: { line: range.endLineNumber - 1, character: range.endColumn - 1 }
|
||||
};
|
||||
}
|
||||
|
||||
function toRange(range: cssService.Range): Range {
|
||||
if (!range) {
|
||||
return void 0;
|
||||
}
|
||||
return new Range(
|
||||
range.start.line + 1,
|
||||
range.start.character + 1,
|
||||
range.end.line + 1,
|
||||
range.end.character + 1
|
||||
);
|
||||
}
|
||||
|
||||
function isInsertReplaceEdit(edit: TextEdit | InsertReplaceEdit): edit is InsertReplaceEdit {
|
||||
return (
|
||||
typeof (<InsertReplaceEdit>edit).insert !== 'undefined' &&
|
||||
typeof (<InsertReplaceEdit>edit).replace !== 'undefined'
|
||||
);
|
||||
}
|
||||
|
||||
function toCompletionItemKind(kind: number): languages.CompletionItemKind {
|
||||
let mItemKind = languages.CompletionItemKind;
|
||||
|
||||
switch (kind) {
|
||||
case cssService.CompletionItemKind.Text:
|
||||
return mItemKind.Text;
|
||||
case cssService.CompletionItemKind.Method:
|
||||
return mItemKind.Method;
|
||||
case cssService.CompletionItemKind.Function:
|
||||
return mItemKind.Function;
|
||||
case cssService.CompletionItemKind.Constructor:
|
||||
return mItemKind.Constructor;
|
||||
case cssService.CompletionItemKind.Field:
|
||||
return mItemKind.Field;
|
||||
case cssService.CompletionItemKind.Variable:
|
||||
return mItemKind.Variable;
|
||||
case cssService.CompletionItemKind.Class:
|
||||
return mItemKind.Class;
|
||||
case cssService.CompletionItemKind.Interface:
|
||||
return mItemKind.Interface;
|
||||
case cssService.CompletionItemKind.Module:
|
||||
return mItemKind.Module;
|
||||
case cssService.CompletionItemKind.Property:
|
||||
return mItemKind.Property;
|
||||
case cssService.CompletionItemKind.Unit:
|
||||
return mItemKind.Unit;
|
||||
case cssService.CompletionItemKind.Value:
|
||||
return mItemKind.Value;
|
||||
case cssService.CompletionItemKind.Enum:
|
||||
return mItemKind.Enum;
|
||||
case cssService.CompletionItemKind.Keyword:
|
||||
return mItemKind.Keyword;
|
||||
case cssService.CompletionItemKind.Snippet:
|
||||
return mItemKind.Snippet;
|
||||
case cssService.CompletionItemKind.Color:
|
||||
return mItemKind.Color;
|
||||
case cssService.CompletionItemKind.File:
|
||||
return mItemKind.File;
|
||||
case cssService.CompletionItemKind.Reference:
|
||||
return mItemKind.Reference;
|
||||
}
|
||||
return mItemKind.Property;
|
||||
}
|
||||
|
||||
function toTextEdit(textEdit: cssService.TextEdit): editor.ISingleEditOperation {
|
||||
if (!textEdit) {
|
||||
return void 0;
|
||||
}
|
||||
return {
|
||||
range: toRange(textEdit.range),
|
||||
text: textEdit.newText
|
||||
};
|
||||
}
|
||||
|
||||
function toCommand(c: cssService.Command | undefined): languages.Command {
|
||||
return c && c.command === 'editor.action.triggerSuggest' ? { id: c.command, title: c.title, arguments: c.arguments } : undefined
|
||||
}
|
||||
|
||||
export class CompletionAdapter implements languages.CompletionItemProvider {
|
||||
constructor(private _worker: WorkerAccessor) {}
|
||||
|
||||
public get triggerCharacters(): string[] {
|
||||
return ['/', '-', ':'];
|
||||
}
|
||||
|
||||
provideCompletionItems(
|
||||
model: editor.IReadOnlyModel,
|
||||
position: Position,
|
||||
context: languages.CompletionContext,
|
||||
token: CancellationToken
|
||||
): Promise<languages.CompletionList> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) => {
|
||||
return worker.doComplete(resource.toString(), fromPosition(position));
|
||||
})
|
||||
.then((info) => {
|
||||
if (!info) {
|
||||
return;
|
||||
}
|
||||
const wordInfo = model.getWordUntilPosition(position);
|
||||
const wordRange = new Range(
|
||||
position.lineNumber,
|
||||
wordInfo.startColumn,
|
||||
position.lineNumber,
|
||||
wordInfo.endColumn
|
||||
);
|
||||
|
||||
let items: languages.CompletionItem[] = info.items.map((entry) => {
|
||||
let item: languages.CompletionItem = {
|
||||
label: entry.label,
|
||||
insertText: entry.insertText || entry.label,
|
||||
sortText: entry.sortText,
|
||||
filterText: entry.filterText,
|
||||
documentation: entry.documentation,
|
||||
detail: entry.detail,
|
||||
command: toCommand(entry.command),
|
||||
range: wordRange,
|
||||
kind: toCompletionItemKind(entry.kind)
|
||||
};
|
||||
if (entry.textEdit) {
|
||||
if (isInsertReplaceEdit(entry.textEdit)) {
|
||||
item.range = {
|
||||
insert: toRange(entry.textEdit.insert),
|
||||
replace: toRange(entry.textEdit.replace)
|
||||
};
|
||||
} else {
|
||||
item.range = toRange(entry.textEdit.range);
|
||||
}
|
||||
item.insertText = entry.textEdit.newText;
|
||||
}
|
||||
if (entry.additionalTextEdits) {
|
||||
item.additionalTextEdits = entry.additionalTextEdits.map(toTextEdit);
|
||||
}
|
||||
if (entry.insertTextFormat === cssService.InsertTextFormat.Snippet) {
|
||||
item.insertTextRules = languages.CompletionItemInsertTextRule.InsertAsSnippet;
|
||||
}
|
||||
return item;
|
||||
});
|
||||
|
||||
return {
|
||||
isIncomplete: info.isIncomplete,
|
||||
suggestions: items
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function isMarkupContent(thing: any): thing is cssService.MarkupContent {
|
||||
return (
|
||||
thing && typeof thing === 'object' && typeof (<cssService.MarkupContent>thing).kind === 'string'
|
||||
);
|
||||
}
|
||||
|
||||
function toMarkdownString(
|
||||
entry: cssService.MarkupContent | cssService.MarkedString
|
||||
): IMarkdownString {
|
||||
if (typeof entry === 'string') {
|
||||
return {
|
||||
value: entry
|
||||
};
|
||||
}
|
||||
if (isMarkupContent(entry)) {
|
||||
if (entry.kind === 'plaintext') {
|
||||
return {
|
||||
value: entry.value.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&')
|
||||
};
|
||||
}
|
||||
return {
|
||||
value: entry.value
|
||||
};
|
||||
}
|
||||
|
||||
return { value: '```' + entry.language + '\n' + entry.value + '\n```\n' };
|
||||
}
|
||||
|
||||
function toMarkedStringArray(
|
||||
contents: cssService.MarkupContent | cssService.MarkedString | cssService.MarkedString[]
|
||||
): IMarkdownString[] {
|
||||
if (!contents) {
|
||||
return void 0;
|
||||
}
|
||||
if (Array.isArray(contents)) {
|
||||
return contents.map(toMarkdownString);
|
||||
}
|
||||
return [toMarkdownString(contents)];
|
||||
}
|
||||
|
||||
// --- hover ------
|
||||
|
||||
export class HoverAdapter implements languages.HoverProvider {
|
||||
constructor(private _worker: WorkerAccessor) {}
|
||||
|
||||
provideHover(
|
||||
model: editor.IReadOnlyModel,
|
||||
position: Position,
|
||||
token: CancellationToken
|
||||
): Promise<languages.Hover> {
|
||||
let resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) => {
|
||||
return worker.doHover(resource.toString(), fromPosition(position));
|
||||
})
|
||||
.then((info) => {
|
||||
if (!info) {
|
||||
return;
|
||||
}
|
||||
return <languages.Hover>{
|
||||
range: toRange(info.range),
|
||||
contents: toMarkedStringArray(info.contents)
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// --- document highlights ------
|
||||
|
||||
function toDocumentHighlightKind(kind: number): languages.DocumentHighlightKind {
|
||||
switch (kind) {
|
||||
case cssService.DocumentHighlightKind.Read:
|
||||
return languages.DocumentHighlightKind.Read;
|
||||
case cssService.DocumentHighlightKind.Write:
|
||||
return languages.DocumentHighlightKind.Write;
|
||||
case cssService.DocumentHighlightKind.Text:
|
||||
return languages.DocumentHighlightKind.Text;
|
||||
}
|
||||
return languages.DocumentHighlightKind.Text;
|
||||
}
|
||||
|
||||
export class DocumentHighlightAdapter implements languages.DocumentHighlightProvider {
|
||||
constructor(private _worker: WorkerAccessor) {}
|
||||
|
||||
public provideDocumentHighlights(
|
||||
model: editor.IReadOnlyModel,
|
||||
position: Position,
|
||||
token: CancellationToken
|
||||
): Promise<languages.DocumentHighlight[]> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) => {
|
||||
return worker.findDocumentHighlights(resource.toString(), fromPosition(position));
|
||||
})
|
||||
.then((entries) => {
|
||||
if (!entries) {
|
||||
return;
|
||||
}
|
||||
return entries.map((entry) => {
|
||||
return <languages.DocumentHighlight>{
|
||||
range: toRange(entry.range),
|
||||
kind: toDocumentHighlightKind(entry.kind)
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// --- definition ------
|
||||
|
||||
function toLocation(location: cssService.Location): languages.Location {
|
||||
return {
|
||||
uri: Uri.parse(location.uri),
|
||||
range: toRange(location.range)
|
||||
};
|
||||
}
|
||||
|
||||
export class DefinitionAdapter {
|
||||
constructor(private _worker: WorkerAccessor) {}
|
||||
|
||||
public provideDefinition(
|
||||
model: editor.IReadOnlyModel,
|
||||
position: Position,
|
||||
token: CancellationToken
|
||||
): Promise<languages.Definition> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) => {
|
||||
return worker.findDefinition(resource.toString(), fromPosition(position));
|
||||
})
|
||||
.then((definition) => {
|
||||
if (!definition) {
|
||||
return;
|
||||
}
|
||||
return [toLocation(definition)];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// --- references ------
|
||||
|
||||
export class ReferenceAdapter implements languages.ReferenceProvider {
|
||||
constructor(private _worker: WorkerAccessor) {}
|
||||
|
||||
provideReferences(
|
||||
model: editor.IReadOnlyModel,
|
||||
position: Position,
|
||||
context: languages.ReferenceContext,
|
||||
token: CancellationToken
|
||||
): Promise<languages.Location[]> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) => {
|
||||
return worker.findReferences(resource.toString(), fromPosition(position));
|
||||
})
|
||||
.then((entries) => {
|
||||
if (!entries) {
|
||||
return;
|
||||
}
|
||||
return entries.map(toLocation);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// --- rename ------
|
||||
|
||||
function toWorkspaceEdit(edit: cssService.WorkspaceEdit): languages.WorkspaceEdit {
|
||||
if (!edit || !edit.changes) {
|
||||
return void 0;
|
||||
}
|
||||
let resourceEdits: languages.WorkspaceTextEdit[] = [];
|
||||
for (let uri in edit.changes) {
|
||||
const _uri = Uri.parse(uri);
|
||||
// let edits: languages.TextEdit[] = [];
|
||||
for (let e of edit.changes[uri]) {
|
||||
resourceEdits.push({
|
||||
resource: _uri,
|
||||
edit: {
|
||||
range: toRange(e.range),
|
||||
text: e.newText
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return {
|
||||
edits: resourceEdits
|
||||
};
|
||||
}
|
||||
|
||||
export class RenameAdapter implements languages.RenameProvider {
|
||||
constructor(private _worker: WorkerAccessor) {}
|
||||
|
||||
provideRenameEdits(
|
||||
model: editor.IReadOnlyModel,
|
||||
position: Position,
|
||||
newName: string,
|
||||
token: CancellationToken
|
||||
): Promise<languages.WorkspaceEdit> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) => {
|
||||
return worker.doRename(resource.toString(), fromPosition(position), newName);
|
||||
})
|
||||
.then((edit) => {
|
||||
return toWorkspaceEdit(edit);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// --- document symbols ------
|
||||
|
||||
function toSymbolKind(kind: cssService.SymbolKind): languages.SymbolKind {
|
||||
let mKind = languages.SymbolKind;
|
||||
|
||||
switch (kind) {
|
||||
case cssService.SymbolKind.File:
|
||||
return mKind.Array;
|
||||
case cssService.SymbolKind.Module:
|
||||
return mKind.Module;
|
||||
case cssService.SymbolKind.Namespace:
|
||||
return mKind.Namespace;
|
||||
case cssService.SymbolKind.Package:
|
||||
return mKind.Package;
|
||||
case cssService.SymbolKind.Class:
|
||||
return mKind.Class;
|
||||
case cssService.SymbolKind.Method:
|
||||
return mKind.Method;
|
||||
case cssService.SymbolKind.Property:
|
||||
return mKind.Property;
|
||||
case cssService.SymbolKind.Field:
|
||||
return mKind.Field;
|
||||
case cssService.SymbolKind.Constructor:
|
||||
return mKind.Constructor;
|
||||
case cssService.SymbolKind.Enum:
|
||||
return mKind.Enum;
|
||||
case cssService.SymbolKind.Interface:
|
||||
return mKind.Interface;
|
||||
case cssService.SymbolKind.Function:
|
||||
return mKind.Function;
|
||||
case cssService.SymbolKind.Variable:
|
||||
return mKind.Variable;
|
||||
case cssService.SymbolKind.Constant:
|
||||
return mKind.Constant;
|
||||
case cssService.SymbolKind.String:
|
||||
return mKind.String;
|
||||
case cssService.SymbolKind.Number:
|
||||
return mKind.Number;
|
||||
case cssService.SymbolKind.Boolean:
|
||||
return mKind.Boolean;
|
||||
case cssService.SymbolKind.Array:
|
||||
return mKind.Array;
|
||||
}
|
||||
return mKind.Function;
|
||||
}
|
||||
|
||||
export class DocumentSymbolAdapter implements languages.DocumentSymbolProvider {
|
||||
constructor(private _worker: WorkerAccessor) {}
|
||||
|
||||
public provideDocumentSymbols(
|
||||
model: editor.IReadOnlyModel,
|
||||
token: CancellationToken
|
||||
): Promise<languages.DocumentSymbol[]> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) => worker.findDocumentSymbols(resource.toString()))
|
||||
.then((items) => {
|
||||
if (!items) {
|
||||
return;
|
||||
}
|
||||
return items.map((item) => ({
|
||||
name: item.name,
|
||||
detail: '',
|
||||
containerName: item.containerName,
|
||||
kind: toSymbolKind(item.kind),
|
||||
tags: [],
|
||||
range: toRange(item.location.range),
|
||||
selectionRange: toRange(item.location.range)
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class DocumentColorAdapter implements languages.DocumentColorProvider {
|
||||
constructor(private _worker: WorkerAccessor) {}
|
||||
|
||||
public provideDocumentColors(
|
||||
model: editor.IReadOnlyModel,
|
||||
token: CancellationToken
|
||||
): Promise<languages.IColorInformation[]> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) => worker.findDocumentColors(resource.toString()))
|
||||
.then((infos) => {
|
||||
if (!infos) {
|
||||
return;
|
||||
}
|
||||
return infos.map((item) => ({
|
||||
color: item.color,
|
||||
range: toRange(item.range)
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
public provideColorPresentations(
|
||||
model: editor.IReadOnlyModel,
|
||||
info: languages.IColorInformation,
|
||||
token: CancellationToken
|
||||
): Promise<languages.IColorPresentation[]> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) =>
|
||||
worker.getColorPresentations(resource.toString(), info.color, fromRange(info.range))
|
||||
)
|
||||
.then((presentations) => {
|
||||
if (!presentations) {
|
||||
return;
|
||||
}
|
||||
return presentations.map((presentation) => {
|
||||
let item: languages.IColorPresentation = {
|
||||
label: presentation.label
|
||||
};
|
||||
if (presentation.textEdit) {
|
||||
item.textEdit = toTextEdit(presentation.textEdit);
|
||||
}
|
||||
if (presentation.additionalTextEdits) {
|
||||
item.additionalTextEdits = presentation.additionalTextEdits.map(toTextEdit);
|
||||
}
|
||||
return item;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class FoldingRangeAdapter implements languages.FoldingRangeProvider {
|
||||
constructor(private _worker: WorkerAccessor) {}
|
||||
|
||||
public provideFoldingRanges(
|
||||
model: editor.IReadOnlyModel,
|
||||
context: languages.FoldingContext,
|
||||
token: CancellationToken
|
||||
): Promise<languages.FoldingRange[]> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) => worker.getFoldingRanges(resource.toString(), context))
|
||||
.then((ranges) => {
|
||||
if (!ranges) {
|
||||
return;
|
||||
}
|
||||
return ranges.map((range) => {
|
||||
let result: languages.FoldingRange = {
|
||||
start: range.startLine + 1,
|
||||
end: range.endLine + 1
|
||||
};
|
||||
if (typeof range.kind !== 'undefined') {
|
||||
result.kind = toFoldingRangeKind(<cssService.FoldingRangeKind>range.kind);
|
||||
}
|
||||
return result;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function toFoldingRangeKind(kind: cssService.FoldingRangeKind): languages.FoldingRangeKind {
|
||||
switch (kind) {
|
||||
case cssService.FoldingRangeKind.Comment:
|
||||
return languages.FoldingRangeKind.Comment;
|
||||
case cssService.FoldingRangeKind.Imports:
|
||||
return languages.FoldingRangeKind.Imports;
|
||||
case cssService.FoldingRangeKind.Region:
|
||||
return languages.FoldingRangeKind.Region;
|
||||
}
|
||||
}
|
||||
|
||||
export class SelectionRangeAdapter implements languages.SelectionRangeProvider {
|
||||
constructor(private _worker: WorkerAccessor) {}
|
||||
|
||||
public provideSelectionRanges(
|
||||
model: editor.IReadOnlyModel,
|
||||
positions: Position[],
|
||||
token: CancellationToken
|
||||
): Promise<languages.SelectionRange[][]> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) => worker.getSelectionRanges(resource.toString(), positions.map(fromPosition)))
|
||||
.then((selectionRanges) => {
|
||||
if (!selectionRanges) {
|
||||
return;
|
||||
}
|
||||
return selectionRanges.map((selectionRange) => {
|
||||
const result: languages.SelectionRange[] = [];
|
||||
while (selectionRange) {
|
||||
result.push({ range: toRange(selectionRange.range) });
|
||||
selectionRange = selectionRange.parent;
|
||||
}
|
||||
return result;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,318 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as mode from './cssMode';
|
||||
import { languages, Emitter, IEvent } from './fillers/monaco-editor-core';
|
||||
|
||||
export interface Options {
|
||||
readonly validate?: boolean;
|
||||
readonly lint?: {
|
||||
readonly compatibleVendorPrefixes?: 'ignore' | 'warning' | 'error';
|
||||
readonly vendorPrefix?: 'ignore' | 'warning' | 'error';
|
||||
readonly duplicateProperties?: 'ignore' | 'warning' | 'error';
|
||||
readonly emptyRules?: 'ignore' | 'warning' | 'error';
|
||||
readonly importStatement?: 'ignore' | 'warning' | 'error';
|
||||
readonly boxModel?: 'ignore' | 'warning' | 'error';
|
||||
readonly universalSelector?: 'ignore' | 'warning' | 'error';
|
||||
readonly zeroUnits?: 'ignore' | 'warning' | 'error';
|
||||
readonly fontFaceProperties?: 'ignore' | 'warning' | 'error';
|
||||
readonly hexColorLength?: 'ignore' | 'warning' | 'error';
|
||||
readonly argumentsInColorFunction?: 'ignore' | 'warning' | 'error';
|
||||
readonly unknownProperties?: 'ignore' | 'warning' | 'error';
|
||||
readonly ieHack?: 'ignore' | 'warning' | 'error';
|
||||
readonly unknownVendorSpecificProperties?: 'ignore' | 'warning' | 'error';
|
||||
readonly propertyIgnoredDueToDisplay?: 'ignore' | 'warning' | 'error';
|
||||
readonly important?: 'ignore' | 'warning' | 'error';
|
||||
readonly float?: 'ignore' | 'warning' | 'error';
|
||||
readonly idSelector?: 'ignore' | 'warning' | 'error';
|
||||
};
|
||||
/**
|
||||
* Configures the CSS data types known by the langauge service.
|
||||
*/
|
||||
readonly data?: CSSDataConfiguration;
|
||||
}
|
||||
|
||||
export interface ModeConfiguration {
|
||||
/**
|
||||
* Defines whether the built-in completionItemProvider is enabled.
|
||||
*/
|
||||
readonly completionItems?: boolean;
|
||||
|
||||
/**
|
||||
* Defines whether the built-in hoverProvider is enabled.
|
||||
*/
|
||||
readonly hovers?: boolean;
|
||||
|
||||
/**
|
||||
* Defines whether the built-in documentSymbolProvider is enabled.
|
||||
*/
|
||||
readonly documentSymbols?: boolean;
|
||||
|
||||
/**
|
||||
* Defines whether the built-in definitions provider is enabled.
|
||||
*/
|
||||
readonly definitions?: boolean;
|
||||
|
||||
/**
|
||||
* Defines whether the built-in references provider is enabled.
|
||||
*/
|
||||
readonly references?: boolean;
|
||||
|
||||
/**
|
||||
* Defines whether the built-in references provider is enabled.
|
||||
*/
|
||||
readonly documentHighlights?: boolean;
|
||||
|
||||
/**
|
||||
* Defines whether the built-in rename provider is enabled.
|
||||
*/
|
||||
readonly rename?: boolean;
|
||||
|
||||
/**
|
||||
* Defines whether the built-in color provider is enabled.
|
||||
*/
|
||||
readonly colors?: boolean;
|
||||
|
||||
/**
|
||||
* Defines whether the built-in foldingRange provider is enabled.
|
||||
*/
|
||||
readonly foldingRanges?: boolean;
|
||||
|
||||
/**
|
||||
* Defines whether the built-in diagnostic provider is enabled.
|
||||
*/
|
||||
readonly diagnostics?: boolean;
|
||||
|
||||
/**
|
||||
* Defines whether the built-in selection range provider is enabled.
|
||||
*/
|
||||
readonly selectionRanges?: boolean;
|
||||
}
|
||||
|
||||
export interface LanguageServiceDefaults {
|
||||
readonly languageId: string;
|
||||
readonly onDidChange: IEvent<LanguageServiceDefaults>;
|
||||
|
||||
readonly modeConfiguration: ModeConfiguration;
|
||||
readonly options: Options;
|
||||
setOptions(options: Options): void;
|
||||
setModeConfiguration(modeConfiguration: ModeConfiguration): void;
|
||||
|
||||
/** @deprecated Use options instead */
|
||||
readonly diagnosticsOptions: DiagnosticsOptions;
|
||||
/** @deprecated Use setOptions instead */
|
||||
setDiagnosticsOptions(options: DiagnosticsOptions): void;
|
||||
}
|
||||
|
||||
/** @deprecated Use Options instead */
|
||||
export type DiagnosticsOptions = Options;
|
||||
|
||||
// --- CSS configuration and defaults ---------
|
||||
|
||||
class LanguageServiceDefaultsImpl implements LanguageServiceDefaults {
|
||||
private _onDidChange = new Emitter<LanguageServiceDefaults>();
|
||||
private _options: Options;
|
||||
private _modeConfiguration: ModeConfiguration;
|
||||
private _languageId: string;
|
||||
|
||||
constructor(
|
||||
languageId: string,
|
||||
options: Options,
|
||||
modeConfiguration: ModeConfiguration
|
||||
) {
|
||||
this._languageId = languageId;
|
||||
this.setOptions(options);
|
||||
this.setModeConfiguration(modeConfiguration);
|
||||
}
|
||||
|
||||
get onDidChange(): IEvent<LanguageServiceDefaults> {
|
||||
return this._onDidChange.event;
|
||||
}
|
||||
|
||||
get languageId(): string {
|
||||
return this._languageId;
|
||||
}
|
||||
|
||||
get modeConfiguration(): ModeConfiguration {
|
||||
return this._modeConfiguration;
|
||||
}
|
||||
|
||||
get diagnosticsOptions(): Options {
|
||||
return this.options;
|
||||
}
|
||||
|
||||
get options(): Options {
|
||||
return this._options;
|
||||
}
|
||||
|
||||
setOptions(options: Options): void {
|
||||
this._options = options || Object.create(null);
|
||||
this._onDidChange.fire(this);
|
||||
}
|
||||
|
||||
setDiagnosticsOptions(options: Options): void {
|
||||
this.setOptions(options);
|
||||
}
|
||||
|
||||
setModeConfiguration(modeConfiguration: ModeConfiguration): void {
|
||||
this._modeConfiguration = modeConfiguration || Object.create(null);
|
||||
this._onDidChange.fire(this);
|
||||
}
|
||||
}
|
||||
|
||||
const optionsDefault: Required<Options> = {
|
||||
validate: true,
|
||||
lint: {
|
||||
compatibleVendorPrefixes: 'ignore',
|
||||
vendorPrefix: 'warning',
|
||||
duplicateProperties: 'warning',
|
||||
emptyRules: 'warning',
|
||||
importStatement: 'ignore',
|
||||
boxModel: 'ignore',
|
||||
universalSelector: 'ignore',
|
||||
zeroUnits: 'ignore',
|
||||
fontFaceProperties: 'warning',
|
||||
hexColorLength: 'error',
|
||||
argumentsInColorFunction: 'error',
|
||||
unknownProperties: 'warning',
|
||||
ieHack: 'ignore',
|
||||
unknownVendorSpecificProperties: 'ignore',
|
||||
propertyIgnoredDueToDisplay: 'warning',
|
||||
important: 'ignore',
|
||||
float: 'ignore',
|
||||
idSelector: 'ignore'
|
||||
},
|
||||
data: { useDefaultDataProvider: true }
|
||||
};
|
||||
|
||||
const modeConfigurationDefault: Required<ModeConfiguration> = {
|
||||
completionItems: true,
|
||||
hovers: true,
|
||||
documentSymbols: true,
|
||||
definitions: true,
|
||||
references: true,
|
||||
documentHighlights: true,
|
||||
rename: true,
|
||||
colors: true,
|
||||
foldingRanges: true,
|
||||
diagnostics: true,
|
||||
selectionRanges: true
|
||||
};
|
||||
|
||||
export const cssDefaults: LanguageServiceDefaults = new LanguageServiceDefaultsImpl(
|
||||
'css',
|
||||
optionsDefault,
|
||||
modeConfigurationDefault
|
||||
);
|
||||
export const scssDefaults: LanguageServiceDefaults = new LanguageServiceDefaultsImpl(
|
||||
'scss',
|
||||
optionsDefault,
|
||||
modeConfigurationDefault
|
||||
);
|
||||
export const lessDefaults: LanguageServiceDefaults = new LanguageServiceDefaultsImpl(
|
||||
'less',
|
||||
optionsDefault,
|
||||
modeConfigurationDefault
|
||||
);
|
||||
|
||||
// export to the global based API
|
||||
(<any>languages).css = { cssDefaults, lessDefaults, scssDefaults };
|
||||
|
||||
// --- Registration to monaco editor ---
|
||||
|
||||
function getMode(): Promise<typeof mode> {
|
||||
return import('./cssMode');
|
||||
}
|
||||
|
||||
languages.onLanguage('less', () => {
|
||||
getMode().then((mode) => mode.setupMode(lessDefaults));
|
||||
});
|
||||
|
||||
languages.onLanguage('scss', () => {
|
||||
getMode().then((mode) => mode.setupMode(scssDefaults));
|
||||
});
|
||||
|
||||
languages.onLanguage('css', () => {
|
||||
getMode().then((mode) => mode.setupMode(cssDefaults));
|
||||
});
|
||||
|
||||
|
||||
// CSS Data
|
||||
|
||||
export interface CSSDataConfiguration {
|
||||
/**
|
||||
* Defines whether the standard CSS properties, at-directives, pseudoClasses and pseudoElements are shown.
|
||||
*/
|
||||
useDefaultDataProvider?: boolean;
|
||||
/**
|
||||
* Provides a set of custom data providers.
|
||||
*/
|
||||
dataProviders?: { [providerId: string]: CSSDataV1 };
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom CSS properties, at-directives, pseudoClasses and pseudoElements
|
||||
* https://github.com/microsoft/vscode-css-languageservice/blob/main/docs/customData.md
|
||||
*/
|
||||
export interface CSSDataV1 {
|
||||
version: 1 | 1.1;
|
||||
properties?: IPropertyData[];
|
||||
atDirectives?: IAtDirectiveData[];
|
||||
pseudoClasses?: IPseudoClassData[];
|
||||
pseudoElements?: IPseudoElementData[];
|
||||
}
|
||||
|
||||
export type EntryStatus = 'standard' | 'experimental' | 'nonstandard' | 'obsolete';
|
||||
|
||||
export interface IReference {
|
||||
name: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
export interface IPropertyData {
|
||||
name: string;
|
||||
description?: string | MarkupContent;
|
||||
browsers?: string[];
|
||||
restrictions?: string[];
|
||||
status?: EntryStatus;
|
||||
syntax?: string;
|
||||
values?: IValueData[];
|
||||
references?: IReference[];
|
||||
relevance?: number;
|
||||
}
|
||||
export interface IAtDirectiveData {
|
||||
name: string;
|
||||
description?: string | MarkupContent;
|
||||
browsers?: string[];
|
||||
status?: EntryStatus;
|
||||
references?: IReference[];
|
||||
}
|
||||
export interface IPseudoClassData {
|
||||
name: string;
|
||||
description?: string | MarkupContent;
|
||||
browsers?: string[];
|
||||
status?: EntryStatus;
|
||||
references?: IReference[];
|
||||
}
|
||||
export interface IPseudoElementData {
|
||||
name: string;
|
||||
description?: string | MarkupContent;
|
||||
browsers?: string[];
|
||||
status?: EntryStatus;
|
||||
references?: IReference[];
|
||||
}
|
||||
|
||||
export interface IValueData {
|
||||
name: string;
|
||||
description?: string | MarkupContent;
|
||||
browsers?: string[];
|
||||
status?: EntryStatus;
|
||||
references?: IReference[];
|
||||
}
|
||||
export interface MarkupContent {
|
||||
kind: MarkupKind;
|
||||
value: string;
|
||||
}
|
||||
export declare type MarkupKind = 'plaintext' | 'markdown';
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "../out/esm",
|
||||
"declaration": true,
|
||||
"target": "es5",
|
||||
"lib": ["dom", "es5", "es2015.collection", "es2015.promise", "es2015.iterable"]
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "amd",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "../out/amd",
|
||||
"declaration": true,
|
||||
"target": "es5",
|
||||
"lib": ["dom", "es5", "es2015.collection", "es2015.promise", "es2015.iterable"]
|
||||
}
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { LanguageServiceDefaults } from './monaco.contribution';
|
||||
import type { CSSWorker } from './cssWorker';
|
||||
import { editor, IDisposable, Uri } from './fillers/monaco-editor-core';
|
||||
|
||||
const STOP_WHEN_IDLE_FOR = 2 * 60 * 1000; // 2min
|
||||
|
||||
export class WorkerManager {
|
||||
private _defaults: LanguageServiceDefaults;
|
||||
private _idleCheckInterval: number;
|
||||
private _lastUsedTime: number;
|
||||
private _configChangeListener: IDisposable;
|
||||
|
||||
private _worker: editor.MonacoWebWorker<CSSWorker>;
|
||||
private _client: Promise<CSSWorker>;
|
||||
|
||||
constructor(defaults: LanguageServiceDefaults) {
|
||||
this._defaults = defaults;
|
||||
this._worker = null;
|
||||
this._idleCheckInterval = window.setInterval(() => this._checkIfIdle(), 30 * 1000);
|
||||
this._lastUsedTime = 0;
|
||||
this._configChangeListener = this._defaults.onDidChange(() => this._stopWorker());
|
||||
}
|
||||
|
||||
private _stopWorker(): void {
|
||||
if (this._worker) {
|
||||
this._worker.dispose();
|
||||
this._worker = null;
|
||||
}
|
||||
this._client = null;
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
clearInterval(this._idleCheckInterval);
|
||||
this._configChangeListener.dispose();
|
||||
this._stopWorker();
|
||||
}
|
||||
|
||||
private _checkIfIdle(): void {
|
||||
if (!this._worker) {
|
||||
return;
|
||||
}
|
||||
let timePassedSinceLastUsed = Date.now() - this._lastUsedTime;
|
||||
if (timePassedSinceLastUsed > STOP_WHEN_IDLE_FOR) {
|
||||
this._stopWorker();
|
||||
}
|
||||
}
|
||||
|
||||
private _getClient(): Promise<CSSWorker> {
|
||||
this._lastUsedTime = Date.now();
|
||||
|
||||
if (!this._client) {
|
||||
this._worker = editor.createWebWorker<CSSWorker>({
|
||||
// module that exports the create() method and returns a `CSSWorker` instance
|
||||
moduleId: 'vs/language/css/cssWorker',
|
||||
|
||||
label: this._defaults.languageId,
|
||||
|
||||
// passed in to the create() method
|
||||
createData: {
|
||||
options: this._defaults.options,
|
||||
languageId: this._defaults.languageId
|
||||
}
|
||||
});
|
||||
|
||||
this._client = <Promise<CSSWorker>>(<any>this._worker.getProxy());
|
||||
}
|
||||
|
||||
return this._client;
|
||||
}
|
||||
|
||||
getLanguageServiceWorker(...resources: Uri[]): Promise<CSSWorker> {
|
||||
let _client: CSSWorker;
|
||||
return this._getClient()
|
||||
.then((client) => {
|
||||
_client = client;
|
||||
})
|
||||
.then((_) => {
|
||||
return this._worker.withSyncedResources(resources);
|
||||
})
|
||||
.then((_) => _client);
|
||||
}
|
||||
}
|
@ -0,0 +1,877 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<link
|
||||
rel="stylesheet"
|
||||
data-name="vs/editor/editor.main"
|
||||
href="../node_modules/monaco-editor-core/dev/vs/editor/editor.main.css"
|
||||
/>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Monaco Editor CSS test page</h2>
|
||||
<div id="container" style="width: 800px; height: 600px; border: 1px solid grey"></div>
|
||||
|
||||
<script>
|
||||
// Loading basic-languages to get the css language definition
|
||||
var paths = {
|
||||
'vs/basic-languages': '../node_modules/monaco-languages/release/dev',
|
||||
'vs/language/css': '../release/dev',
|
||||
vs: '../node_modules/monaco-editor-core/dev/vs'
|
||||
};
|
||||
if (document.location.protocol === 'http:') {
|
||||
// Add support for running local http server
|
||||
let testIndex = document.location.pathname.indexOf('/test/');
|
||||
if (testIndex !== -1) {
|
||||
let prefix = document.location.pathname.substr(0, testIndex);
|
||||
paths['vs/language/css'] = prefix + '/release/dev';
|
||||
}
|
||||
}
|
||||
var require = {
|
||||
paths: paths
|
||||
};
|
||||
</script>
|
||||
<script src="../node_modules/monaco-editor-core/dev/vs/loader.js"></script>
|
||||
<script src="../node_modules/monaco-editor-core/dev/vs/editor/editor.main.nls.js"></script>
|
||||
<script src="../node_modules/monaco-editor-core/dev/vs/editor/editor.main.js"></script>
|
||||
|
||||
<script>
|
||||
require([
|
||||
'vs/basic-languages/monaco.contribution',
|
||||
'vs/language/css/monaco.contribution'
|
||||
], function () {
|
||||
var editor = monaco.editor.create(document.getElementById('container'), {
|
||||
value: [
|
||||
'html {',
|
||||
' background-color: #e2e2e2;',
|
||||
' margin: 0;',
|
||||
' padding: 0;',
|
||||
'}',
|
||||
'',
|
||||
'body {',
|
||||
' background-color: #fff;',
|
||||
' border-top: solid 10px #000;',
|
||||
' color: #333;',
|
||||
' font-size: .85em;',
|
||||
' font-family: "Segoe UI", "HelveticaNeue-Light", sans-serif;',
|
||||
' margin: 0;',
|
||||
' padding: 0;',
|
||||
'}',
|
||||
'',
|
||||
'a:link, a:visited,',
|
||||
'a:active, a:hover {',
|
||||
' color: #333;',
|
||||
' outline: none;',
|
||||
' padding-left: 0;',
|
||||
' padding-right: 3px;',
|
||||
' text-decoration: none;',
|
||||
'}',
|
||||
'',
|
||||
'',
|
||||
'a:hover {',
|
||||
' background-color: #c7d1d6;',
|
||||
'}',
|
||||
'',
|
||||
'',
|
||||
'header, footer, hgroup',
|
||||
'nav, section {',
|
||||
' display: block;',
|
||||
'}',
|
||||
'',
|
||||
'.float-left {',
|
||||
' float: left;',
|
||||
'}',
|
||||
'',
|
||||
'.float-right {',
|
||||
' float: right;',
|
||||
'}',
|
||||
'',
|
||||
'.highlight {',
|
||||
'/* background-color: #a6dbed;',
|
||||
' padding-left: 5px;',
|
||||
' padding-right: 5px;*/',
|
||||
'}',
|
||||
'',
|
||||
'.clear-fix:after {',
|
||||
' content: ".";',
|
||||
' clear: both;',
|
||||
' display: block;',
|
||||
' height: 0;',
|
||||
' visibility: hidden;',
|
||||
'}',
|
||||
'',
|
||||
'h1, h2, h3,',
|
||||
'h4, h5, h6 {',
|
||||
' color: #000;',
|
||||
' margin-bottom: 0;',
|
||||
' padding-bottom: 0;',
|
||||
'',
|
||||
'}',
|
||||
'',
|
||||
'h1 {',
|
||||
' font-size: 2em;',
|
||||
'}',
|
||||
'',
|
||||
'h2 {',
|
||||
' font-size: 1.75em;',
|
||||
'}',
|
||||
'',
|
||||
'h3 {',
|
||||
' font-size: 1.2em;',
|
||||
'}',
|
||||
'',
|
||||
'h4 {',
|
||||
' font-size: 1.1em;',
|
||||
'}',
|
||||
'',
|
||||
'h5, h6 {',
|
||||
' font-size: 1em;',
|
||||
'}',
|
||||
'',
|
||||
'',
|
||||
'.tile {',
|
||||
' /* 2px solid #7ac0da; */',
|
||||
' border: 0;',
|
||||
'',
|
||||
' float: left;',
|
||||
' width: 200px;',
|
||||
' height: 325px;',
|
||||
'',
|
||||
' padding: 5px;',
|
||||
' margin-right: 5px;',
|
||||
' margin-bottom: 20px;',
|
||||
' margin-top: 20px;',
|
||||
' -webkit-perspective: 0;',
|
||||
' -webkit-transform-style: preserve-3d;',
|
||||
' -webkit-transition: -webkit-transform 0.2s;',
|
||||
' -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.3);',
|
||||
' background-position: center center;',
|
||||
' background-repeat: no-repeat;',
|
||||
'',
|
||||
' background-color: #fff;',
|
||||
'}',
|
||||
'',
|
||||
'.tile-item {',
|
||||
' /* 2px solid #7ac0da; */',
|
||||
' border-color: inherit;',
|
||||
' float: left;',
|
||||
' width: 50px;',
|
||||
' height: 70px;',
|
||||
' margin-right: 20px;',
|
||||
' margin-bottom: 20px;',
|
||||
' margin-top: 20px;',
|
||||
" background-image: url('../Images/documents.png');",
|
||||
' background-repeat: no-repeat;',
|
||||
'}',
|
||||
'',
|
||||
'.tile-wrapper {',
|
||||
' width: 100%;',
|
||||
' font-family: "Segoe UI" , Tahoma, Geneva, Verdana, sans-serif;',
|
||||
' line-height: 21px;',
|
||||
' font-size: 14px;',
|
||||
'}',
|
||||
'',
|
||||
'a.blue-box {',
|
||||
' font-size: 28px;',
|
||||
' height: 100px;',
|
||||
' display: block;',
|
||||
' border-style: solid;',
|
||||
' border-width: 1px 1px 4px 1px;',
|
||||
' border-color: #C0C0C0 #C0C0C0 #8ABAE4 #C0C0C0;',
|
||||
' padding-top: 15px;',
|
||||
' padding-left: 15px;',
|
||||
'}',
|
||||
'',
|
||||
' a.blue-box:hover {',
|
||||
' border: 4px solid #8ABAE4;',
|
||||
' padding-top: 12px;',
|
||||
' padding-left: 12px;',
|
||||
' background-color: #FFFFFF;',
|
||||
' }',
|
||||
'',
|
||||
'a.green-box {',
|
||||
' font-size: 28px;',
|
||||
' height: 100px;',
|
||||
' display: block;',
|
||||
' border-style: solid;',
|
||||
' border-width: 1px 1px 4px 1px;',
|
||||
' border-color: #C0C0C0 #C0C0C0 #9CCF42 #C0C0C0;',
|
||||
' padding-top: 15px;',
|
||||
' padding-left: 15px;',
|
||||
'}',
|
||||
'',
|
||||
' a.green-box:hover {',
|
||||
' border: 4px solid #9CCF42;',
|
||||
' padding-top: 12px;',
|
||||
' padding-left: 12px;',
|
||||
' background-color: #FFFFFF;',
|
||||
' }',
|
||||
'',
|
||||
'',
|
||||
'a.green-box2 {',
|
||||
' font-size: 14px;',
|
||||
' height: 48px;',
|
||||
' width: 48px;',
|
||||
' display: block; /* border-color: #C0C0C0; */',
|
||||
' padding-top: 6px;',
|
||||
' font-weight: bold;',
|
||||
'',
|
||||
'}',
|
||||
'',
|
||||
' a.green-box2:hover {',
|
||||
' border: solid #8ABAE4;',
|
||||
' padding-top: 0px;',
|
||||
' padding-left: 0px;',
|
||||
" background-image: url('../Images/documents.png');",
|
||||
' background-color: #EFEFEF;',
|
||||
' }',
|
||||
'',
|
||||
'a.yellow-box {',
|
||||
' font-size: 28px;',
|
||||
' height: 100px;',
|
||||
' display: block;',
|
||||
' border-style: solid;',
|
||||
' border-width: 1px 1px 4px 1px;',
|
||||
' border-color: #C0C0C0 #C0C0C0 #DECF6B #C0C0C0;',
|
||||
' padding-top: 15px;',
|
||||
' padding-left: 15px;',
|
||||
'}',
|
||||
'',
|
||||
' a.yellow-box:hover {',
|
||||
' border: 4px solid #DECF6B;',
|
||||
' padding-top: 12px;',
|
||||
' padding-left: 12px;',
|
||||
' background-color: #FFFFFF;',
|
||||
' }',
|
||||
'',
|
||||
'',
|
||||
'a.red-box {',
|
||||
' font-size: 28px;',
|
||||
' height: 100px;',
|
||||
' display: block;',
|
||||
' border-style: solid;',
|
||||
' border-width: 1px 1px 4px 1px;',
|
||||
' border-color: #C0C0C0 #C0C0C0 #F79E84 #C0C0C0;',
|
||||
' padding-top: 15px;',
|
||||
' padding-left: 15px;',
|
||||
'}',
|
||||
'',
|
||||
' a.red-box:hover {',
|
||||
' border: 4px solid #F79E84;',
|
||||
' padding-top: 12px;',
|
||||
' padding-left: 12px;',
|
||||
' background-color: #FFFFFF;',
|
||||
' }',
|
||||
'',
|
||||
'/* main layout',
|
||||
'----------------------------------------------------------*/',
|
||||
'.content-wrapper {',
|
||||
' margin: 0 auto;',
|
||||
' max-width: 960px;',
|
||||
'}',
|
||||
'',
|
||||
'#body {',
|
||||
' background-color: #efeeef;',
|
||||
' clear: both;',
|
||||
' padding-bottom: 35px;',
|
||||
'}',
|
||||
'',
|
||||
' .main-content {',
|
||||
' background: url("../images/accent.png") no-repeat;',
|
||||
' padding-left: 10px;',
|
||||
' padding-top: 30px;',
|
||||
' }',
|
||||
'',
|
||||
' .featured + .main-content {',
|
||||
' background: url("../images/heroaccent.png") no-repeat;',
|
||||
' }',
|
||||
'',
|
||||
'footer {',
|
||||
' clear: both;',
|
||||
' background-color: #e2e2e2;',
|
||||
' font-size: .8em;',
|
||||
' height: 100px;',
|
||||
'}',
|
||||
'',
|
||||
'',
|
||||
'/* site title',
|
||||
'----------------------------------------------------------*/',
|
||||
'.site-title {',
|
||||
' color: #0066CC; /* font-family: Rockwell, Consolas, "Courier New", Courier, monospace; */',
|
||||
' font-size: 3.3em;',
|
||||
' margin-top: 40px;',
|
||||
' margin-bottom: 0;',
|
||||
'}',
|
||||
'',
|
||||
'.site-title a, .site-title a:hover, .site-title a:active {',
|
||||
' background: none;',
|
||||
' color: #0066CC;',
|
||||
' outline: none;',
|
||||
' text-decoration: none;',
|
||||
'}',
|
||||
'',
|
||||
'',
|
||||
'/* login',
|
||||
'----------------------------------------------------------*/',
|
||||
'#login {',
|
||||
' display: block;',
|
||||
' font-size: .85em;',
|
||||
' margin-top: 20px;',
|
||||
' text-align: right;',
|
||||
'}',
|
||||
'',
|
||||
' #login a {',
|
||||
' background-color: #d3dce0;',
|
||||
' margin-left: 10px;',
|
||||
' margin-right: 3px;',
|
||||
' padding: 2px 3px;',
|
||||
' text-decoration: none;',
|
||||
' }',
|
||||
'',
|
||||
' #login a.username {',
|
||||
' background: none;',
|
||||
' margin-left: 0px;',
|
||||
' text-decoration: underline;',
|
||||
' }',
|
||||
'',
|
||||
' #login li {',
|
||||
' display: inline;',
|
||||
' list-style: none;',
|
||||
' }',
|
||||
'',
|
||||
'',
|
||||
'/* menu',
|
||||
'----------------------------------------------------------*/',
|
||||
'ul#menu {',
|
||||
' font-size: 1.3em;',
|
||||
' font-weight: 600;',
|
||||
' margin: 0;',
|
||||
' text-align: right;',
|
||||
' text-decoration: none;',
|
||||
'',
|
||||
'}',
|
||||
'',
|
||||
' ul#menu li {',
|
||||
' display: inline;',
|
||||
' list-style: none;',
|
||||
' padding-left: 15px;',
|
||||
' }',
|
||||
'',
|
||||
' ul#menu li a {',
|
||||
' background: none;',
|
||||
' color: #999;',
|
||||
' text-decoration: none;',
|
||||
' }',
|
||||
'',
|
||||
' ul#menu li a:hover {',
|
||||
' color: #333;',
|
||||
' text-decoration: none;',
|
||||
' }',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'/* page elements',
|
||||
'----------------------------------------------------------*/',
|
||||
'/* featured */',
|
||||
'.featured {',
|
||||
' background-color: #fff;',
|
||||
'}',
|
||||
'',
|
||||
' .featured .content-wrapper {',
|
||||
' /*background-color: #7ac0da;',
|
||||
' background-image: -ms-linear-gradient(left, #7AC0DA 0%, #A4D4E6 100%);',
|
||||
' background-image: -o-linear-gradient(left, #7AC0DA 0%, #A4D4E6 100%);',
|
||||
' background-image: -webkit-gradient(linear, left top, right top, color-stop(0, #7AC0DA), color-stop(1, #A4D4E6));',
|
||||
' background-image: -webkit-linear-gradient(left, #7AC0DA 0%, #A4D4E6 100%);',
|
||||
' background-image: linear-gradient(left, #7AC0DA 0%, #A4D4E6 100%);',
|
||||
' color: #3e5667;',
|
||||
' */',
|
||||
' padding: 0px 40px 30px 40px;',
|
||||
' }',
|
||||
'',
|
||||
' .featured hgroup.title h1, .featured hgroup.title h2 {',
|
||||
' /* color: #fff; */',
|
||||
' }',
|
||||
'',
|
||||
' .featured p {',
|
||||
' font-size: 1.1em;',
|
||||
' }',
|
||||
'',
|
||||
'/* page titles */',
|
||||
'hgroup.title {',
|
||||
' margin-bottom: 10px;',
|
||||
'}',
|
||||
'',
|
||||
'hgroup.title h1, hgroup.title h2 {',
|
||||
'display: inline;',
|
||||
'}',
|
||||
'',
|
||||
'hgroup.title h2 {',
|
||||
' font-weight: normal;',
|
||||
'}',
|
||||
'',
|
||||
'/* releases */',
|
||||
'.milestone {',
|
||||
' color: #fff;',
|
||||
' background-color: #8ABAE4;',
|
||||
' font-weight: normal;',
|
||||
' padding: 10px 10px 10px 10px;',
|
||||
' margin: 0 0 0 0;',
|
||||
'}',
|
||||
' .milestone .primary {',
|
||||
' font-size: 1.75em;',
|
||||
' }',
|
||||
'',
|
||||
' .milestone .secondary {',
|
||||
' font-size: 1.2em;',
|
||||
' font-weight: normal;',
|
||||
' /* padding: 5px 5px 5px 10px;*/',
|
||||
' }',
|
||||
'',
|
||||
'/* features */',
|
||||
'section.feature {',
|
||||
' width: 200px;',
|
||||
' float: left;',
|
||||
' padding: 10px;',
|
||||
'}',
|
||||
'',
|
||||
'/* ordered list */',
|
||||
'ol.round {',
|
||||
' list-style-type: none;',
|
||||
' padding-left: 0;',
|
||||
'}',
|
||||
'',
|
||||
' ol.round li {',
|
||||
' margin: 25px 0;',
|
||||
' padding-left: 45px;',
|
||||
' }',
|
||||
'',
|
||||
' ol.round li.one {',
|
||||
' background: url("../images/orderedlistOne.png") no-repeat;',
|
||||
' }',
|
||||
'',
|
||||
' ol.round li.two {',
|
||||
' background: url("../images/orderedlistTwo.png") no-repeat;',
|
||||
' }',
|
||||
'',
|
||||
' ol.round li.three {',
|
||||
' background: url("../images/orderedlistThree.png") no-repeat;',
|
||||
' }',
|
||||
'',
|
||||
'/* content */',
|
||||
'article {',
|
||||
' float: left;',
|
||||
' width: 70%;',
|
||||
'}',
|
||||
'',
|
||||
'aside {',
|
||||
' float: right;',
|
||||
' width: 25%;',
|
||||
'}',
|
||||
'',
|
||||
' aside ul {',
|
||||
' list-style: none;',
|
||||
' padding: 0;',
|
||||
' }',
|
||||
'',
|
||||
' aside ul li {',
|
||||
' background: url("../images/bullet.png") no-repeat 0 50%;',
|
||||
' padding: 2px 0 2px 20px;',
|
||||
' }',
|
||||
'',
|
||||
'.label {',
|
||||
' font-weight: 700;',
|
||||
'}',
|
||||
'',
|
||||
'/* login page */',
|
||||
'#loginForm {',
|
||||
' border-right: solid 2px #c8c8c8;',
|
||||
' float: left;',
|
||||
' width: 45%;',
|
||||
'}',
|
||||
'',
|
||||
' #loginForm .validation-error {',
|
||||
' display: block;',
|
||||
' margin-left: 15px;',
|
||||
' }',
|
||||
'',
|
||||
'#socialLoginForm {',
|
||||
' margin-left: 40px;',
|
||||
' float: left;',
|
||||
' width: 50%;',
|
||||
'}',
|
||||
'',
|
||||
'/* contact */',
|
||||
'.contact h3 {',
|
||||
' font-size: 1.2em;',
|
||||
'}',
|
||||
'',
|
||||
'.contact p {',
|
||||
' margin: 5px 0 0 10px;',
|
||||
'}',
|
||||
'',
|
||||
'.contact iframe {',
|
||||
' border: solid 1px #333;',
|
||||
' margin: 5px 0 0 10px;',
|
||||
'}',
|
||||
'',
|
||||
'/* forms */',
|
||||
'fieldset {',
|
||||
' border: none;',
|
||||
' margin: 0;',
|
||||
' padding: 0;',
|
||||
'}',
|
||||
'',
|
||||
' fieldset legend {',
|
||||
' display: none;',
|
||||
' }',
|
||||
'',
|
||||
' fieldset ol {',
|
||||
' padding: 0;',
|
||||
' list-style: none;',
|
||||
' }',
|
||||
'',
|
||||
' fieldset ol li {',
|
||||
' padding-bottom: 5px;',
|
||||
' }',
|
||||
'',
|
||||
' fieldset label {',
|
||||
' display: block;',
|
||||
' font-size: 1.2em;',
|
||||
' font-weight: 600;',
|
||||
' }',
|
||||
'',
|
||||
' fieldset label.checkbox {',
|
||||
' display: inline;',
|
||||
' }',
|
||||
'',
|
||||
' fieldset input[type="text"],',
|
||||
' fieldset input[type="password"] {',
|
||||
' border: 1px solid #e2e2e2;',
|
||||
' color: #333;',
|
||||
' font-size: 1.2em;',
|
||||
' margin: 5px 0 6px 0;',
|
||||
' padding: 5px;',
|
||||
' width: 300px;',
|
||||
' }',
|
||||
'',
|
||||
' fieldset input[type="text"]:focus,',
|
||||
' fieldset input[type="password"]:focus {',
|
||||
' border: 1px solid #7ac0da;',
|
||||
' }',
|
||||
'',
|
||||
' fieldset input[type="submit"] {',
|
||||
' background-color: #d3dce0;',
|
||||
' border: solid 1px #787878;',
|
||||
' cursor: pointer;',
|
||||
' font-size: 1.2em;',
|
||||
' font-weight: 600;',
|
||||
' padding: 7px;',
|
||||
' }',
|
||||
'',
|
||||
'/* ajax login/registration dialog */',
|
||||
'.modal-popup {',
|
||||
' font-size: 0.7em;',
|
||||
'}',
|
||||
'',
|
||||
'/* info and errors */',
|
||||
'.message-info {',
|
||||
' border: solid 1px;',
|
||||
' clear: both;',
|
||||
' padding: 10px 20px;',
|
||||
'}',
|
||||
'',
|
||||
'.message-error {',
|
||||
' clear: both;',
|
||||
' color: #e80c4d;',
|
||||
' font-size: 1.1em;',
|
||||
' font-weight: bold;',
|
||||
' margin: 20px 0 10px 0;',
|
||||
'}',
|
||||
'',
|
||||
'.message-success {',
|
||||
' color: #7ac0da;',
|
||||
' font-size: 1.3em;',
|
||||
' font-weight: bold;',
|
||||
' margin: 20px 0 10px 0;',
|
||||
'}',
|
||||
'',
|
||||
'.success {',
|
||||
' color: #7ac0da;',
|
||||
'}',
|
||||
'',
|
||||
'.error {',
|
||||
' color: #e80c4d;',
|
||||
'}',
|
||||
'',
|
||||
'/* styles for validation helpers */',
|
||||
'.field-validation-error {',
|
||||
' color: #e80c4d;',
|
||||
' font-weight: bold;',
|
||||
'}',
|
||||
'',
|
||||
'.field-validation-valid {',
|
||||
' display: none;',
|
||||
'}',
|
||||
'',
|
||||
'input[type="text"].input-validation-error,',
|
||||
'input[type="password"].input-validation-error {',
|
||||
' border: solid 1px #e80c4d;',
|
||||
'}',
|
||||
'',
|
||||
'.validation-summary-errors {',
|
||||
' color: #e80c4d;',
|
||||
' font-weight: bold;',
|
||||
' font-size: 1.1em;',
|
||||
'}',
|
||||
'',
|
||||
'.validation-summary-valid {',
|
||||
' display: none;',
|
||||
'}',
|
||||
'',
|
||||
'',
|
||||
'/* social */',
|
||||
'ul#social li {',
|
||||
' display: inline;',
|
||||
' list-style: none;',
|
||||
'}',
|
||||
'',
|
||||
' ul#social li a {',
|
||||
' color: #999;',
|
||||
' text-decoration: none;',
|
||||
' }',
|
||||
'',
|
||||
' a.facebook, a.twitter {',
|
||||
' display: block;',
|
||||
' float: left;',
|
||||
' height: 24px;',
|
||||
' padding-left: 17px;',
|
||||
' text-indent: -9999px;',
|
||||
' width: 16px;',
|
||||
' }',
|
||||
'',
|
||||
' a.facebook {',
|
||||
' background: url("../images/facebook.png") no-repeat;',
|
||||
' }',
|
||||
'',
|
||||
' a.twitter {',
|
||||
' background: url("../images/twitter.png") no-repeat;',
|
||||
' }',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'/********************',
|
||||
'* Mobile Styles *',
|
||||
'********************/',
|
||||
'@media only screen and (max-width: 850px) {',
|
||||
'',
|
||||
' /* header',
|
||||
' ----------------------------------------------------------*/',
|
||||
' header .float-left,',
|
||||
' header .float-right {',
|
||||
' float: none;',
|
||||
' }',
|
||||
'',
|
||||
' /* logo */',
|
||||
' header .site-title {',
|
||||
' /*margin: 0; */',
|
||||
' /*margin: 10px;*/',
|
||||
' text-align: left;',
|
||||
' padding-left: 0;',
|
||||
' }',
|
||||
'',
|
||||
' /* login */',
|
||||
' #login {',
|
||||
' font-size: .85em;',
|
||||
' margin-top: 0;',
|
||||
' text-align: center;',
|
||||
' }',
|
||||
'',
|
||||
' #login ul {',
|
||||
' margin: 5px 0;',
|
||||
' padding: 0;',
|
||||
' }',
|
||||
'',
|
||||
' #login li {',
|
||||
' display: inline;',
|
||||
' list-style: none;',
|
||||
' margin: 0;',
|
||||
' padding:0;',
|
||||
' }',
|
||||
'',
|
||||
' #login a {',
|
||||
' background: none;',
|
||||
' color: #999;',
|
||||
' font-weight: 600;',
|
||||
' margin: 2px;',
|
||||
' padding: 0;',
|
||||
' }',
|
||||
'',
|
||||
' #login a:hover {',
|
||||
' color: #333;',
|
||||
' }',
|
||||
'',
|
||||
' /* menu */',
|
||||
' nav {',
|
||||
' margin-bottom: 5px;',
|
||||
' }',
|
||||
'',
|
||||
' ul#menu {',
|
||||
' margin: 0;',
|
||||
' padding:0;',
|
||||
' text-align: center;',
|
||||
' }',
|
||||
'',
|
||||
' ul#menu li {',
|
||||
' margin: 0;',
|
||||
' padding: 0;',
|
||||
' }',
|
||||
'',
|
||||
'',
|
||||
' /* main layout',
|
||||
' ----------------------------------------------------------*/',
|
||||
' .main-content,',
|
||||
' .featured + .main-content {',
|
||||
' background-position: 10px 0;',
|
||||
' }',
|
||||
'',
|
||||
' .content-wrapper {',
|
||||
' padding-right: 10px;',
|
||||
' padding-left: 10px;',
|
||||
' }',
|
||||
'',
|
||||
' .featured .content-wrapper {',
|
||||
' padding: 10px;',
|
||||
' }',
|
||||
'',
|
||||
' /* page content */',
|
||||
' article, aside {',
|
||||
' float: none;',
|
||||
' width: 100%;',
|
||||
' }',
|
||||
'',
|
||||
' /* ordered list */',
|
||||
' ol.round {',
|
||||
' list-style-type: none;',
|
||||
' padding-left: 0;',
|
||||
' }',
|
||||
'',
|
||||
' ol.round li {',
|
||||
' padding-left: 10px;',
|
||||
' margin: 25px 0;',
|
||||
' }',
|
||||
'',
|
||||
' ol.round li.one,',
|
||||
' ol.round li.two,',
|
||||
' ol.round li.three {',
|
||||
' background: none;',
|
||||
' }',
|
||||
'',
|
||||
' /* features */',
|
||||
' section.feature {',
|
||||
' float: none;',
|
||||
' padding: 10px;',
|
||||
' width: auto;',
|
||||
' }',
|
||||
'',
|
||||
' section.feature img {',
|
||||
' color: #999;',
|
||||
' content: attr(alt);',
|
||||
' font-size: 1.5em;',
|
||||
' font-weight: 600;',
|
||||
' }',
|
||||
'',
|
||||
' /* forms */',
|
||||
' fieldset input[type="text"],',
|
||||
' fieldset input[type="password"] {',
|
||||
' width: 90%;',
|
||||
' }',
|
||||
'',
|
||||
' /* login page */',
|
||||
' #loginForm {',
|
||||
' border-right: none;',
|
||||
' float: none;',
|
||||
' width: auto;',
|
||||
' }',
|
||||
'',
|
||||
' #loginForm .validation-error {',
|
||||
' display: block;',
|
||||
' margin-left: 15px;',
|
||||
' }',
|
||||
'',
|
||||
' #socialLoginForm {',
|
||||
' margin-left: 0;',
|
||||
' float: none;',
|
||||
' width: auto;',
|
||||
' }',
|
||||
'',
|
||||
' /* footer',
|
||||
' ----------------------------------------------------------*/',
|
||||
' footer .float-left,',
|
||||
' footer .float-right {',
|
||||
' float: none;',
|
||||
' }',
|
||||
'',
|
||||
' footer {',
|
||||
' text-align: center;',
|
||||
' height: auto;',
|
||||
' padding: 10px 0;',
|
||||
' }',
|
||||
'',
|
||||
' footer p {',
|
||||
' margin: 0;',
|
||||
' }',
|
||||
'',
|
||||
' ul#social {',
|
||||
' padding:0;',
|
||||
' margin: 0;',
|
||||
' }',
|
||||
'',
|
||||
' a.facebook, a.twitter {',
|
||||
' background: none;',
|
||||
' display: inline;',
|
||||
' float: none;',
|
||||
' height: auto;',
|
||||
' padding-left: 0;',
|
||||
' text-indent: 0;',
|
||||
' width: auto;',
|
||||
' }',
|
||||
'}',
|
||||
'',
|
||||
'.subsite {',
|
||||
' color: #444;',
|
||||
'}',
|
||||
'',
|
||||
'h3 {',
|
||||
' font-weight: normal;',
|
||||
' font-size: 24px;',
|
||||
' color: #444;',
|
||||
' margin-bottom: 20px;',
|
||||
'}',
|
||||
'',
|
||||
'.tiles {',
|
||||
' padding-bottom: 20px;',
|
||||
' background-color: #e3e3e3;',
|
||||
'}',
|
||||
'',
|
||||
'#editor {',
|
||||
' margin: 0 auto;',
|
||||
' height: 500px;',
|
||||
' border: 1px solid #ccc;',
|
||||
'}',
|
||||
'',
|
||||
'.monaco-editor.monaco, .monaco-editor.vs, .monaco-editor.eclipse {',
|
||||
' background: #F9F9F9;',
|
||||
'}',
|
||||
'',
|
||||
'.monaco-editor.monaco .monaco-editor-background, .monaco-editor.vs .monaco-editor-background, .monaco-editor.eclipse .monaco-editor-background {',
|
||||
' background: #F9F9F9;',
|
||||
'}'
|
||||
].join('\n'),
|
||||
language: 'css'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,62 @@
|
||||
{
|
||||
perform: true,
|
||||
commands: [
|
||||
{
|
||||
type: 'comment',
|
||||
name: 'question',
|
||||
allowUsers: [],
|
||||
action: 'updateLabels',
|
||||
addLabel: '*question'
|
||||
},
|
||||
{
|
||||
type: 'label',
|
||||
name: '*question',
|
||||
allowTriggerByBot: true,
|
||||
action: 'close',
|
||||
comment: "Please ask your question on [StackOverflow](https://stackoverflow.com/questions/tagged/monaco-editor). We have a great community over [there](https://stackoverflow.com/questions/tagged/monaco-editor). They have already answered hundreds of questions and are happy to answer yours as well. You can also try [searching through existing issues](https://github.com/microsoft/monaco-editor/issues?utf8=%E2%9C%93&q=is%3Aissue+), looking at [API usage samples](https://microsoft.github.io/monaco-editor/playground.html) or at [integration samples](https://github.com/Microsoft/monaco-editor-samples). See also our [issue reporting](https://aka.ms/vscodeissuereporting) guidelines.\n\nHappy Coding!"
|
||||
},
|
||||
{
|
||||
type: 'label',
|
||||
name: '*out-of-scope',
|
||||
allowTriggerByBot: true,
|
||||
action: 'close',
|
||||
comment: "We closed this issue because we don't plan to address it in the foreseeable future. You can find more detailed information about our decision-making process [here](https://aka.ms/vscode-out-of-scope). If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.\n\nIf you wonder what we are up to, please see our [roadmap](https://aka.ms/vscoderoadmap) and [issue reporting](https://aka.ms/vscodeissuereporting) guidelines.\n\nThanks for your understanding and happy coding!"
|
||||
},
|
||||
{
|
||||
type: 'label',
|
||||
name: '*as-designed',
|
||||
allowTriggerByBot: true,
|
||||
action: 'close',
|
||||
comment: "The described behavior is how it is expected to work. If you disagree, please explain what is expected and what is not in more detail. See also our [issue reporting](https://aka.ms/vscodeissuereporting) guidelines.\n\nHappy Coding!"
|
||||
},
|
||||
{
|
||||
type: 'label',
|
||||
name: '*english-please',
|
||||
allowTriggerByBot: true,
|
||||
action: 'close',
|
||||
comment: "This issue is being closed because its description is not in English, that makes it hard for us to work on it. Please open a new issue with an English description. You might find [Bing Translator](https://www.bing.com/translator) useful."
|
||||
},
|
||||
{
|
||||
type: 'comment',
|
||||
name: 'duplicate',
|
||||
allowUsers: [],
|
||||
action: 'updateLabels',
|
||||
addLabel: '*duplicate'
|
||||
},
|
||||
{
|
||||
type: 'label',
|
||||
name: '*duplicate',
|
||||
allowTriggerByBot: true,
|
||||
action: 'close',
|
||||
comment: "Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for existing issues [here](https://github.com/Microsoft/monaco-editor/issues). See also our [issue reporting](https://aka.ms/vscodeissuereporting) guidelines.\n\nHappy Coding!"
|
||||
},
|
||||
{
|
||||
type: 'comment',
|
||||
name: 'needsMoreInfo',
|
||||
allowUsers: [],
|
||||
action: 'updateLabels',
|
||||
addLabel: 'needs more info',
|
||||
comment: "Thanks for creating this issue! We figured it's missing some basic information or in some other way doesn't follow our [issue reporting](https://aka.ms/vscodeissuereporting) guidelines. Please take the time to review these and update the issue.\n\nHappy Coding!"
|
||||
},
|
||||
]
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
daysAfterClose: 45,
|
||||
daysSinceLastUpdate: 3,
|
||||
ignoredLabels: ['*out-of-scope'],
|
||||
perform: true
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
daysUntilClose: 7,
|
||||
needsMoreInfoLabel: 'needs more info',
|
||||
perform: true,
|
||||
closeComment: "This issue has been closed automatically because it needs more information and has not had recent activity. See also our [issue reporting](https://aka.ms/vscodeissuereporting) guidelines.\n\nHappy Coding!"
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
/node_modules/
|
||||
/test/node_modules/
|
||||
/test/dist/*.js
|
||||
/test/dist/*.ttf
|
||||
/out/
|
@ -0,0 +1,2 @@
|
||||
/src/
|
||||
/test/
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"cwd": "${workspaceFolder}/test/",
|
||||
"name": "Launch Program",
|
||||
"program": "${workspaceFolder}/node_modules/.bin/webpack",
|
||||
"args": [
|
||||
"--config",
|
||||
"webpack.config.js"
|
||||
],
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"files.trimTrailingWhitespace": true,
|
||||
"files.insertFinalNewline": true,
|
||||
"editor.tabSize": 2,
|
||||
"editor.insertSpaces": true
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE
|
@ -0,0 +1,102 @@
|
||||
# Monaco Editor Webpack Loader Plugin
|
||||
|
||||
A plugin to simplify loading the [Monaco Editor](https://github.com/Microsoft/monaco-editor) with [webpack](https://webpack.js.org/).
|
||||
|
||||
## Installing
|
||||
```sh
|
||||
npm install monaco-editor-webpack-plugin
|
||||
```
|
||||
|
||||
## Using
|
||||
* `webpack.config.js`:
|
||||
```js
|
||||
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
entry: './index.js',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'app.js'
|
||||
},
|
||||
module: {
|
||||
rules: [{
|
||||
test: /\.css$/,
|
||||
use: ['style-loader', 'css-loader']
|
||||
}, {
|
||||
test: /\.ttf$/,
|
||||
use: ['file-loader']
|
||||
}]
|
||||
},
|
||||
plugins: [
|
||||
new MonacoWebpackPlugin()
|
||||
]
|
||||
};
|
||||
```
|
||||
|
||||
* `index.js`:
|
||||
```js
|
||||
import * as monaco from 'monaco-editor'
|
||||
// or import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
||||
// if shipping only a subset of the features & languages is desired
|
||||
|
||||
monaco.editor.create(document.getElementById('container'), {
|
||||
value: 'console.log("Hello, world")',
|
||||
language: 'javascript'
|
||||
});
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
Options can be passed in to `MonacoWebpackPlugin`. They can be used to generate a smaller editor bundle by selecting only certain languages or only certain editor features:
|
||||
|
||||
* `filename` (`string`) - custom filename template for worker scripts, respects the same options as [loader-utils' interpolateName](https://github.com/webpack/loader-utils#interpolatename). Useful for adding content-based hashes so that files can be served with long-lived caching headers.
|
||||
* default value: `'[name].worker.js'`.
|
||||
* `publicPath` (`string`) - custom public path for worker scripts, overrides the public path from which files generated by this plugin will be served. This wins out over Webpack's dynamic runtime path and can be useful to avoid attempting to load workers cross-origin when using a CDN for other static resources. Use e.g. '/' if you want to load your resources from the current origin..
|
||||
* default value: `''`.
|
||||
* `languages` (`string[]`) - include only a subset of the languages supported.
|
||||
* default value: <!-- LANGUAGES_BEGIN -->`['abap', 'apex', 'azcli', 'bat', 'bicep', 'cameligo', 'clojure', 'coffee', 'cpp', 'csharp', 'csp', 'css', 'dart', 'dockerfile', 'ecl', 'elixir', 'flow9', 'fsharp', 'go', 'graphql', 'handlebars', 'hcl', 'html', 'ini', 'java', 'javascript', 'json', 'julia', 'kotlin', 'less', 'lexon', 'liquid', 'lua', 'm3', 'markdown', 'mips', 'msdax', 'mysql', 'objective-c', 'pascal', 'pascaligo', 'perl', 'pgsql', 'php', 'pla', 'postiats', 'powerquery', 'powershell', 'protobuf', 'pug', 'python', 'qsharp', 'r', 'razor', 'redis', 'redshift', 'restructuredtext', 'ruby', 'rust', 'sb', 'scala', 'scheme', 'scss', 'shell', 'solidity', 'sophia', 'sparql', 'sql', 'st', 'swift', 'systemverilog', 'tcl', 'twig', 'typescript', 'vb', 'xml', 'yaml']`<!-- LANGUAGES_END -->.
|
||||
|
||||
Some languages share the same web worker. If one of the following languages is included, you must also include the language responsible for instantiating their shared worker:
|
||||
|
||||
| Language | Instantiator |
|
||||
| ------------- | ------------- |
|
||||
| javascript | typescript |
|
||||
| handlebars | html |
|
||||
| scss, less | css |
|
||||
|
||||
|
||||
|
||||
* `features` (`string[]`) - include only a subset of the editor features.
|
||||
* default value: <!-- FEATURES_BEGIN -->`['accessibilityHelp', 'anchorSelect', 'bracketMatching', 'caretOperations', 'clipboard', 'codeAction', 'codelens', 'colorPicker', 'comment', 'contextmenu', 'coreCommands', 'cursorUndo', 'dnd', 'documentSymbols', 'find', 'folding', 'fontZoom', 'format', 'gotoError', 'gotoLine', 'gotoSymbol', 'hover', 'iPadShowKeyboard', 'inPlaceReplace', 'indentation', 'inlayHints', 'inlineCompletions', 'inspectTokens', 'linesOperations', 'linkedEditing', 'links', 'multicursor', 'parameterHints', 'quickCommand', 'quickHelp', 'quickOutline', 'referenceSearch', 'rename', 'smartSelect', 'snippets', 'suggest', 'toggleHighContrast', 'toggleTabFocusMode', 'transpose', 'unusualLineTerminators', 'viewportSemanticTokens', 'wordHighlighter', 'wordOperations', 'wordPartOperations']`<!-- FEATURES_END -->.
|
||||
* excluded features: It is also possible to exclude certain default features prefixing them with an exclamation mark '!'.
|
||||
|
||||
* `globalAPI` (`boolean`) - specify whether the editor API should be exposed through a global `monaco` object or not. This option is applicable to `0.22.0` and newer version of `monaco-editor`. Since `0.22.0`, the ESM version of the monaco editor does no longer define a global `monaco` object unless `global.MonacoEnvironment = { globalAPI: true }` is set ([change log](https://github.com/microsoft/monaco-editor/blob/main/CHANGELOG.md#0220-29012021)).
|
||||
* default value: `false`.
|
||||
|
||||
## Version Matrix
|
||||
|
||||
| `monaco-editor-webpack-plugin` | `monaco-editor` |
|
||||
|---|---|
|
||||
| `6.*.*` | `0.30.*` |
|
||||
| `5.*.*` | `0.29.*` |
|
||||
| `4.*.*` | `0.25.*`, `0.26.*`, `0.27.*`, `0.28.*` |
|
||||
| `3.*.*` | `0.22.*`, `0.23.*`, `0.24.*` |
|
||||
| `2.*.*` | `0.21.*` |
|
||||
| `1.9.*` | `0.20.*` |
|
||||
| `1.8.*` | `0.19.*` |
|
||||
| `1.7.*` | `0.18.*` |
|
||||
|
||||
## Contributing
|
||||
|
||||
This project welcomes contributions and suggestions. Most contributions require you to agree to a
|
||||
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
|
||||
the rights to use your contribution. For details, visit https://cla.microsoft.com.
|
||||
|
||||
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
|
||||
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
|
||||
provided by the bot. You will only need to do this once across all repos using our CLA.
|
||||
|
||||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
||||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
|
||||
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
@ -0,0 +1,41 @@
|
||||
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.5 BLOCK -->
|
||||
|
||||
## Security
|
||||
|
||||
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
|
||||
|
||||
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)), please report it to us as described below.
|
||||
|
||||
## Reporting Security Issues
|
||||
|
||||
**Please do not report security vulnerabilities through public GitHub issues.**
|
||||
|
||||
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).
|
||||
|
||||
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).
|
||||
|
||||
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
|
||||
|
||||
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
||||
|
||||
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
|
||||
* Full paths of source file(s) related to the manifestation of the issue
|
||||
* The location of the affected source code (tag/branch/commit or direct URL)
|
||||
* Any special configuration required to reproduce the issue
|
||||
* Step-by-step instructions to reproduce the issue
|
||||
* Proof-of-concept or exploit code (if possible)
|
||||
* Impact of the issue, including how an attacker might exploit the issue
|
||||
|
||||
This information will help us triage your report more quickly.
|
||||
|
||||
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs.
|
||||
|
||||
## Preferred Languages
|
||||
|
||||
We prefer all communications to be in English.
|
||||
|
||||
## Policy
|
||||
|
||||
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).
|
||||
|
||||
<!-- END MICROSOFT SECURITY.MD BLOCK -->
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "monaco-editor-webpack-plugin",
|
||||
"version": "6.0.0",
|
||||
"description": "A webpack plugin for the Monaco Editor",
|
||||
"main": "out/index.js",
|
||||
"typings": "./out/index.d.ts",
|
||||
"scripts": {
|
||||
"test": "node ./node_modules/webpack/bin/webpack.js --config test/webpack.config.js --progress",
|
||||
"test-cross-origin": "node ./node_modules/webpack/bin/webpack.js --config test/webpack-cross-origin.config.js --progress",
|
||||
"watch": "tsc -w -p tsconfig.json",
|
||||
"import-editor": "node ./scripts/import-editor.js",
|
||||
"prepublishOnly": "tsc -p tsconfig.json"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/microsoft/monaco-editor-webpack-plugin.git"
|
||||
},
|
||||
"keywords": [
|
||||
"webpack",
|
||||
"monaco",
|
||||
"editor",
|
||||
"loader"
|
||||
],
|
||||
"author": "Microsoft Corporation",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/microsoft/monaco-editor-webpack-plugin/issues"
|
||||
},
|
||||
"homepage": "https://github.com/microsoft/monaco-editor-webpack-plugin#readme",
|
||||
"peerDependencies": {
|
||||
"webpack": "^4.5.0 || 5.x",
|
||||
"monaco-editor": "0.30.x"
|
||||
},
|
||||
"devDependencies": {
|
||||
"css-loader": "^5.1.1",
|
||||
"file-loader": "^6.2.0",
|
||||
"glob": "^7.1.6",
|
||||
"monaco-editor": "^0.30.0",
|
||||
"style-loader": "^2.0.0",
|
||||
"typescript": "^4.2.3",
|
||||
"webpack": "^5.24.3",
|
||||
"webpack-cli": "^4.5.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"loader-utils": "^2.0.0"
|
||||
}
|
||||
}
|
@ -0,0 +1,271 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
const glob = require('glob');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
const customFeatureLabels = {
|
||||
'vs/editor/browser/controller/coreCommands': 'coreCommands',
|
||||
'vs/editor/contrib/caretOperations/caretOperations': 'caretOperations',
|
||||
'vs/editor/contrib/caretOperations/transpose': 'transpose',
|
||||
'vs/editor/contrib/colorPicker/colorDetector': 'colorDetector',
|
||||
'vs/editor/contrib/rename/onTypeRename': 'onTypeRename',
|
||||
'vs/editor/contrib/gotoSymbol/link/goToDefinitionAtPosition': 'gotoSymbol',
|
||||
'vs/editor/contrib/snippet/snippetController2': 'snippets',
|
||||
'vs/editor/standalone/browser/quickAccess/standaloneGotoLineQuickAccess': 'gotoLine',
|
||||
'vs/editor/standalone/browser/quickAccess/standaloneCommandsQuickAccess': 'quickCommand',
|
||||
'vs/editor/standalone/browser/quickAccess/standaloneGotoSymbolQuickAccess': 'quickOutline',
|
||||
'vs/editor/standalone/browser/quickAccess/standaloneHelpQuickAccess': 'quickHelp',
|
||||
};
|
||||
|
||||
generateLanguages();
|
||||
generateFeatures();
|
||||
|
||||
/**
|
||||
* @returns { Promise<{ label: string; entry: string; }[]> }
|
||||
*/
|
||||
function getBasicLanguages() {
|
||||
return new Promise((resolve, reject) => {
|
||||
glob('./node_modules/monaco-editor/esm/vs/basic-languages/*/*.contribution.js', { cwd: path.dirname(__dirname) }, (err, files) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
|
||||
resolve(files.map((file) => {
|
||||
const entry = file.substring('./node_modules/monaco-editor/esm/'.length).replace(/\.js$/, '');
|
||||
const label = path.basename(file).replace(/\.contribution\.js$/, '');
|
||||
return {
|
||||
label: label,
|
||||
entry: entry
|
||||
};
|
||||
}));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns { Promise<string[]> }
|
||||
*/
|
||||
function readAdvancedLanguages() {
|
||||
return new Promise((resolve, reject) => {
|
||||
glob('./node_modules/monaco-editor/esm/vs/language/*/monaco.contribution.js', { cwd: path.dirname(__dirname) }, (err, files) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
|
||||
resolve(
|
||||
files
|
||||
.map(file => file.substring('./node_modules/monaco-editor/esm/vs/language/'.length))
|
||||
.map(file => file.substring(0, file.length - '/monaco.contribution.js'.length))
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns { Promise<{ label: string; entry: string; worker: { id: string; entry: string; }; }[]> }
|
||||
*/
|
||||
function getAdvancedLanguages() {
|
||||
return readAdvancedLanguages().then((languages) => {
|
||||
let result = [];
|
||||
for (const lang of languages) {
|
||||
let shortLang = (lang === 'typescript' ? 'ts' : lang);
|
||||
const entry = `vs/language/${lang}/monaco.contribution`;
|
||||
checkFileExists(entry);
|
||||
const workerId = `vs/language/${lang}/${shortLang}Worker`;
|
||||
checkFileExists(workerId);
|
||||
const workerEntry = `vs/language/${lang}/${shortLang}.worker`;
|
||||
checkFileExists(workerEntry);
|
||||
result.push({
|
||||
label: lang,
|
||||
entry: entry,
|
||||
worker: {
|
||||
id: workerId,
|
||||
entry: workerEntry
|
||||
}
|
||||
});
|
||||
}
|
||||
return result;
|
||||
});
|
||||
|
||||
function checkFileExists(moduleName) {
|
||||
const filePath = path.join(__dirname, '..', 'node_modules/monaco-editor/esm', `${moduleName}.js`);
|
||||
if (!fs.existsSync(filePath)) {
|
||||
console.error(`Could not find ${filePath}.`);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function generateLanguages() {
|
||||
return Promise.all([getBasicLanguages(), getAdvancedLanguages()]).then(([basicLanguages, advancedLanguages]) => {
|
||||
basicLanguages.sort(strcmp);
|
||||
advancedLanguages.sort(strcmp);
|
||||
|
||||
let i = 0, len = basicLanguages.length;
|
||||
let j = 0, lenJ = advancedLanguages.length;
|
||||
let result = [];
|
||||
while (i < len || j < lenJ) {
|
||||
if (i < len && j < lenJ) {
|
||||
if (basicLanguages[i].label === advancedLanguages[j].label) {
|
||||
let entry = [];
|
||||
entry.push(basicLanguages[i].entry);
|
||||
entry.push(advancedLanguages[j].entry);
|
||||
result.push({
|
||||
label: basicLanguages[i].label,
|
||||
entry: entry,
|
||||
worker: advancedLanguages[j].worker
|
||||
});
|
||||
i++;
|
||||
j++;
|
||||
} else if (basicLanguages[i].label < advancedLanguages[j].label) {
|
||||
result.push(basicLanguages[i]);
|
||||
i++;
|
||||
} else {
|
||||
result.push(advancedLanguages[j]);
|
||||
j++;
|
||||
}
|
||||
} else if (i < len) {
|
||||
result.push(basicLanguages[i]);
|
||||
i++;
|
||||
} else {
|
||||
result.push(advancedLanguages[j]);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
const code = `//
|
||||
// THIS IS A GENERATED FILE. PLEASE DO NOT EDIT DIRECTLY.
|
||||
// GENERATED USING node scripts/import-editor.js
|
||||
//
|
||||
import { IFeatureDefinition } from "./types";
|
||||
|
||||
export const languagesArr: IFeatureDefinition[] = ${
|
||||
JSON.stringify(result, null, ' ')
|
||||
.replace(/"label":/g, 'label:')
|
||||
.replace(/"entry":/g, 'entry:')
|
||||
.replace(/"worker":/g, 'worker:')
|
||||
.replace(/"id":/g, 'id:')
|
||||
.replace(/"/g, '\'')
|
||||
};
|
||||
|
||||
export type EditorLanguage = ${
|
||||
result.map(el => `'${el.label}'`).join(' | ')
|
||||
};
|
||||
|
||||
`
|
||||
fs.writeFileSync(path.join(__dirname, '../src/languages.ts'), code.replace(/\r\n/g, '\n'));
|
||||
|
||||
const readmeLanguages = (
|
||||
JSON.stringify(result.map(r => r.label))
|
||||
.replace(/"/g, '\'')
|
||||
.replace(/','/g, '\', \'')
|
||||
);
|
||||
let readme = fs.readFileSync(path.join(__dirname, '../README.md')).toString();
|
||||
readme = readme.replace(/<!-- LANGUAGES_BEGIN -->([^<]+)<!-- LANGUAGES_END -->/, `<!-- LANGUAGES_BEGIN -->\`${readmeLanguages}\`<!-- LANGUAGES_END -->`);
|
||||
fs.writeFileSync(path.join(__dirname, '../README.md'), readme);
|
||||
});
|
||||
}
|
||||
|
||||
function strcmp(a, b) {
|
||||
if (a < b) {
|
||||
return -1;
|
||||
}
|
||||
if (a > b) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns { string[] }
|
||||
*/
|
||||
function generateFeatures() {
|
||||
const skipImports = [
|
||||
'vs/editor/browser/widget/codeEditorWidget',
|
||||
'vs/editor/browser/widget/diffEditorWidget',
|
||||
'vs/editor/browser/widget/diffNavigator',
|
||||
'vs/editor/common/standaloneStrings',
|
||||
'vs/editor/contrib/tokenization/tokenization',
|
||||
'vs/editor/editor.all',
|
||||
'vs/base/browser/ui/codicons/codiconStyles',
|
||||
'vs/editor/contrib/gotoSymbol/documentSymbols',
|
||||
];
|
||||
|
||||
let features = [];
|
||||
const files = (
|
||||
fs.readFileSync(path.join(__dirname, '../node_modules/monaco-editor/esm/vs/editor/edcore.main.js')).toString()
|
||||
+ fs.readFileSync(path.join(__dirname, '../node_modules/monaco-editor/esm/vs/editor/editor.all.js')).toString()
|
||||
);
|
||||
files.split(/\r\n|\n/).forEach(line => {
|
||||
const m = line.match(/import '([^']+)'/);
|
||||
if (m) {
|
||||
const tmp = path.posix.join('vs/editor', m[1]).replace(/\.js$/, '');
|
||||
if (skipImports.indexOf(tmp) === -1) {
|
||||
features.push(tmp);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let result = features.map((feature) => {
|
||||
return {
|
||||
label: customFeatureLabels[feature] || path.basename(path.dirname(feature)),
|
||||
entry: feature
|
||||
};
|
||||
});
|
||||
|
||||
result.sort((a, b) => {
|
||||
const labelCmp = strcmp(a.label, b.label);
|
||||
if (labelCmp === 0) {
|
||||
return strcmp(a.entry, b.entry);
|
||||
}
|
||||
return labelCmp;
|
||||
});
|
||||
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
if (i + 1 < result.length && result[i].label === result[i + 1].label) {
|
||||
if (typeof result[i].entry === 'string') {
|
||||
result[i].entry = [result[i].entry];
|
||||
}
|
||||
result[i].entry.push(result[i + 1].entry);
|
||||
result.splice(i + 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
const code = `//
|
||||
// THIS IS A GENERATED FILE. PLEASE DO NOT EDIT DIRECTLY.
|
||||
// GENERATED USING node scripts/import-editor.js
|
||||
//
|
||||
import { IFeatureDefinition } from "./types";
|
||||
|
||||
export const featuresArr: IFeatureDefinition[] = ${
|
||||
JSON.stringify(result, null, ' ')
|
||||
.replace(/"label":/g, 'label:')
|
||||
.replace(/"entry":/g, 'entry:')
|
||||
.replace(/"/g, '\'')
|
||||
};
|
||||
|
||||
export type EditorFeature = ${
|
||||
result.map(el => `'${el.label}'`).join(' | ')
|
||||
};
|
||||
|
||||
export type NegatedEditorFeature = ${
|
||||
result.map(el => `'!${el.label}'`).join(' | ')
|
||||
};
|
||||
`
|
||||
fs.writeFileSync(path.join(__dirname, '../src/features.ts'), code.replace(/\r\n/g, '\n'));
|
||||
|
||||
const readmeFeatures = (
|
||||
JSON.stringify(result.map(r => r.label))
|
||||
.replace(/"/g, '\'')
|
||||
.replace(/','/g, '\', \'')
|
||||
);
|
||||
let readme = fs.readFileSync(path.join(__dirname, '../README.md')).toString();
|
||||
readme = readme.replace(/<!-- FEATURES_BEGIN -->([^<]+)<!-- FEATURES_END -->/, `<!-- FEATURES_BEGIN -->\`${readmeFeatures}\`<!-- FEATURES_END -->`);
|
||||
fs.writeFileSync(path.join(__dirname, '../README.md'), readme);
|
||||
}
|
@ -0,0 +1,211 @@
|
||||
//
|
||||
// THIS IS A GENERATED FILE. PLEASE DO NOT EDIT DIRECTLY.
|
||||
// GENERATED USING node scripts/import-editor.js
|
||||
//
|
||||
import { IFeatureDefinition } from "./types";
|
||||
|
||||
export const featuresArr: IFeatureDefinition[] = [
|
||||
{
|
||||
label: 'accessibilityHelp',
|
||||
entry: 'vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp'
|
||||
},
|
||||
{
|
||||
label: 'anchorSelect',
|
||||
entry: 'vs/editor/contrib/anchorSelect/anchorSelect'
|
||||
},
|
||||
{
|
||||
label: 'bracketMatching',
|
||||
entry: 'vs/editor/contrib/bracketMatching/bracketMatching'
|
||||
},
|
||||
{
|
||||
label: 'caretOperations',
|
||||
entry: 'vs/editor/contrib/caretOperations/caretOperations'
|
||||
},
|
||||
{
|
||||
label: 'clipboard',
|
||||
entry: 'vs/editor/contrib/clipboard/clipboard'
|
||||
},
|
||||
{
|
||||
label: 'codeAction',
|
||||
entry: 'vs/editor/contrib/codeAction/codeActionContributions'
|
||||
},
|
||||
{
|
||||
label: 'codelens',
|
||||
entry: 'vs/editor/contrib/codelens/codelensController'
|
||||
},
|
||||
{
|
||||
label: 'colorPicker',
|
||||
entry: 'vs/editor/contrib/colorPicker/colorContributions'
|
||||
},
|
||||
{
|
||||
label: 'comment',
|
||||
entry: 'vs/editor/contrib/comment/comment'
|
||||
},
|
||||
{
|
||||
label: 'contextmenu',
|
||||
entry: 'vs/editor/contrib/contextmenu/contextmenu'
|
||||
},
|
||||
{
|
||||
label: 'coreCommands',
|
||||
entry: 'vs/editor/browser/controller/coreCommands'
|
||||
},
|
||||
{
|
||||
label: 'cursorUndo',
|
||||
entry: 'vs/editor/contrib/cursorUndo/cursorUndo'
|
||||
},
|
||||
{
|
||||
label: 'dnd',
|
||||
entry: 'vs/editor/contrib/dnd/dnd'
|
||||
},
|
||||
{
|
||||
label: 'documentSymbols',
|
||||
entry: 'vs/editor/contrib/documentSymbols/documentSymbols'
|
||||
},
|
||||
{
|
||||
label: 'find',
|
||||
entry: 'vs/editor/contrib/find/findController'
|
||||
},
|
||||
{
|
||||
label: 'folding',
|
||||
entry: 'vs/editor/contrib/folding/folding'
|
||||
},
|
||||
{
|
||||
label: 'fontZoom',
|
||||
entry: 'vs/editor/contrib/fontZoom/fontZoom'
|
||||
},
|
||||
{
|
||||
label: 'format',
|
||||
entry: 'vs/editor/contrib/format/formatActions'
|
||||
},
|
||||
{
|
||||
label: 'gotoError',
|
||||
entry: 'vs/editor/contrib/gotoError/gotoError'
|
||||
},
|
||||
{
|
||||
label: 'gotoLine',
|
||||
entry: 'vs/editor/standalone/browser/quickAccess/standaloneGotoLineQuickAccess'
|
||||
},
|
||||
{
|
||||
label: 'gotoSymbol',
|
||||
entry: [
|
||||
'vs/editor/contrib/gotoSymbol/goToCommands',
|
||||
'vs/editor/contrib/gotoSymbol/link/goToDefinitionAtPosition'
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'hover',
|
||||
entry: 'vs/editor/contrib/hover/hover'
|
||||
},
|
||||
{
|
||||
label: 'iPadShowKeyboard',
|
||||
entry: 'vs/editor/standalone/browser/iPadShowKeyboard/iPadShowKeyboard'
|
||||
},
|
||||
{
|
||||
label: 'inPlaceReplace',
|
||||
entry: 'vs/editor/contrib/inPlaceReplace/inPlaceReplace'
|
||||
},
|
||||
{
|
||||
label: 'indentation',
|
||||
entry: 'vs/editor/contrib/indentation/indentation'
|
||||
},
|
||||
{
|
||||
label: 'inlayHints',
|
||||
entry: 'vs/editor/contrib/inlayHints/inlayHintsController'
|
||||
},
|
||||
{
|
||||
label: 'inlineCompletions',
|
||||
entry: 'vs/editor/contrib/inlineCompletions/ghostTextController'
|
||||
},
|
||||
{
|
||||
label: 'inspectTokens',
|
||||
entry: 'vs/editor/standalone/browser/inspectTokens/inspectTokens'
|
||||
},
|
||||
{
|
||||
label: 'linesOperations',
|
||||
entry: 'vs/editor/contrib/linesOperations/linesOperations'
|
||||
},
|
||||
{
|
||||
label: 'linkedEditing',
|
||||
entry: 'vs/editor/contrib/linkedEditing/linkedEditing'
|
||||
},
|
||||
{
|
||||
label: 'links',
|
||||
entry: 'vs/editor/contrib/links/links'
|
||||
},
|
||||
{
|
||||
label: 'multicursor',
|
||||
entry: 'vs/editor/contrib/multicursor/multicursor'
|
||||
},
|
||||
{
|
||||
label: 'parameterHints',
|
||||
entry: 'vs/editor/contrib/parameterHints/parameterHints'
|
||||
},
|
||||
{
|
||||
label: 'quickCommand',
|
||||
entry: 'vs/editor/standalone/browser/quickAccess/standaloneCommandsQuickAccess'
|
||||
},
|
||||
{
|
||||
label: 'quickHelp',
|
||||
entry: 'vs/editor/standalone/browser/quickAccess/standaloneHelpQuickAccess'
|
||||
},
|
||||
{
|
||||
label: 'quickOutline',
|
||||
entry: 'vs/editor/standalone/browser/quickAccess/standaloneGotoSymbolQuickAccess'
|
||||
},
|
||||
{
|
||||
label: 'referenceSearch',
|
||||
entry: 'vs/editor/standalone/browser/referenceSearch/standaloneReferenceSearch'
|
||||
},
|
||||
{
|
||||
label: 'rename',
|
||||
entry: 'vs/editor/contrib/rename/rename'
|
||||
},
|
||||
{
|
||||
label: 'smartSelect',
|
||||
entry: 'vs/editor/contrib/smartSelect/smartSelect'
|
||||
},
|
||||
{
|
||||
label: 'snippets',
|
||||
entry: 'vs/editor/contrib/snippet/snippetController2'
|
||||
},
|
||||
{
|
||||
label: 'suggest',
|
||||
entry: 'vs/editor/contrib/suggest/suggestController'
|
||||
},
|
||||
{
|
||||
label: 'toggleHighContrast',
|
||||
entry: 'vs/editor/standalone/browser/toggleHighContrast/toggleHighContrast'
|
||||
},
|
||||
{
|
||||
label: 'toggleTabFocusMode',
|
||||
entry: 'vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode'
|
||||
},
|
||||
{
|
||||
label: 'transpose',
|
||||
entry: 'vs/editor/contrib/caretOperations/transpose'
|
||||
},
|
||||
{
|
||||
label: 'unusualLineTerminators',
|
||||
entry: 'vs/editor/contrib/unusualLineTerminators/unusualLineTerminators'
|
||||
},
|
||||
{
|
||||
label: 'viewportSemanticTokens',
|
||||
entry: 'vs/editor/contrib/viewportSemanticTokens/viewportSemanticTokens'
|
||||
},
|
||||
{
|
||||
label: 'wordHighlighter',
|
||||
entry: 'vs/editor/contrib/wordHighlighter/wordHighlighter'
|
||||
},
|
||||
{
|
||||
label: 'wordOperations',
|
||||
entry: 'vs/editor/contrib/wordOperations/wordOperations'
|
||||
},
|
||||
{
|
||||
label: 'wordPartOperations',
|
||||
entry: 'vs/editor/contrib/wordPartOperations/wordPartOperations'
|
||||
}
|
||||
];
|
||||
|
||||
export type EditorFeature = 'accessibilityHelp' | 'anchorSelect' | 'bracketMatching' | 'caretOperations' | 'clipboard' | 'codeAction' | 'codelens' | 'colorPicker' | 'comment' | 'contextmenu' | 'coreCommands' | 'cursorUndo' | 'dnd' | 'documentSymbols' | 'find' | 'folding' | 'fontZoom' | 'format' | 'gotoError' | 'gotoLine' | 'gotoSymbol' | 'hover' | 'iPadShowKeyboard' | 'inPlaceReplace' | 'indentation' | 'inlayHints' | 'inlineCompletions' | 'inspectTokens' | 'linesOperations' | 'linkedEditing' | 'links' | 'multicursor' | 'parameterHints' | 'quickCommand' | 'quickHelp' | 'quickOutline' | 'referenceSearch' | 'rename' | 'smartSelect' | 'snippets' | 'suggest' | 'toggleHighContrast' | 'toggleTabFocusMode' | 'transpose' | 'unusualLineTerminators' | 'viewportSemanticTokens' | 'wordHighlighter' | 'wordOperations' | 'wordPartOperations';
|
||||
|
||||
export type NegatedEditorFeature = '!accessibilityHelp' | '!anchorSelect' | '!bracketMatching' | '!caretOperations' | '!clipboard' | '!codeAction' | '!codelens' | '!colorPicker' | '!comment' | '!contextmenu' | '!coreCommands' | '!cursorUndo' | '!dnd' | '!documentSymbols' | '!find' | '!folding' | '!fontZoom' | '!format' | '!gotoError' | '!gotoLine' | '!gotoSymbol' | '!hover' | '!iPadShowKeyboard' | '!inPlaceReplace' | '!indentation' | '!inlayHints' | '!inlineCompletions' | '!inspectTokens' | '!linesOperations' | '!linkedEditing' | '!links' | '!multicursor' | '!parameterHints' | '!quickCommand' | '!quickHelp' | '!quickOutline' | '!referenceSearch' | '!rename' | '!smartSelect' | '!snippets' | '!suggest' | '!toggleHighContrast' | '!toggleTabFocusMode' | '!transpose' | '!unusualLineTerminators' | '!viewportSemanticTokens' | '!wordHighlighter' | '!wordOperations' | '!wordPartOperations';
|
@ -0,0 +1,300 @@
|
||||
import type * as webpack from 'webpack';
|
||||
import * as path from 'path';
|
||||
import * as loaderUtils from 'loader-utils';
|
||||
import * as fs from 'fs';
|
||||
import { AddWorkerEntryPointPlugin } from './plugins/AddWorkerEntryPointPlugin';
|
||||
import { languagesArr, EditorLanguage } from './languages';
|
||||
import { featuresArr, EditorFeature, NegatedEditorFeature } from './features';
|
||||
import { IFeatureDefinition } from './types';
|
||||
|
||||
const INCLUDE_LOADER_PATH = require.resolve('./loaders/include');
|
||||
|
||||
const EDITOR_MODULE: IFeatureDefinition = {
|
||||
label: 'editorWorkerService',
|
||||
entry: undefined,
|
||||
worker: {
|
||||
id: 'vs/editor/editor',
|
||||
entry: 'vs/editor/editor.worker'
|
||||
},
|
||||
};
|
||||
|
||||
const languagesById: { [language: string]: IFeatureDefinition; } = {};
|
||||
languagesArr.forEach(language => languagesById[language.label] = language);
|
||||
|
||||
const featuresById: { [feature: string]: IFeatureDefinition; } = {};
|
||||
featuresArr.forEach(feature => featuresById[feature.label] = feature);
|
||||
|
||||
/**
|
||||
* Return a resolved path for a given Monaco file.
|
||||
*/
|
||||
function resolveMonacoPath(filePath: string): string {
|
||||
try {
|
||||
return require.resolve(path.join('monaco-editor/esm', filePath));
|
||||
} catch(err) {
|
||||
try {
|
||||
return require.resolve(path.join(process.cwd(), 'node_modules/monaco-editor/esm', filePath));
|
||||
} catch(err){
|
||||
return require.resolve(filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the interpolated final filename for a worker, respecting the file name template.
|
||||
*/
|
||||
function getWorkerFilename(filename: string, entry: string): string {
|
||||
return loaderUtils.interpolateName(<any>{ resourcePath: entry }, filename, {
|
||||
content: fs.readFileSync(resolveMonacoPath(entry))
|
||||
});
|
||||
}
|
||||
|
||||
function getFeaturesIds(userFeatures: string[]): string[] {
|
||||
function notContainedIn(arr: string[]) {
|
||||
return (element: string) => arr.indexOf(element) === -1;
|
||||
}
|
||||
|
||||
let featuresIds: string[];
|
||||
|
||||
if (userFeatures.length) {
|
||||
const excludedFeatures = userFeatures.filter(f => f[0] === '!').map(f => f.slice(1));
|
||||
if (excludedFeatures.length) {
|
||||
featuresIds = Object.keys(featuresById).filter(notContainedIn(excludedFeatures))
|
||||
} else {
|
||||
featuresIds = userFeatures;
|
||||
}
|
||||
} else {
|
||||
featuresIds = Object.keys(featuresById);
|
||||
}
|
||||
|
||||
return featuresIds;
|
||||
}
|
||||
|
||||
interface IMonacoEditorWebpackPluginOpts {
|
||||
/**
|
||||
* Include only a subset of the languages supported.
|
||||
*/
|
||||
languages?: EditorLanguage[];
|
||||
|
||||
/**
|
||||
* Custom languages (outside of the ones shipped with the `monaco-editor`).
|
||||
*/
|
||||
customLanguages?: IFeatureDefinition[];
|
||||
|
||||
/**
|
||||
* Include only a subset of the editor features.
|
||||
* Use e.g. '!contextmenu' to exclude a certain feature.
|
||||
*/
|
||||
features?: (EditorFeature | NegatedEditorFeature)[];
|
||||
|
||||
/**
|
||||
* Specify a filename template to use for generated files.
|
||||
* Use e.g. '[name].worker.[contenthash].js' to include content-based hashes.
|
||||
*/
|
||||
filename?: string;
|
||||
|
||||
/**
|
||||
* Override the public path from which files generated by this plugin will be served.
|
||||
* This wins out over Webpack's dynamic runtime path and can be useful to avoid attempting to load workers cross-
|
||||
* origin when using a CDN for other static resources.
|
||||
* Use e.g. '/' if you want to load your resources from the current origin.
|
||||
*/
|
||||
publicPath?: string;
|
||||
|
||||
/**
|
||||
* Specify whether the editor API should be exposed through a global `monaco` object or not. This
|
||||
* option is applicable to `0.22.0` and newer version of `monaco-editor`. Since `0.22.0`, the ESM
|
||||
* version of the monaco editor does no longer define a global `monaco` object unless
|
||||
* `global.MonacoEnvironment = { globalAPI: true }` is set ([change
|
||||
* log](https://github.com/microsoft/monaco-editor/blob/main/CHANGELOG.md#0220-29012021)).
|
||||
*/
|
||||
globalAPI?: boolean;
|
||||
}
|
||||
|
||||
interface IInternalMonacoEditorWebpackPluginOpts {
|
||||
languages: IFeatureDefinition[];
|
||||
features: IFeatureDefinition[];
|
||||
filename: string;
|
||||
publicPath: string;
|
||||
globalAPI: boolean;
|
||||
}
|
||||
|
||||
class MonacoEditorWebpackPlugin implements webpack.WebpackPluginInstance {
|
||||
|
||||
private readonly options: IInternalMonacoEditorWebpackPluginOpts;
|
||||
|
||||
constructor(options: IMonacoEditorWebpackPluginOpts = {}) {
|
||||
const languages = options.languages || Object.keys(languagesById);
|
||||
const customLanguages = options.customLanguages || [];
|
||||
const features = getFeaturesIds(options.features || []);
|
||||
this.options = {
|
||||
languages: coalesce(languages.map(id => languagesById[id])).concat(customLanguages),
|
||||
features: coalesce(features.map(id => featuresById[id])),
|
||||
filename: options.filename || "[name].worker.js",
|
||||
publicPath: options.publicPath || '',
|
||||
globalAPI: options.globalAPI || false,
|
||||
};
|
||||
}
|
||||
|
||||
apply(compiler: webpack.Compiler): void {
|
||||
const { languages, features, filename, publicPath, globalAPI } = this.options;
|
||||
const compilationPublicPath = getCompilationPublicPath(compiler);
|
||||
const modules = [EDITOR_MODULE].concat(languages).concat(features);
|
||||
const workers: ILabeledWorkerDefinition[] = [];
|
||||
modules.forEach((module) => {
|
||||
if (module.worker) {
|
||||
workers.push({
|
||||
label: module.label,
|
||||
id: module.worker.id,
|
||||
entry: module.worker.entry
|
||||
});
|
||||
}
|
||||
});
|
||||
const rules = createLoaderRules(languages, features, workers, filename, publicPath, compilationPublicPath, globalAPI);
|
||||
const plugins = createPlugins(compiler, workers, filename);
|
||||
addCompilerRules(compiler, rules);
|
||||
addCompilerPlugins(compiler, plugins);
|
||||
}
|
||||
}
|
||||
|
||||
interface ILabeledWorkerDefinition {
|
||||
label: string;
|
||||
id: string;
|
||||
entry: string;
|
||||
}
|
||||
|
||||
function addCompilerRules(compiler: webpack.Compiler, rules: webpack.RuleSetRule[]): void {
|
||||
const compilerOptions = compiler.options;
|
||||
if (!compilerOptions.module) {
|
||||
compilerOptions.module = <any>{ rules: rules };
|
||||
} else {
|
||||
const moduleOptions = compilerOptions.module;
|
||||
moduleOptions.rules = (moduleOptions.rules || []).concat(rules);
|
||||
}
|
||||
}
|
||||
|
||||
function addCompilerPlugins(compiler: webpack.Compiler, plugins: webpack.WebpackPluginInstance[]) {
|
||||
plugins.forEach((plugin) => plugin.apply(compiler));
|
||||
}
|
||||
|
||||
function getCompilationPublicPath(compiler: webpack.Compiler): string {
|
||||
if (compiler.options.output && compiler.options.output.publicPath) {
|
||||
if (typeof compiler.options.output.publicPath === 'string') {
|
||||
return compiler.options.output.publicPath;
|
||||
} else {
|
||||
console.warn(`Cannot handle options.publicPath (expected a string)`);
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function createLoaderRules(languages: IFeatureDefinition[], features: IFeatureDefinition[], workers: ILabeledWorkerDefinition[], filename: string, pluginPublicPath: string, compilationPublicPath: string, globalAPI: boolean): webpack.RuleSetRule[] {
|
||||
if (!languages.length && !features.length) {
|
||||
return [];
|
||||
}
|
||||
const languagePaths = flatArr(coalesce(languages.map(language => language.entry)));
|
||||
const featurePaths = flatArr(coalesce(features.map(feature => feature.entry)));
|
||||
const workerPaths = fromPairs(workers.map(({ label, entry }) => [label, getWorkerFilename(filename, entry)]));
|
||||
if (workerPaths['typescript']) {
|
||||
// javascript shares the same worker
|
||||
workerPaths['javascript'] = workerPaths['typescript'];
|
||||
}
|
||||
if (workerPaths['css']) {
|
||||
// scss and less share the same worker
|
||||
workerPaths['less'] = workerPaths['css'];
|
||||
workerPaths['scss'] = workerPaths['css'];
|
||||
}
|
||||
|
||||
if (workerPaths['html']) {
|
||||
// handlebars, razor and html share the same worker
|
||||
workerPaths['handlebars'] = workerPaths['html'];
|
||||
workerPaths['razor'] = workerPaths['html'];
|
||||
}
|
||||
|
||||
// Determine the public path from which to load worker JS files. In order of precedence:
|
||||
// 1. Plugin-specific public path.
|
||||
// 2. Dynamic runtime public path.
|
||||
// 3. Compilation public path.
|
||||
const pathPrefix = Boolean(pluginPublicPath)
|
||||
? JSON.stringify(pluginPublicPath)
|
||||
: `typeof __webpack_public_path__ === 'string' ` +
|
||||
`? __webpack_public_path__ ` +
|
||||
`: ${JSON.stringify(compilationPublicPath)}`
|
||||
|
||||
const globals = {
|
||||
'MonacoEnvironment': `(function (paths) {
|
||||
function stripTrailingSlash(str) {
|
||||
return str.replace(/\\/$/, '');
|
||||
}
|
||||
return {
|
||||
globalAPI: ${globalAPI},
|
||||
getWorkerUrl: function (moduleId, label) {
|
||||
var pathPrefix = ${pathPrefix};
|
||||
var result = (pathPrefix ? stripTrailingSlash(pathPrefix) + '/' : '') + paths[label];
|
||||
if (/^((http:)|(https:)|(file:)|(\\/\\/))/.test(result)) {
|
||||
var currentUrl = String(window.location);
|
||||
var currentOrigin = currentUrl.substr(0, currentUrl.length - window.location.hash.length - window.location.search.length - window.location.pathname.length);
|
||||
if (result.substring(0, currentOrigin.length) !== currentOrigin) {
|
||||
if(/^(\\/\\/)/.test(result)) {
|
||||
result = window.location.protocol + result
|
||||
}
|
||||
var js = '/*' + label + '*/importScripts("' + result + '");';
|
||||
var blob = new Blob([js], { type: 'application/javascript' });
|
||||
return URL.createObjectURL(blob);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
})(${JSON.stringify(workerPaths, null, 2)})`,
|
||||
};
|
||||
return [
|
||||
{
|
||||
test: /monaco-editor[/\\]esm[/\\]vs[/\\]editor[/\\]editor.(api|main).js/,
|
||||
use: [{
|
||||
loader: INCLUDE_LOADER_PATH,
|
||||
options: {
|
||||
globals,
|
||||
pre: featurePaths.map((importPath) => resolveMonacoPath(importPath)),
|
||||
post: languagePaths.map((importPath) => resolveMonacoPath(importPath)),
|
||||
},
|
||||
}],
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
function createPlugins(compiler: webpack.Compiler, workers: ILabeledWorkerDefinition[], filename: string): AddWorkerEntryPointPlugin[] {
|
||||
const webpack = compiler.webpack ?? require('webpack');
|
||||
|
||||
return (
|
||||
(<AddWorkerEntryPointPlugin[]>[])
|
||||
.concat(workers.map(({ id, entry }) =>
|
||||
new AddWorkerEntryPointPlugin({
|
||||
id,
|
||||
entry: resolveMonacoPath(entry),
|
||||
filename: getWorkerFilename(filename, entry),
|
||||
plugins: [
|
||||
new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 1 }),
|
||||
],
|
||||
})
|
||||
))
|
||||
);
|
||||
}
|
||||
|
||||
function flatArr<T>(items: (T | T[])[]): T[] {
|
||||
return items.reduce((acc: T[], item: T | T[]) => {
|
||||
if (Array.isArray(item)) {
|
||||
return (<T[]>[]).concat(acc).concat(item);
|
||||
}
|
||||
return (<T[]>[]).concat(acc).concat([item]);
|
||||
}, <T[]>[]);
|
||||
}
|
||||
|
||||
function fromPairs<T>(values: [string, T][]): { [key: string]: T; } {
|
||||
return values.reduce((acc, [key, value]) => Object.assign(acc, { [key]: value }), <{ [key: string]: T; }>{});
|
||||
}
|
||||
|
||||
function coalesce<T>(array: ReadonlyArray<T | undefined | null>): T[] {
|
||||
return <T[]>array.filter(Boolean);
|
||||
}
|
||||
|
||||
export = MonacoEditorWebpackPlugin;
|
@ -0,0 +1,344 @@
|
||||
//
|
||||
// THIS IS A GENERATED FILE. PLEASE DO NOT EDIT DIRECTLY.
|
||||
// GENERATED USING node scripts/import-editor.js
|
||||
//
|
||||
import { IFeatureDefinition } from "./types";
|
||||
|
||||
export const languagesArr: IFeatureDefinition[] = [
|
||||
{
|
||||
label: 'abap',
|
||||
entry: 'vs/basic-languages/abap/abap.contribution'
|
||||
},
|
||||
{
|
||||
label: 'apex',
|
||||
entry: 'vs/basic-languages/apex/apex.contribution'
|
||||
},
|
||||
{
|
||||
label: 'azcli',
|
||||
entry: 'vs/basic-languages/azcli/azcli.contribution'
|
||||
},
|
||||
{
|
||||
label: 'bat',
|
||||
entry: 'vs/basic-languages/bat/bat.contribution'
|
||||
},
|
||||
{
|
||||
label: 'bicep',
|
||||
entry: 'vs/basic-languages/bicep/bicep.contribution'
|
||||
},
|
||||
{
|
||||
label: 'cameligo',
|
||||
entry: 'vs/basic-languages/cameligo/cameligo.contribution'
|
||||
},
|
||||
{
|
||||
label: 'clojure',
|
||||
entry: 'vs/basic-languages/clojure/clojure.contribution'
|
||||
},
|
||||
{
|
||||
label: 'coffee',
|
||||
entry: 'vs/basic-languages/coffee/coffee.contribution'
|
||||
},
|
||||
{
|
||||
label: 'cpp',
|
||||
entry: 'vs/basic-languages/cpp/cpp.contribution'
|
||||
},
|
||||
{
|
||||
label: 'csharp',
|
||||
entry: 'vs/basic-languages/csharp/csharp.contribution'
|
||||
},
|
||||
{
|
||||
label: 'csp',
|
||||
entry: 'vs/basic-languages/csp/csp.contribution'
|
||||
},
|
||||
{
|
||||
label: 'css',
|
||||
entry: [
|
||||
'vs/basic-languages/css/css.contribution',
|
||||
'vs/language/css/monaco.contribution'
|
||||
],
|
||||
worker: {
|
||||
id: 'vs/language/css/cssWorker',
|
||||
entry: 'vs/language/css/css.worker'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'dart',
|
||||
entry: 'vs/basic-languages/dart/dart.contribution'
|
||||
},
|
||||
{
|
||||
label: 'dockerfile',
|
||||
entry: 'vs/basic-languages/dockerfile/dockerfile.contribution'
|
||||
},
|
||||
{
|
||||
label: 'ecl',
|
||||
entry: 'vs/basic-languages/ecl/ecl.contribution'
|
||||
},
|
||||
{
|
||||
label: 'elixir',
|
||||
entry: 'vs/basic-languages/elixir/elixir.contribution'
|
||||
},
|
||||
{
|
||||
label: 'flow9',
|
||||
entry: 'vs/basic-languages/flow9/flow9.contribution'
|
||||
},
|
||||
{
|
||||
label: 'fsharp',
|
||||
entry: 'vs/basic-languages/fsharp/fsharp.contribution'
|
||||
},
|
||||
{
|
||||
label: 'go',
|
||||
entry: 'vs/basic-languages/go/go.contribution'
|
||||
},
|
||||
{
|
||||
label: 'graphql',
|
||||
entry: 'vs/basic-languages/graphql/graphql.contribution'
|
||||
},
|
||||
{
|
||||
label: 'handlebars',
|
||||
entry: 'vs/basic-languages/handlebars/handlebars.contribution'
|
||||
},
|
||||
{
|
||||
label: 'hcl',
|
||||
entry: 'vs/basic-languages/hcl/hcl.contribution'
|
||||
},
|
||||
{
|
||||
label: 'html',
|
||||
entry: [
|
||||
'vs/basic-languages/html/html.contribution',
|
||||
'vs/language/html/monaco.contribution'
|
||||
],
|
||||
worker: {
|
||||
id: 'vs/language/html/htmlWorker',
|
||||
entry: 'vs/language/html/html.worker'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'ini',
|
||||
entry: 'vs/basic-languages/ini/ini.contribution'
|
||||
},
|
||||
{
|
||||
label: 'java',
|
||||
entry: 'vs/basic-languages/java/java.contribution'
|
||||
},
|
||||
{
|
||||
label: 'javascript',
|
||||
entry: 'vs/basic-languages/javascript/javascript.contribution'
|
||||
},
|
||||
{
|
||||
label: 'json',
|
||||
entry: 'vs/language/json/monaco.contribution',
|
||||
worker: {
|
||||
id: 'vs/language/json/jsonWorker',
|
||||
entry: 'vs/language/json/json.worker'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'julia',
|
||||
entry: 'vs/basic-languages/julia/julia.contribution'
|
||||
},
|
||||
{
|
||||
label: 'kotlin',
|
||||
entry: 'vs/basic-languages/kotlin/kotlin.contribution'
|
||||
},
|
||||
{
|
||||
label: 'less',
|
||||
entry: 'vs/basic-languages/less/less.contribution'
|
||||
},
|
||||
{
|
||||
label: 'lexon',
|
||||
entry: 'vs/basic-languages/lexon/lexon.contribution'
|
||||
},
|
||||
{
|
||||
label: 'liquid',
|
||||
entry: 'vs/basic-languages/liquid/liquid.contribution'
|
||||
},
|
||||
{
|
||||
label: 'lua',
|
||||
entry: 'vs/basic-languages/lua/lua.contribution'
|
||||
},
|
||||
{
|
||||
label: 'm3',
|
||||
entry: 'vs/basic-languages/m3/m3.contribution'
|
||||
},
|
||||
{
|
||||
label: 'markdown',
|
||||
entry: 'vs/basic-languages/markdown/markdown.contribution'
|
||||
},
|
||||
{
|
||||
label: 'mips',
|
||||
entry: 'vs/basic-languages/mips/mips.contribution'
|
||||
},
|
||||
{
|
||||
label: 'msdax',
|
||||
entry: 'vs/basic-languages/msdax/msdax.contribution'
|
||||
},
|
||||
{
|
||||
label: 'mysql',
|
||||
entry: 'vs/basic-languages/mysql/mysql.contribution'
|
||||
},
|
||||
{
|
||||
label: 'objective-c',
|
||||
entry: 'vs/basic-languages/objective-c/objective-c.contribution'
|
||||
},
|
||||
{
|
||||
label: 'pascal',
|
||||
entry: 'vs/basic-languages/pascal/pascal.contribution'
|
||||
},
|
||||
{
|
||||
label: 'pascaligo',
|
||||
entry: 'vs/basic-languages/pascaligo/pascaligo.contribution'
|
||||
},
|
||||
{
|
||||
label: 'perl',
|
||||
entry: 'vs/basic-languages/perl/perl.contribution'
|
||||
},
|
||||
{
|
||||
label: 'pgsql',
|
||||
entry: 'vs/basic-languages/pgsql/pgsql.contribution'
|
||||
},
|
||||
{
|
||||
label: 'php',
|
||||
entry: 'vs/basic-languages/php/php.contribution'
|
||||
},
|
||||
{
|
||||
label: 'pla',
|
||||
entry: 'vs/basic-languages/pla/pla.contribution'
|
||||
},
|
||||
{
|
||||
label: 'postiats',
|
||||
entry: 'vs/basic-languages/postiats/postiats.contribution'
|
||||
},
|
||||
{
|
||||
label: 'powerquery',
|
||||
entry: 'vs/basic-languages/powerquery/powerquery.contribution'
|
||||
},
|
||||
{
|
||||
label: 'powershell',
|
||||
entry: 'vs/basic-languages/powershell/powershell.contribution'
|
||||
},
|
||||
{
|
||||
label: 'protobuf',
|
||||
entry: 'vs/basic-languages/protobuf/protobuf.contribution'
|
||||
},
|
||||
{
|
||||
label: 'pug',
|
||||
entry: 'vs/basic-languages/pug/pug.contribution'
|
||||
},
|
||||
{
|
||||
label: 'python',
|
||||
entry: 'vs/basic-languages/python/python.contribution'
|
||||
},
|
||||
{
|
||||
label: 'qsharp',
|
||||
entry: 'vs/basic-languages/qsharp/qsharp.contribution'
|
||||
},
|
||||
{
|
||||
label: 'r',
|
||||
entry: 'vs/basic-languages/r/r.contribution'
|
||||
},
|
||||
{
|
||||
label: 'razor',
|
||||
entry: 'vs/basic-languages/razor/razor.contribution'
|
||||
},
|
||||
{
|
||||
label: 'redis',
|
||||
entry: 'vs/basic-languages/redis/redis.contribution'
|
||||
},
|
||||
{
|
||||
label: 'redshift',
|
||||
entry: 'vs/basic-languages/redshift/redshift.contribution'
|
||||
},
|
||||
{
|
||||
label: 'restructuredtext',
|
||||
entry: 'vs/basic-languages/restructuredtext/restructuredtext.contribution'
|
||||
},
|
||||
{
|
||||
label: 'ruby',
|
||||
entry: 'vs/basic-languages/ruby/ruby.contribution'
|
||||
},
|
||||
{
|
||||
label: 'rust',
|
||||
entry: 'vs/basic-languages/rust/rust.contribution'
|
||||
},
|
||||
{
|
||||
label: 'sb',
|
||||
entry: 'vs/basic-languages/sb/sb.contribution'
|
||||
},
|
||||
{
|
||||
label: 'scala',
|
||||
entry: 'vs/basic-languages/scala/scala.contribution'
|
||||
},
|
||||
{
|
||||
label: 'scheme',
|
||||
entry: 'vs/basic-languages/scheme/scheme.contribution'
|
||||
},
|
||||
{
|
||||
label: 'scss',
|
||||
entry: 'vs/basic-languages/scss/scss.contribution'
|
||||
},
|
||||
{
|
||||
label: 'shell',
|
||||
entry: 'vs/basic-languages/shell/shell.contribution'
|
||||
},
|
||||
{
|
||||
label: 'solidity',
|
||||
entry: 'vs/basic-languages/solidity/solidity.contribution'
|
||||
},
|
||||
{
|
||||
label: 'sophia',
|
||||
entry: 'vs/basic-languages/sophia/sophia.contribution'
|
||||
},
|
||||
{
|
||||
label: 'sparql',
|
||||
entry: 'vs/basic-languages/sparql/sparql.contribution'
|
||||
},
|
||||
{
|
||||
label: 'sql',
|
||||
entry: 'vs/basic-languages/sql/sql.contribution'
|
||||
},
|
||||
{
|
||||
label: 'st',
|
||||
entry: 'vs/basic-languages/st/st.contribution'
|
||||
},
|
||||
{
|
||||
label: 'swift',
|
||||
entry: 'vs/basic-languages/swift/swift.contribution'
|
||||
},
|
||||
{
|
||||
label: 'systemverilog',
|
||||
entry: 'vs/basic-languages/systemverilog/systemverilog.contribution'
|
||||
},
|
||||
{
|
||||
label: 'tcl',
|
||||
entry: 'vs/basic-languages/tcl/tcl.contribution'
|
||||
},
|
||||
{
|
||||
label: 'twig',
|
||||
entry: 'vs/basic-languages/twig/twig.contribution'
|
||||
},
|
||||
{
|
||||
label: 'typescript',
|
||||
entry: [
|
||||
'vs/basic-languages/typescript/typescript.contribution',
|
||||
'vs/language/typescript/monaco.contribution'
|
||||
],
|
||||
worker: {
|
||||
id: 'vs/language/typescript/tsWorker',
|
||||
entry: 'vs/language/typescript/ts.worker'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'vb',
|
||||
entry: 'vs/basic-languages/vb/vb.contribution'
|
||||
},
|
||||
{
|
||||
label: 'xml',
|
||||
entry: 'vs/basic-languages/xml/xml.contribution'
|
||||
},
|
||||
{
|
||||
label: 'yaml',
|
||||
entry: 'vs/basic-languages/yaml/yaml.contribution'
|
||||
}
|
||||
];
|
||||
|
||||
export type EditorLanguage = 'abap' | 'apex' | 'azcli' | 'bat' | 'bicep' | 'cameligo' | 'clojure' | 'coffee' | 'cpp' | 'csharp' | 'csp' | 'css' | 'dart' | 'dockerfile' | 'ecl' | 'elixir' | 'flow9' | 'fsharp' | 'go' | 'graphql' | 'handlebars' | 'hcl' | 'html' | 'ini' | 'java' | 'javascript' | 'json' | 'julia' | 'kotlin' | 'less' | 'lexon' | 'liquid' | 'lua' | 'm3' | 'markdown' | 'mips' | 'msdax' | 'mysql' | 'objective-c' | 'pascal' | 'pascaligo' | 'perl' | 'pgsql' | 'php' | 'pla' | 'postiats' | 'powerquery' | 'powershell' | 'protobuf' | 'pug' | 'python' | 'qsharp' | 'r' | 'razor' | 'redis' | 'redshift' | 'restructuredtext' | 'ruby' | 'rust' | 'sb' | 'scala' | 'scheme' | 'scss' | 'shell' | 'solidity' | 'sophia' | 'sparql' | 'sql' | 'st' | 'swift' | 'systemverilog' | 'tcl' | 'twig' | 'typescript' | 'vb' | 'xml' | 'yaml';
|
||||
|
@ -0,0 +1,4 @@
|
||||
|
||||
declare module 'loader-utils' {
|
||||
export function interpolateName(loaderContext: any, name: string, options?: any): string;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
const loaderUtils = require('loader-utils');
|
||||
|
||||
export function pitch(this: any, remainingRequest: any) {
|
||||
const { globals = undefined, pre = [], post = [] } = loaderUtils.getOptions(this) || {};
|
||||
|
||||
// HACK: NamedModulesPlugin overwrites existing modules when requesting the same module via
|
||||
// different loaders, so we need to circumvent this by appending a suffix to make the name unique
|
||||
// See https://github.com/webpack/webpack/issues/4613#issuecomment-325178346 for details
|
||||
if (this._module && this._module.userRequest) {
|
||||
this._module.userRequest = `include-loader!${this._module.userRequest}`;
|
||||
}
|
||||
|
||||
return [
|
||||
...(globals
|
||||
? Object.keys(globals).map((key) => `self[${JSON.stringify(key)}] = ${globals[key]};`)
|
||||
: []
|
||||
),
|
||||
...pre.map((include: any) => `require(${loaderUtils.stringifyRequest(this, include)});`),
|
||||
`module.exports = require(${loaderUtils.stringifyRequest(this, `!!${remainingRequest}`)});`,
|
||||
...post.map((include: any) => `require(${loaderUtils.stringifyRequest(this, include)});`),
|
||||
].join('\n');
|
||||
};
|
@ -0,0 +1,52 @@
|
||||
import type * as webpack from 'webpack';
|
||||
|
||||
export interface IAddWorkerEntryPointPluginOptions {
|
||||
id: string;
|
||||
entry: string;
|
||||
filename: string;
|
||||
chunkFilename?: string;
|
||||
plugins: webpack.WebpackPluginInstance[];
|
||||
}
|
||||
|
||||
function getCompilerHook(compiler: webpack.Compiler, { id, entry, filename, chunkFilename, plugins }: IAddWorkerEntryPointPluginOptions) {
|
||||
const webpack = compiler.webpack ?? require('webpack');
|
||||
|
||||
return function (compilation: webpack.Compilation, callback: (error?: Error | null | false) => void) {
|
||||
const outputOptions = {
|
||||
filename,
|
||||
chunkFilename,
|
||||
publicPath: compilation.outputOptions.publicPath,
|
||||
// HACK: globalObject is necessary to fix https://github.com/webpack/webpack/issues/6642
|
||||
globalObject: 'this',
|
||||
};
|
||||
const childCompiler = compilation.createChildCompiler(id, outputOptions, [
|
||||
new webpack.webworker.WebWorkerTemplatePlugin(),
|
||||
new webpack.LoaderTargetPlugin('webworker'),
|
||||
]);
|
||||
const SingleEntryPlugin = webpack.EntryPlugin ?? webpack.SingleEntryPlugin;
|
||||
new SingleEntryPlugin(compiler.context, entry, 'main').apply(childCompiler);
|
||||
plugins.forEach((plugin) => plugin.apply(childCompiler));
|
||||
|
||||
childCompiler.runAsChild((err?: Error) => callback(err));
|
||||
}
|
||||
}
|
||||
|
||||
export class AddWorkerEntryPointPlugin implements webpack.WebpackPluginInstance {
|
||||
|
||||
private readonly options: IAddWorkerEntryPointPluginOptions;
|
||||
|
||||
constructor({ id, entry, filename, chunkFilename = undefined, plugins }: IAddWorkerEntryPointPluginOptions) {
|
||||
this.options = { id, entry, filename, chunkFilename, plugins };
|
||||
}
|
||||
|
||||
apply(compiler: webpack.Compiler) {
|
||||
const webpack = compiler.webpack ?? require('webpack');
|
||||
const compilerHook = getCompilerHook(compiler, this.options);
|
||||
const majorVersion = webpack.version.split('.')[0]
|
||||
if (parseInt(majorVersion) < 4) {
|
||||
(<any>compiler).plugin('make', compilerHook);
|
||||
} else {
|
||||
compiler.hooks.make.tapAsync('AddWorkerEntryPointPlugin', compilerHook);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
|
||||
export interface IWorkerDefinition {
|
||||
id: string;
|
||||
entry: string;
|
||||
}
|
||||
|
||||
export interface IFeatureDefinition {
|
||||
label: string;
|
||||
entry: string | string[] | undefined;
|
||||
worker?: IWorkerDefinition;
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container" style="width:800px;height:600px;border:1px solid #ccc"></div>
|
||||
<script type="text/javascript" src="app.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,7 @@
|
||||
|
||||
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
||||
|
||||
monaco.editor.create(document.getElementById('container'), {
|
||||
value: 'console.log("Hello, world")',
|
||||
language: 'javascript'
|
||||
});
|
@ -0,0 +1,27 @@
|
||||
const MonacoWebpackPlugin = require('../out/index.js');
|
||||
const path = require('path');
|
||||
|
||||
const ASSET_PATH = 'http://localhost:8088/monaco-editor-webpack-plugin/test/dist/';
|
||||
|
||||
module.exports = {
|
||||
mode: 'development',
|
||||
entry: './index.js',
|
||||
context: __dirname,
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'app.js',
|
||||
publicPath: ASSET_PATH
|
||||
},
|
||||
module: {
|
||||
rules: [{
|
||||
test: /\.css$/,
|
||||
use: ['style-loader', 'css-loader']
|
||||
}, {
|
||||
test: /\.ttf$/,
|
||||
use: ['file-loader']
|
||||
}]
|
||||
},
|
||||
plugins: [
|
||||
new MonacoWebpackPlugin()
|
||||
]
|
||||
};
|
@ -0,0 +1,24 @@
|
||||
const MonacoWebpackPlugin = require('../out/index.js');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
mode: 'development',
|
||||
entry: './index.js',
|
||||
context: __dirname,
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'app.js'
|
||||
},
|
||||
module: {
|
||||
rules: [{
|
||||
test: /\.css$/,
|
||||
use: ['style-loader', 'css-loader']
|
||||
}, {
|
||||
test: /\.ttf$/,
|
||||
use: ['file-loader']
|
||||
}]
|
||||
},
|
||||
plugins: [
|
||||
new MonacoWebpackPlugin()
|
||||
]
|
||||
};
|
@ -0,0 +1,15 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"outDir": "out",
|
||||
"target": "es6",
|
||||
"declaration": true,
|
||||
"strict": true
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
/node_modules/
|
||||
/out/
|
||||
/release/
|
@ -0,0 +1,12 @@
|
||||
/.vscode/
|
||||
/out/
|
||||
/scripts/
|
||||
/src/
|
||||
/test/
|
||||
/.gitignore
|
||||
/.npmignore
|
||||
/.prettierrc
|
||||
/.prettierignore
|
||||
/package-lock.json
|
||||
/webpack.dev.config.js
|
||||
/webpack.min.config.js
|
@ -0,0 +1,2 @@
|
||||
/out/
|
||||
/release/
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"arrowParens": "always",
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"semi": true,
|
||||
"useTabs": true,
|
||||
"printWidth": 100
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
"files.trimTrailingWhitespace": true,
|
||||
"search.exclude": {
|
||||
"**/node_modules": true,
|
||||
"**/release": true,
|
||||
"**/out": true
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Microsoft Corporation
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -0,0 +1,33 @@
|
||||
# Monaco HTML
|
||||
|
||||
HTML language plugin for the Monaco Editor. It provides the following features when editing HTML files:
|
||||
|
||||
- Code completion
|
||||
- Formatting
|
||||
- Document Highlights
|
||||
- Link detection
|
||||
- Syntax highlighting
|
||||
|
||||
Internally the HTML plugin uses the [vscode-html-languageservice](https://github.com/Microsoft/vscode-html-languageservice)
|
||||
node module, providing the implementation of the functionally listed above. The same module is also used
|
||||
in [Visual Studio Code](https://github.com/Microsoft/vscode) to power the HTML editing experience.
|
||||
|
||||
## Issues
|
||||
|
||||
Please file issues concering `monaco-html` in the [`monaco-editor` repository](https://github.com/Microsoft/monaco-editor/issues).
|
||||
|
||||
## Installing
|
||||
|
||||
This npm module is bundled and distributed in the [monaco-editor](https://www.npmjs.com/package/monaco-editor) npm module.
|
||||
|
||||
## Development
|
||||
|
||||
- `git clone https://github.com/Microsoft/monaco-html`
|
||||
- `cd monaco-html`
|
||||
- `npm install .`
|
||||
- `npm run watch`
|
||||
- open `$/monaco-html/test/index.html` in your favorite browser.
|
||||
|
||||
## License
|
||||
|
||||
[MIT](https://github.com/Microsoft/monaco-html/blob/master/LICENSE.md)
|
@ -0,0 +1,41 @@
|
||||
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.5 BLOCK -->
|
||||
|
||||
## Security
|
||||
|
||||
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
|
||||
|
||||
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](<https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)>), please report it to us as described below.
|
||||
|
||||
## Reporting Security Issues
|
||||
|
||||
**Please do not report security vulnerabilities through public GitHub issues.**
|
||||
|
||||
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).
|
||||
|
||||
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).
|
||||
|
||||
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
|
||||
|
||||
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
||||
|
||||
- Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
|
||||
- Full paths of source file(s) related to the manifestation of the issue
|
||||
- The location of the affected source code (tag/branch/commit or direct URL)
|
||||
- Any special configuration required to reproduce the issue
|
||||
- Step-by-step instructions to reproduce the issue
|
||||
- Proof-of-concept or exploit code (if possible)
|
||||
- Impact of the issue, including how an attacker might exploit the issue
|
||||
|
||||
This information will help us triage your report more quickly.
|
||||
|
||||
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs.
|
||||
|
||||
## Preferred Languages
|
||||
|
||||
We prefer all communications to be in English.
|
||||
|
||||
## Policy
|
||||
|
||||
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).
|
||||
|
||||
<!-- END MICROSOFT SECURITY.MD BLOCK -->
|
@ -0,0 +1,109 @@
|
||||
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
|
||||
Do Not Translate or Localize
|
||||
|
||||
This project incorporates components from the projects listed below. The original copyright notices and the licenses
|
||||
under which Microsoft received such components are set forth below. Microsoft reserves all rights not expressly granted
|
||||
herein, whether by implication, estoppel or otherwise.
|
||||
|
||||
|
||||
|
||||
|
||||
%% HTML 5.1 W3C Working Draft version 08 October 2015 (http://www.w3.org/TR/2015/WD-html51-20151008/)
|
||||
=========================================
|
||||
Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang). This software or document includes material copied
|
||||
from or derived from HTML 5.1 W3C Working Draft (http://www.w3.org/TR/2015/WD-html51-20151008/.)
|
||||
|
||||
THIS DOCUMENT IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT
|
||||
NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF
|
||||
THE DOCUMENT ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY
|
||||
PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
|
||||
|
||||
COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE
|
||||
DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF.
|
||||
|
||||
The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to this document or its contents
|
||||
without specific, written prior permission. Title to copyright in this document will at all times remain with copyright holders.
|
||||
=========================================
|
||||
END OF HTML 5.1 W3C Working Draft NOTICES AND INFORMATION
|
||||
|
||||
|
||||
|
||||
|
||||
%% JS Beautifier version 1.6.2 (https://github.com/beautify-web/js-beautify)
|
||||
=========================================
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2007-2017 Einar Lielmanis, Liam Newman, and contributors.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
=========================================
|
||||
END OF js-beautify NOTICES AND INFORMATION
|
||||
|
||||
|
||||
|
||||
|
||||
%% Ionic documentation version 1.2.4 (https://github.com/driftyco/ionic-site)
|
||||
=========================================
|
||||
Copyright Drifty Co. http://drifty.com/.
|
||||
|
||||
Apache License
|
||||
|
||||
Version 2.0, January 2004
|
||||
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
||||
|
||||
You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
||||
|
||||
You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||
|
||||
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||
|
||||
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
=========================================
|
||||
END OF Ionic documentation NOTICES AND INFORMATION
|
@ -0,0 +1,172 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/// <reference path="node_modules/monaco-editor-core/monaco.d.ts" />
|
||||
|
||||
declare namespace monaco.languages.html {
|
||||
export interface HTMLFormatConfiguration {
|
||||
readonly tabSize: number;
|
||||
readonly insertSpaces: boolean;
|
||||
readonly wrapLineLength: number;
|
||||
readonly unformatted: string;
|
||||
readonly contentUnformatted: string;
|
||||
readonly indentInnerHtml: boolean;
|
||||
readonly preserveNewLines: boolean;
|
||||
readonly maxPreserveNewLines: number;
|
||||
readonly indentHandlebars: boolean;
|
||||
readonly endWithNewline: boolean;
|
||||
readonly extraLiners: string;
|
||||
readonly wrapAttributes: 'auto' | 'force' | 'force-aligned' | 'force-expand-multiline';
|
||||
}
|
||||
export interface CompletionConfiguration {
|
||||
readonly [providerId: string]: boolean;
|
||||
}
|
||||
export interface Options {
|
||||
/**
|
||||
* If set, comments are tolerated. If set to false, syntax errors will be emitted for comments.
|
||||
*/
|
||||
readonly format?: HTMLFormatConfiguration;
|
||||
/**
|
||||
* A list of known schemas and/or associations of schemas to file names.
|
||||
*/
|
||||
readonly suggest?: CompletionConfiguration;
|
||||
/**
|
||||
* Configures the HTML data types known by the HTML langauge service.
|
||||
*/
|
||||
readonly data?: HTMLDataConfiguration;
|
||||
}
|
||||
export interface ModeConfiguration {
|
||||
/**
|
||||
* Defines whether the built-in completionItemProvider is enabled.
|
||||
*/
|
||||
readonly completionItems?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in hoverProvider is enabled.
|
||||
*/
|
||||
readonly hovers?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in documentSymbolProvider is enabled.
|
||||
*/
|
||||
readonly documentSymbols?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in definitions provider is enabled.
|
||||
*/
|
||||
readonly links?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in references provider is enabled.
|
||||
*/
|
||||
readonly documentHighlights?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in rename provider is enabled.
|
||||
*/
|
||||
readonly rename?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in color provider is enabled.
|
||||
*/
|
||||
readonly colors?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in foldingRange provider is enabled.
|
||||
*/
|
||||
readonly foldingRanges?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in diagnostic provider is enabled.
|
||||
*/
|
||||
readonly diagnostics?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in selection range provider is enabled.
|
||||
*/
|
||||
readonly selectionRanges?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in documentFormattingEdit provider is enabled.
|
||||
*/
|
||||
readonly documentFormattingEdits?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in documentRangeFormattingEdit provider is enabled.
|
||||
*/
|
||||
readonly documentRangeFormattingEdits?: boolean;
|
||||
}
|
||||
export interface LanguageServiceDefaults {
|
||||
readonly languageId: string;
|
||||
readonly modeConfiguration: ModeConfiguration;
|
||||
readonly onDidChange: IEvent<LanguageServiceDefaults>;
|
||||
readonly options: Options;
|
||||
setOptions(options: Options): void;
|
||||
setModeConfiguration(modeConfiguration: ModeConfiguration): void;
|
||||
}
|
||||
export const htmlLanguageService: LanguageServiceRegistration;
|
||||
export const htmlDefaults: LanguageServiceDefaults;
|
||||
export const handlebarLanguageService: LanguageServiceRegistration;
|
||||
export const handlebarDefaults: LanguageServiceDefaults;
|
||||
export const razorLanguageService: LanguageServiceRegistration;
|
||||
export const razorDefaults: LanguageServiceDefaults;
|
||||
export interface LanguageServiceRegistration extends IDisposable {
|
||||
readonly defaults: LanguageServiceDefaults;
|
||||
}
|
||||
/**
|
||||
* Registers a new HTML language service for the languageId.
|
||||
* Note: 'html', 'handlebar' and 'razor' are registered by default.
|
||||
*
|
||||
* Use this method to register additional language ids with a HTML service.
|
||||
* The language server has to be registered before an editor model is opened.
|
||||
*/
|
||||
export function registerHTMLLanguageService(
|
||||
languageId: string,
|
||||
options?: Options,
|
||||
modeConfiguration?: ModeConfiguration
|
||||
): LanguageServiceRegistration;
|
||||
export interface HTMLDataConfiguration {
|
||||
/**
|
||||
* Defines whether the standard HTML tags and attributes are shown
|
||||
*/
|
||||
readonly useDefaultDataProvider?: boolean;
|
||||
/**
|
||||
* Provides a set of custom data providers.
|
||||
*/
|
||||
readonly dataProviders?: {
|
||||
[providerId: string]: HTMLDataV1;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Custom HTML tags attributes and attribute values
|
||||
* https://github.com/microsoft/vscode-html-languageservice/blob/main/docs/customData.md
|
||||
*/
|
||||
export interface HTMLDataV1 {
|
||||
readonly version: 1 | 1.1;
|
||||
readonly tags?: ITagData[];
|
||||
readonly globalAttributes?: IAttributeData[];
|
||||
readonly valueSets?: IValueSet[];
|
||||
}
|
||||
export interface IReference {
|
||||
readonly name: string;
|
||||
readonly url: string;
|
||||
}
|
||||
export interface ITagData {
|
||||
readonly name: string;
|
||||
readonly description?: string | MarkupContent;
|
||||
readonly attributes: IAttributeData[];
|
||||
readonly references?: IReference[];
|
||||
}
|
||||
export interface IAttributeData {
|
||||
readonly name: string;
|
||||
readonly description?: string | MarkupContent;
|
||||
readonly valueSet?: string;
|
||||
readonly values?: IValueData[];
|
||||
readonly references?: IReference[];
|
||||
}
|
||||
export interface IValueData {
|
||||
readonly name: string;
|
||||
readonly description?: string | MarkupContent;
|
||||
readonly references?: IReference[];
|
||||
}
|
||||
export interface IValueSet {
|
||||
readonly name: string;
|
||||
readonly values: IValueData[];
|
||||
}
|
||||
export interface MarkupContent {
|
||||
readonly kind: MarkupKind;
|
||||
readonly value: string;
|
||||
}
|
||||
export type MarkupKind = 'plaintext' | 'markdown';
|
||||
}
|
@ -0,0 +1,497 @@
|
||||
{
|
||||
"name": "monaco-html",
|
||||
"version": "3.9.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@types/minimatch": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz",
|
||||
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==",
|
||||
"dev": true
|
||||
},
|
||||
"ansi-styles": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-convert": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"array-differ": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz",
|
||||
"integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==",
|
||||
"dev": true
|
||||
},
|
||||
"array-union": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz",
|
||||
"integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==",
|
||||
"dev": true
|
||||
},
|
||||
"arrify": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz",
|
||||
"integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==",
|
||||
"dev": true
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
|
||||
"dev": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"buffer-from": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
|
||||
"integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==",
|
||||
"dev": true
|
||||
},
|
||||
"chalk": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
|
||||
"integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-styles": "^4.1.0",
|
||||
"supports-color": "^7.1.0"
|
||||
}
|
||||
},
|
||||
"color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-name": "~1.1.4"
|
||||
}
|
||||
},
|
||||
"color-name": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||
"dev": true
|
||||
},
|
||||
"commander": {
|
||||
"version": "2.20.3",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
|
||||
"dev": true
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
|
||||
"dev": true
|
||||
},
|
||||
"cross-spawn": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"path-key": "^3.1.0",
|
||||
"shebang-command": "^2.0.0",
|
||||
"which": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"end-of-stream": {
|
||||
"version": "1.4.4",
|
||||
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
|
||||
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"once": "^1.4.0"
|
||||
}
|
||||
},
|
||||
"execa": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz",
|
||||
"integrity": "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"cross-spawn": "^7.0.0",
|
||||
"get-stream": "^5.0.0",
|
||||
"human-signals": "^1.1.1",
|
||||
"is-stream": "^2.0.0",
|
||||
"merge-stream": "^2.0.0",
|
||||
"npm-run-path": "^4.0.0",
|
||||
"onetime": "^5.1.0",
|
||||
"signal-exit": "^3.0.2",
|
||||
"strip-final-newline": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"find-up": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
|
||||
"integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"locate-path": "^5.0.0",
|
||||
"path-exists": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"get-stream": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
|
||||
"integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"pump": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||
"dev": true
|
||||
},
|
||||
"human-signals": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz",
|
||||
"integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==",
|
||||
"dev": true
|
||||
},
|
||||
"husky": {
|
||||
"version": "5.1.3",
|
||||
"resolved": "https://registry.npmjs.org/husky/-/husky-5.1.3.tgz",
|
||||
"integrity": "sha512-fbNJ+Gz5wx2LIBtMweJNY1D7Uc8p1XERi5KNRMccwfQA+rXlxWNSdUxswo0gT8XqxywTIw7Ywm/F4v/O35RdMg==",
|
||||
"dev": true
|
||||
},
|
||||
"ignore": {
|
||||
"version": "5.1.8",
|
||||
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz",
|
||||
"integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==",
|
||||
"dev": true
|
||||
},
|
||||
"is-stream": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz",
|
||||
"integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==",
|
||||
"dev": true
|
||||
},
|
||||
"isexe": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
|
||||
"dev": true
|
||||
},
|
||||
"locate-path": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
|
||||
"integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"p-locate": "^4.1.0"
|
||||
}
|
||||
},
|
||||
"merge-stream": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
|
||||
"integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
|
||||
"dev": true
|
||||
},
|
||||
"mimic-fn": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
|
||||
"integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
|
||||
"dev": true
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
},
|
||||
"monaco-editor-core": {
|
||||
"version": "0.30.0",
|
||||
"resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.30.0.tgz",
|
||||
"integrity": "sha512-vFJ7BEOCqLv4xWgFW+UheI/PtccHHNht29lNmo79Re1kNhWCBLLb2nThjRMLPO1rd41vX9hhd9C07/iKOk9/jQ==",
|
||||
"dev": true
|
||||
},
|
||||
"monaco-languages": {
|
||||
"version": "2.11.0",
|
||||
"resolved": "https://registry.npmjs.org/monaco-languages/-/monaco-languages-2.11.0.tgz",
|
||||
"integrity": "sha512-fpeP8XUPejcdoUEMZ5bo4MW8VzEadhrsuyDtT48p2a2PSRT/CXptQm4eGnIfgxf5R95jrCZ0456c5dSEPBuktA==",
|
||||
"dev": true
|
||||
},
|
||||
"monaco-plugin-helpers": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/monaco-plugin-helpers/-/monaco-plugin-helpers-1.0.3.tgz",
|
||||
"integrity": "sha512-6AYI3ONAy8ki74qG2JqtFrLdiJHQlgeO5l4Rwr0OMyIpGXhc94y5rZuFxOtgGkxgSrZfHSwOt/MulUNZ/mOQOw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"typescript": "^2.7.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"typescript": {
|
||||
"version": "2.9.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz",
|
||||
"integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"mri": {
|
||||
"version": "1.1.6",
|
||||
"resolved": "https://registry.npmjs.org/mri/-/mri-1.1.6.tgz",
|
||||
"integrity": "sha512-oi1b3MfbyGa7FJMP9GmLTttni5JoICpYBRlq+x5V16fZbLsnL9N3wFqqIm/nIG43FjUFkFh9Epzp/kzUGUnJxQ==",
|
||||
"dev": true
|
||||
},
|
||||
"multimatch": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/multimatch/-/multimatch-4.0.0.tgz",
|
||||
"integrity": "sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/minimatch": "^3.0.3",
|
||||
"array-differ": "^3.0.0",
|
||||
"array-union": "^2.1.0",
|
||||
"arrify": "^2.0.1",
|
||||
"minimatch": "^3.0.4"
|
||||
}
|
||||
},
|
||||
"npm-run-path": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
|
||||
"integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"path-key": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"onetime": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
|
||||
"integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"mimic-fn": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"p-limit": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
|
||||
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"p-try": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"p-locate": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
|
||||
"integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"p-limit": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"p-try": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
|
||||
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
|
||||
"dev": true
|
||||
},
|
||||
"path-exists": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
|
||||
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
|
||||
"dev": true
|
||||
},
|
||||
"path-key": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
|
||||
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
|
||||
"dev": true
|
||||
},
|
||||
"prettier": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz",
|
||||
"integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==",
|
||||
"dev": true
|
||||
},
|
||||
"pretty-quick": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/pretty-quick/-/pretty-quick-3.1.0.tgz",
|
||||
"integrity": "sha512-DtxIxksaUWCgPFN7E1ZZk4+Aav3CCuRdhrDSFZENb404sYMtuo9Zka823F+Mgeyt8Zt3bUiCjFzzWYE9LYqkmQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "^3.0.0",
|
||||
"execa": "^4.0.0",
|
||||
"find-up": "^4.1.0",
|
||||
"ignore": "^5.1.4",
|
||||
"mri": "^1.1.5",
|
||||
"multimatch": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"pump": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
||||
"integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"end-of-stream": "^1.1.0",
|
||||
"once": "^1.3.1"
|
||||
}
|
||||
},
|
||||
"requirejs": {
|
||||
"version": "2.3.6",
|
||||
"resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.6.tgz",
|
||||
"integrity": "sha512-ipEzlWQe6RK3jkzikgCupiTbTvm4S0/CAU5GlgptkN5SO6F3u0UD0K18wy6ErDqiCyP4J4YYe1HuAShvsxePLg==",
|
||||
"dev": true
|
||||
},
|
||||
"shebang-command": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"shebang-regex": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"shebang-regex": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
|
||||
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
|
||||
"dev": true
|
||||
},
|
||||
"signal-exit": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
|
||||
"integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==",
|
||||
"dev": true
|
||||
},
|
||||
"source-map": {
|
||||
"version": "0.7.3",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
|
||||
"integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==",
|
||||
"dev": true
|
||||
},
|
||||
"source-map-support": {
|
||||
"version": "0.5.19",
|
||||
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz",
|
||||
"integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"buffer-from": "^1.0.0",
|
||||
"source-map": "^0.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"strip-final-newline": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz",
|
||||
"integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",
|
||||
"dev": true
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has-flag": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"terser": {
|
||||
"version": "5.6.0",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.6.0.tgz",
|
||||
"integrity": "sha512-vyqLMoqadC1uR0vywqOZzriDYzgEkNJFK4q9GeyOBHIbiECHiWLKcWfbQWAUaPfxkjDhapSlZB9f7fkMrvkVjA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"commander": "^2.20.0",
|
||||
"source-map": "~0.7.2",
|
||||
"source-map-support": "~0.5.19"
|
||||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz",
|
||||
"integrity": "sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==",
|
||||
"dev": true
|
||||
},
|
||||
"vscode-html-languageservice": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/vscode-html-languageservice/-/vscode-html-languageservice-4.1.1.tgz",
|
||||
"integrity": "sha512-rrDyCiOgMwOPgchpPGAeLzjYVVEW/Ror2/a1BWUEI3S9+NQhA9vj4SQkzmH6g2Bq9S9SV0OQeadD+xphOf1N3w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"vscode-languageserver-textdocument": "^1.0.1",
|
||||
"vscode-languageserver-types": "^3.16.0",
|
||||
"vscode-nls": "^5.0.0",
|
||||
"vscode-uri": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"vscode-languageserver-textdocument": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.2.tgz",
|
||||
"integrity": "sha512-T7uPC18+f8mYE4lbVZwb3OSmvwTZm3cuFhrdx9Bn2l11lmp3SvSuSVjy2JtvrghzjAo4G6Trqny2m9XGnFnWVA==",
|
||||
"dev": true
|
||||
},
|
||||
"vscode-languageserver-types": {
|
||||
"version": "3.16.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0.tgz",
|
||||
"integrity": "sha512-k8luDIWJWyenLc5ToFQQMaSrqCHiLwyKPHKPQZ5zz21vM+vIVUSvsRpcbiECH4WR88K2XZqc4ScRcZ7nk/jbeA==",
|
||||
"dev": true
|
||||
},
|
||||
"vscode-nls": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-5.0.0.tgz",
|
||||
"integrity": "sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==",
|
||||
"dev": true
|
||||
},
|
||||
"vscode-uri": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.2.tgz",
|
||||
"integrity": "sha512-jkjy6pjU1fxUvI51P+gCsxg1u2n8LSt0W6KrCNQceaziKzff74GoWmjVG46KieVzybO1sttPQmYfrwSHey7GUA==",
|
||||
"dev": true
|
||||
},
|
||||
"which": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"isexe": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "monaco-html",
|
||||
"version": "3.9.0",
|
||||
"description": "HTML plugin for the Monaco Editor",
|
||||
"scripts": {
|
||||
"compile": "mrmdir ./out && tsc -p ./src/tsconfig.json && tsc -p ./src/tsconfig.esm.json && node ./scripts/dts && prettier --write ./monaco.d.ts",
|
||||
"watch": "tsc -p ./src --watch",
|
||||
"prepublishOnly": "mrmdir ./release && npm run compile && node ./scripts/release.js && node ./scripts/bundle && mcopy ./monaco.d.ts ./release/monaco.d.ts && mcopy ./out/esm/monaco.contribution.d.ts ./release/esm/monaco.contribution.d.ts && mcopy ./out/esm/fillers/monaco-editor-core.d.ts ./release/esm/fillers/monaco-editor-core.d.ts",
|
||||
"install-service-next": "npm install vscode-html-languageservice@next -f -D && npm install vscode-languageserver-types@next -f -D",
|
||||
"install-service-local": "npm install ../vscode-html-languageservice -f -D && npm install ../vscode-languageserver-node/types -f -D",
|
||||
"prettier": "prettier --write ."
|
||||
},
|
||||
"author": "Microsoft Corporation",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Microsoft/monaco-html"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Microsoft/monaco-editor/issues"
|
||||
},
|
||||
"module": "./release/esm/monaco.contribution.js",
|
||||
"typings": "./release/esm/monaco.contribution.d.ts",
|
||||
"devDependencies": {
|
||||
"husky": "^5.1.3",
|
||||
"monaco-editor-core": "0.30.0",
|
||||
"monaco-languages": "^2.11.0",
|
||||
"monaco-plugin-helpers": "^1.0.3",
|
||||
"prettier": "^2.2.1",
|
||||
"pretty-quick": "^3.1.0",
|
||||
"requirejs": "^2.3.6",
|
||||
"terser": "^5.6.0",
|
||||
"typescript": "^4.2.3",
|
||||
"vscode-html-languageservice": "^4.1.1",
|
||||
"vscode-languageserver-textdocument": "^1.0.2",
|
||||
"vscode-languageserver-types": "3.16.0"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "pretty-quick --staged"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
const requirejs = require('requirejs');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const terser = require('terser');
|
||||
const helpers = require('monaco-plugin-helpers');
|
||||
|
||||
const REPO_ROOT = path.resolve(__dirname, '..');
|
||||
|
||||
const sha1 = helpers.getGitVersion(REPO_ROOT);
|
||||
const semver = require('../package.json').version;
|
||||
const headerVersion = semver + '(' + sha1 + ')';
|
||||
|
||||
const BUNDLED_FILE_HEADER = [
|
||||
'/*!-----------------------------------------------------------------------------',
|
||||
' * Copyright (c) Microsoft Corporation. All rights reserved.',
|
||||
' * monaco-html version: ' + headerVersion,
|
||||
' * Released under the MIT license',
|
||||
' * https://github.com/Microsoft/monaco-html/blob/master/LICENSE.md',
|
||||
' *-----------------------------------------------------------------------------*/',
|
||||
''
|
||||
].join('\n');
|
||||
|
||||
bundleOne('monaco.contribution');
|
||||
bundleOne('htmlMode', ['vs/language/html/monaco.contribution']);
|
||||
bundleOne('htmlWorker');
|
||||
|
||||
function bundleOne(moduleId, exclude) {
|
||||
requirejs.optimize(
|
||||
{
|
||||
baseUrl: 'out/amd/',
|
||||
name: 'vs/language/html/' + moduleId,
|
||||
out: 'release/dev/' + moduleId + '.js',
|
||||
exclude: exclude,
|
||||
paths: {
|
||||
'vs/language/html': REPO_ROOT + '/out/amd',
|
||||
'vs/language/html/fillers/monaco-editor-core':
|
||||
REPO_ROOT + '/out/amd/fillers/monaco-editor-core-amd'
|
||||
},
|
||||
optimize: 'none',
|
||||
packages: [
|
||||
{
|
||||
name: 'vscode-html-languageservice',
|
||||
location: path.join(REPO_ROOT, 'node_modules/vscode-html-languageservice/lib/umd'),
|
||||
main: 'htmlLanguageService'
|
||||
},
|
||||
{
|
||||
name: 'vscode-languageserver-types',
|
||||
location: path.join(REPO_ROOT, 'node_modules/vscode-languageserver-types/lib/umd'),
|
||||
main: 'main'
|
||||
},
|
||||
{
|
||||
name: 'vscode-languageserver-textdocument',
|
||||
location: path.join(REPO_ROOT, 'node_modules/vscode-languageserver-textdocument/lib/umd'),
|
||||
main: 'main'
|
||||
},
|
||||
{
|
||||
name: 'vscode-uri',
|
||||
location: path.join(REPO_ROOT, 'node_modules/vscode-uri/lib/umd'),
|
||||
main: 'index'
|
||||
},
|
||||
{
|
||||
name: 'vscode-nls',
|
||||
location: path.join(REPO_ROOT, '/out/amd/fillers'),
|
||||
main: 'vscode-nls'
|
||||
}
|
||||
]
|
||||
},
|
||||
async function (buildResponse) {
|
||||
const devFilePath = path.join(REPO_ROOT, 'release/dev/' + moduleId + '.js');
|
||||
const minFilePath = path.join(REPO_ROOT, 'release/min/' + moduleId + '.js');
|
||||
const fileContents = fs.readFileSync(devFilePath).toString();
|
||||
console.log();
|
||||
console.log(`Minifying ${devFilePath}...`);
|
||||
const result = await terser.minify(fileContents, {
|
||||
output: {
|
||||
comments: 'some'
|
||||
}
|
||||
});
|
||||
console.log(`Done minifying ${devFilePath}.`);
|
||||
try {
|
||||
fs.mkdirSync(path.join(REPO_ROOT, 'release/min'));
|
||||
} catch (err) {}
|
||||
fs.writeFileSync(minFilePath, BUNDLED_FILE_HEADER + result.code);
|
||||
}
|
||||
);
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
const REPO_ROOT = path.join(__dirname, '../');
|
||||
const SRC_PATH = path.join(REPO_ROOT, 'out/amd/monaco.contribution.d.ts');
|
||||
const DST_PATH = path.join(REPO_ROOT, 'monaco.d.ts');
|
||||
|
||||
const lines = fs
|
||||
.readFileSync(SRC_PATH)
|
||||
.toString()
|
||||
.split(/\r\n|\r|\n/);
|
||||
let result = [
|
||||
`/*---------------------------------------------------------------------------------------------`,
|
||||
` * Copyright (c) Microsoft Corporation. All rights reserved.`,
|
||||
` * Licensed under the MIT License. See License.txt in the project root for license information.`,
|
||||
` *--------------------------------------------------------------------------------------------*/`,
|
||||
``,
|
||||
`/// <reference path="node_modules/monaco-editor-core/monaco.d.ts" />`,
|
||||
``,
|
||||
`declare namespace monaco.languages.html {`
|
||||
];
|
||||
for (let line of lines) {
|
||||
if (/^import/.test(line)) {
|
||||
continue;
|
||||
}
|
||||
line = line.replace(/ /g, '\t');
|
||||
line = line.replace(/declare /g, '');
|
||||
if (line.length > 0) {
|
||||
line = `\t${line}`;
|
||||
result.push(line);
|
||||
}
|
||||
}
|
||||
result.push(`}`);
|
||||
result.push(``);
|
||||
|
||||
fs.writeFileSync(DST_PATH, result.join('\n'));
|
@ -0,0 +1,26 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
const path = require('path');
|
||||
const helpers = require('monaco-plugin-helpers');
|
||||
|
||||
const REPO_ROOT = path.join(__dirname, '../');
|
||||
|
||||
helpers.packageESM({
|
||||
repoRoot: REPO_ROOT,
|
||||
esmSource: 'out/esm',
|
||||
esmDestination: 'release/esm',
|
||||
entryPoints: ['monaco.contribution.js', 'htmlMode.js', 'html.worker.js'],
|
||||
resolveAlias: {
|
||||
'vscode-nls': path.join(REPO_ROOT, 'out/esm/fillers/vscode-nls.js')
|
||||
},
|
||||
resolveSkip: ['monaco-editor-core'],
|
||||
destinationFolderSimplification: {
|
||||
node_modules: '_deps',
|
||||
'vscode-languageserver-types/lib/esm': 'vscode-languageserver-types',
|
||||
'vscode-uri/lib/esm': 'vscode-uri',
|
||||
'vscode-html-languageservice/lib/esm': 'vscode-html-languageservice'
|
||||
}
|
||||
});
|
@ -0,0 +1,12 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
// Resolves with the global monaco API
|
||||
|
||||
declare var define;
|
||||
|
||||
define([], function () {
|
||||
return (<any>self).monaco;
|
||||
});
|
@ -0,0 +1,6 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
export * from 'monaco-editor-core';
|
@ -0,0 +1,46 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
export interface Options {
|
||||
locale?: string;
|
||||
cacheLanguageResolution?: boolean;
|
||||
}
|
||||
export interface LocalizeInfo {
|
||||
key: string;
|
||||
comment: string[];
|
||||
}
|
||||
export interface LocalizeFunc {
|
||||
(info: LocalizeInfo, message: string, ...args: any[]): string;
|
||||
(key: string, message: string, ...args: any[]): string;
|
||||
}
|
||||
export interface LoadFunc {
|
||||
(file?: string): LocalizeFunc;
|
||||
}
|
||||
|
||||
function format(message: string, args: any[]): string {
|
||||
let result: string;
|
||||
|
||||
if (args.length === 0) {
|
||||
result = message;
|
||||
} else {
|
||||
result = message.replace(/\{(\d+)\}/g, (match, rest) => {
|
||||
let index = rest[0];
|
||||
return typeof args[index] !== 'undefined' ? args[index] : match;
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function localize(key: string | LocalizeInfo, message: string, ...args: any[]): string {
|
||||
return format(message, args);
|
||||
}
|
||||
|
||||
export function loadMessageBundle(file?: string): LocalizeFunc {
|
||||
return localize;
|
||||
}
|
||||
|
||||
export function config(opt?: Options | string): LoadFunc {
|
||||
return loadMessageBundle;
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as worker from 'monaco-editor-core/esm/vs/editor/editor.worker';
|
||||
import { HTMLWorker } from './htmlWorker';
|
||||
|
||||
self.onmessage = () => {
|
||||
// ignore the first message
|
||||
worker.initialize((ctx, createData) => {
|
||||
return new HTMLWorker(ctx, createData);
|
||||
});
|
||||
};
|
@ -0,0 +1,164 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { WorkerManager } from './workerManager';
|
||||
import type { HTMLWorker } from './htmlWorker';
|
||||
import { LanguageServiceDefaults } from './monaco.contribution';
|
||||
import * as languageFeatures from './languageFeatures';
|
||||
import { Uri, IDisposable, languages } from './fillers/monaco-editor-core';
|
||||
|
||||
export function setupMode1(defaults: LanguageServiceDefaults): void {
|
||||
const client = new WorkerManager(defaults);
|
||||
|
||||
const worker: languageFeatures.WorkerAccessor = (...uris: Uri[]): Promise<HTMLWorker> => {
|
||||
return client.getLanguageServiceWorker(...uris);
|
||||
};
|
||||
|
||||
let languageId = defaults.languageId;
|
||||
|
||||
// all modes
|
||||
languages.registerCompletionItemProvider(
|
||||
languageId,
|
||||
new languageFeatures.CompletionAdapter(worker)
|
||||
);
|
||||
languages.registerHoverProvider(languageId, new languageFeatures.HoverAdapter(worker));
|
||||
|
||||
languages.registerDocumentHighlightProvider(
|
||||
languageId,
|
||||
new languageFeatures.DocumentHighlightAdapter(worker)
|
||||
);
|
||||
languages.registerLinkProvider(languageId, new languageFeatures.DocumentLinkAdapter(worker));
|
||||
languages.registerFoldingRangeProvider(
|
||||
languageId,
|
||||
new languageFeatures.FoldingRangeAdapter(worker)
|
||||
);
|
||||
languages.registerDocumentSymbolProvider(
|
||||
languageId,
|
||||
new languageFeatures.DocumentSymbolAdapter(worker)
|
||||
);
|
||||
languages.registerSelectionRangeProvider(
|
||||
languageId,
|
||||
new languageFeatures.SelectionRangeAdapter(worker)
|
||||
);
|
||||
languages.registerRenameProvider(languageId, new languageFeatures.RenameAdapter(worker));
|
||||
|
||||
// only html
|
||||
if (languageId === 'html') {
|
||||
languages.registerDocumentFormattingEditProvider(
|
||||
languageId,
|
||||
new languageFeatures.DocumentFormattingEditProvider(worker)
|
||||
);
|
||||
languages.registerDocumentRangeFormattingEditProvider(
|
||||
languageId,
|
||||
new languageFeatures.DocumentRangeFormattingEditProvider(worker)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export function setupMode(defaults: LanguageServiceDefaults): IDisposable {
|
||||
const disposables: IDisposable[] = [];
|
||||
const providers: IDisposable[] = [];
|
||||
|
||||
const client = new WorkerManager(defaults);
|
||||
disposables.push(client);
|
||||
|
||||
const worker: languageFeatures.WorkerAccessor = (...uris: Uri[]): Promise<HTMLWorker> => {
|
||||
return client.getLanguageServiceWorker(...uris);
|
||||
};
|
||||
|
||||
function registerProviders(): void {
|
||||
const { languageId, modeConfiguration } = defaults;
|
||||
|
||||
disposeAll(providers);
|
||||
|
||||
if (modeConfiguration.completionItems) {
|
||||
providers.push(
|
||||
languages.registerCompletionItemProvider(
|
||||
languageId,
|
||||
new languageFeatures.CompletionAdapter(worker)
|
||||
)
|
||||
);
|
||||
}
|
||||
if (modeConfiguration.hovers) {
|
||||
providers.push(
|
||||
languages.registerHoverProvider(languageId, new languageFeatures.HoverAdapter(worker))
|
||||
);
|
||||
}
|
||||
if (modeConfiguration.documentHighlights) {
|
||||
providers.push(
|
||||
languages.registerDocumentHighlightProvider(
|
||||
languageId,
|
||||
new languageFeatures.DocumentHighlightAdapter(worker)
|
||||
)
|
||||
);
|
||||
}
|
||||
if (modeConfiguration.links) {
|
||||
providers.push(
|
||||
languages.registerLinkProvider(languageId, new languageFeatures.DocumentLinkAdapter(worker))
|
||||
);
|
||||
}
|
||||
if (modeConfiguration.documentSymbols) {
|
||||
providers.push(
|
||||
languages.registerDocumentSymbolProvider(
|
||||
languageId,
|
||||
new languageFeatures.DocumentSymbolAdapter(worker)
|
||||
)
|
||||
);
|
||||
}
|
||||
if (modeConfiguration.rename) {
|
||||
providers.push(
|
||||
languages.registerRenameProvider(languageId, new languageFeatures.RenameAdapter(worker))
|
||||
);
|
||||
}
|
||||
if (modeConfiguration.foldingRanges) {
|
||||
providers.push(
|
||||
languages.registerFoldingRangeProvider(
|
||||
languageId,
|
||||
new languageFeatures.FoldingRangeAdapter(worker)
|
||||
)
|
||||
);
|
||||
}
|
||||
if (modeConfiguration.selectionRanges) {
|
||||
providers.push(
|
||||
languages.registerSelectionRangeProvider(
|
||||
languageId,
|
||||
new languageFeatures.SelectionRangeAdapter(worker)
|
||||
)
|
||||
);
|
||||
}
|
||||
if (modeConfiguration.documentFormattingEdits) {
|
||||
providers.push(
|
||||
languages.registerDocumentFormattingEditProvider(
|
||||
languageId,
|
||||
new languageFeatures.DocumentFormattingEditProvider(worker)
|
||||
)
|
||||
);
|
||||
}
|
||||
if (modeConfiguration.documentRangeFormattingEdits) {
|
||||
providers.push(
|
||||
languages.registerDocumentRangeFormattingEditProvider(
|
||||
languageId,
|
||||
new languageFeatures.DocumentRangeFormattingEditProvider(worker)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
registerProviders();
|
||||
|
||||
disposables.push(asDisposable(providers));
|
||||
|
||||
return asDisposable(disposables);
|
||||
}
|
||||
|
||||
function asDisposable(disposables: IDisposable[]): IDisposable {
|
||||
return { dispose: () => disposeAll(disposables) };
|
||||
}
|
||||
|
||||
function disposeAll(disposables: IDisposable[]) {
|
||||
while (disposables.length) {
|
||||
disposables.pop().dispose();
|
||||
}
|
||||
}
|
@ -0,0 +1,134 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { worker } from './fillers/monaco-editor-core';
|
||||
import * as htmlService from 'vscode-html-languageservice';
|
||||
import type { Options } from './monaco.contribution';
|
||||
import { IHTMLDataProvider } from 'vscode-html-languageservice';
|
||||
|
||||
export class HTMLWorker {
|
||||
private _ctx: worker.IWorkerContext;
|
||||
private _languageService: htmlService.LanguageService;
|
||||
private _languageSettings: Options;
|
||||
private _languageId: string;
|
||||
|
||||
constructor(ctx: worker.IWorkerContext, createData: ICreateData) {
|
||||
this._ctx = ctx;
|
||||
this._languageSettings = createData.languageSettings;
|
||||
this._languageId = createData.languageId;
|
||||
|
||||
const data = this._languageSettings.data;
|
||||
|
||||
const useDefaultDataProvider = data?.useDefaultDataProvider;
|
||||
const customDataProviders: IHTMLDataProvider[] = [];
|
||||
if (data?.dataProviders) {
|
||||
for (const id in data.dataProviders) {
|
||||
customDataProviders.push(htmlService.newHTMLDataProvider(id, data.dataProviders[id]));
|
||||
}
|
||||
}
|
||||
this._languageService = htmlService.getLanguageService({ useDefaultDataProvider, customDataProviders });
|
||||
}
|
||||
|
||||
async doComplete(
|
||||
uri: string,
|
||||
position: htmlService.Position
|
||||
): Promise<htmlService.CompletionList> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let htmlDocument = this._languageService.parseHTMLDocument(document);
|
||||
return Promise.resolve(
|
||||
this._languageService.doComplete(
|
||||
document,
|
||||
position,
|
||||
htmlDocument,
|
||||
this._languageSettings && this._languageSettings.suggest
|
||||
)
|
||||
);
|
||||
}
|
||||
async format(
|
||||
uri: string,
|
||||
range: htmlService.Range,
|
||||
options: htmlService.FormattingOptions
|
||||
): Promise<htmlService.TextEdit[]> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let formattingOptions = { ...this._languageSettings.format, ...options };
|
||||
let textEdits = this._languageService.format(document, range, formattingOptions);
|
||||
return Promise.resolve(textEdits);
|
||||
}
|
||||
async doHover(uri: string, position: htmlService.Position): Promise<htmlService.Hover> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let htmlDocument = this._languageService.parseHTMLDocument(document);
|
||||
let hover = this._languageService.doHover(document, position, htmlDocument);
|
||||
return Promise.resolve(hover);
|
||||
}
|
||||
async findDocumentHighlights(
|
||||
uri: string,
|
||||
position: htmlService.Position
|
||||
): Promise<htmlService.DocumentHighlight[]> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let htmlDocument = this._languageService.parseHTMLDocument(document);
|
||||
let highlights = this._languageService.findDocumentHighlights(document, position, htmlDocument);
|
||||
return Promise.resolve(highlights);
|
||||
}
|
||||
async findDocumentLinks(uri: string): Promise<htmlService.DocumentLink[]> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let links = this._languageService.findDocumentLinks(document, null);
|
||||
return Promise.resolve(links);
|
||||
}
|
||||
async findDocumentSymbols(uri: string): Promise<htmlService.SymbolInformation[]> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let htmlDocument = this._languageService.parseHTMLDocument(document);
|
||||
let symbols = this._languageService.findDocumentSymbols(document, htmlDocument);
|
||||
return Promise.resolve(symbols);
|
||||
}
|
||||
async getFoldingRanges(
|
||||
uri: string,
|
||||
context?: { rangeLimit?: number }
|
||||
): Promise<htmlService.FoldingRange[]> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let ranges = this._languageService.getFoldingRanges(document, context);
|
||||
return Promise.resolve(ranges);
|
||||
}
|
||||
async getSelectionRanges(
|
||||
uri: string,
|
||||
positions: htmlService.Position[]
|
||||
): Promise<htmlService.SelectionRange[]> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let ranges = this._languageService.getSelectionRanges(document, positions);
|
||||
return Promise.resolve(ranges);
|
||||
}
|
||||
async doRename(
|
||||
uri: string,
|
||||
position: htmlService.Position,
|
||||
newName: string
|
||||
): Promise<htmlService.WorkspaceEdit> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let htmlDocument = this._languageService.parseHTMLDocument(document);
|
||||
let renames = this._languageService.doRename(document, position, newName, htmlDocument);
|
||||
return Promise.resolve(renames);
|
||||
}
|
||||
private _getTextDocument(uri: string): htmlService.TextDocument {
|
||||
let models = this._ctx.getMirrorModels();
|
||||
for (let model of models) {
|
||||
if (model.uri.toString() === uri) {
|
||||
return htmlService.TextDocument.create(
|
||||
uri,
|
||||
this._languageId,
|
||||
model.version,
|
||||
model.getValue()
|
||||
);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export interface ICreateData {
|
||||
languageId: string;
|
||||
languageSettings: Options;
|
||||
}
|
||||
|
||||
export function create(ctx: worker.IWorkerContext, createData: ICreateData): HTMLWorker {
|
||||
return new HTMLWorker(ctx, createData);
|
||||
}
|
@ -0,0 +1,611 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import type { HTMLWorker } from './htmlWorker';
|
||||
import * as htmlService from 'vscode-html-languageservice';
|
||||
import {
|
||||
languages,
|
||||
editor,
|
||||
Uri,
|
||||
Position,
|
||||
Range,
|
||||
CancellationToken,
|
||||
IMarkdownString
|
||||
} from './fillers/monaco-editor-core';
|
||||
|
||||
export interface WorkerAccessor {
|
||||
(...more: Uri[]): Promise<HTMLWorker>;
|
||||
}
|
||||
|
||||
// --- completion ------
|
||||
|
||||
function fromPosition(position: Position): htmlService.Position {
|
||||
if (!position) {
|
||||
return void 0;
|
||||
}
|
||||
return { character: position.column - 1, line: position.lineNumber - 1 };
|
||||
}
|
||||
|
||||
function fromRange(range: Range): htmlService.Range {
|
||||
if (!range) {
|
||||
return void 0;
|
||||
}
|
||||
return {
|
||||
start: fromPosition(range.getStartPosition()),
|
||||
end: fromPosition(range.getEndPosition())
|
||||
};
|
||||
}
|
||||
|
||||
function toRange(range: htmlService.Range): Range {
|
||||
if (!range) {
|
||||
return void 0;
|
||||
}
|
||||
return new Range(
|
||||
range.start.line + 1,
|
||||
range.start.character + 1,
|
||||
range.end.line + 1,
|
||||
range.end.character + 1
|
||||
);
|
||||
}
|
||||
|
||||
function isInsertReplaceEdit(edit: htmlService.TextEdit | htmlService.InsertReplaceEdit): edit is htmlService.InsertReplaceEdit {
|
||||
return (
|
||||
typeof (<htmlService.InsertReplaceEdit>edit).insert !== 'undefined' &&
|
||||
typeof (<htmlService.InsertReplaceEdit>edit).replace !== 'undefined'
|
||||
);
|
||||
}
|
||||
|
||||
function toCompletionItemKind(kind: number): languages.CompletionItemKind {
|
||||
const mItemKind = languages.CompletionItemKind;
|
||||
|
||||
switch (kind) {
|
||||
case htmlService.CompletionItemKind.Text:
|
||||
return mItemKind.Text;
|
||||
case htmlService.CompletionItemKind.Method:
|
||||
return mItemKind.Method;
|
||||
case htmlService.CompletionItemKind.Function:
|
||||
return mItemKind.Function;
|
||||
case htmlService.CompletionItemKind.Constructor:
|
||||
return mItemKind.Constructor;
|
||||
case htmlService.CompletionItemKind.Field:
|
||||
return mItemKind.Field;
|
||||
case htmlService.CompletionItemKind.Variable:
|
||||
return mItemKind.Variable;
|
||||
case htmlService.CompletionItemKind.Class:
|
||||
return mItemKind.Class;
|
||||
case htmlService.CompletionItemKind.Interface:
|
||||
return mItemKind.Interface;
|
||||
case htmlService.CompletionItemKind.Module:
|
||||
return mItemKind.Module;
|
||||
case htmlService.CompletionItemKind.Property:
|
||||
return mItemKind.Property;
|
||||
case htmlService.CompletionItemKind.Unit:
|
||||
return mItemKind.Unit;
|
||||
case htmlService.CompletionItemKind.Value:
|
||||
return mItemKind.Value;
|
||||
case htmlService.CompletionItemKind.Enum:
|
||||
return mItemKind.Enum;
|
||||
case htmlService.CompletionItemKind.Keyword:
|
||||
return mItemKind.Keyword;
|
||||
case htmlService.CompletionItemKind.Snippet:
|
||||
return mItemKind.Snippet;
|
||||
case htmlService.CompletionItemKind.Color:
|
||||
return mItemKind.Color;
|
||||
case htmlService.CompletionItemKind.File:
|
||||
return mItemKind.File;
|
||||
case htmlService.CompletionItemKind.Reference:
|
||||
return mItemKind.Reference;
|
||||
}
|
||||
return mItemKind.Property;
|
||||
}
|
||||
|
||||
function fromCompletionItemKind(
|
||||
kind: languages.CompletionItemKind
|
||||
): htmlService.CompletionItemKind {
|
||||
const mItemKind = languages.CompletionItemKind;
|
||||
|
||||
switch (kind) {
|
||||
case mItemKind.Text:
|
||||
return htmlService.CompletionItemKind.Text;
|
||||
case mItemKind.Method:
|
||||
return htmlService.CompletionItemKind.Method;
|
||||
case mItemKind.Function:
|
||||
return htmlService.CompletionItemKind.Function;
|
||||
case mItemKind.Constructor:
|
||||
return htmlService.CompletionItemKind.Constructor;
|
||||
case mItemKind.Field:
|
||||
return htmlService.CompletionItemKind.Field;
|
||||
case mItemKind.Variable:
|
||||
return htmlService.CompletionItemKind.Variable;
|
||||
case mItemKind.Class:
|
||||
return htmlService.CompletionItemKind.Class;
|
||||
case mItemKind.Interface:
|
||||
return htmlService.CompletionItemKind.Interface;
|
||||
case mItemKind.Module:
|
||||
return htmlService.CompletionItemKind.Module;
|
||||
case mItemKind.Property:
|
||||
return htmlService.CompletionItemKind.Property;
|
||||
case mItemKind.Unit:
|
||||
return htmlService.CompletionItemKind.Unit;
|
||||
case mItemKind.Value:
|
||||
return htmlService.CompletionItemKind.Value;
|
||||
case mItemKind.Enum:
|
||||
return htmlService.CompletionItemKind.Enum;
|
||||
case mItemKind.Keyword:
|
||||
return htmlService.CompletionItemKind.Keyword;
|
||||
case mItemKind.Snippet:
|
||||
return htmlService.CompletionItemKind.Snippet;
|
||||
case mItemKind.Color:
|
||||
return htmlService.CompletionItemKind.Color;
|
||||
case mItemKind.File:
|
||||
return htmlService.CompletionItemKind.File;
|
||||
case mItemKind.Reference:
|
||||
return htmlService.CompletionItemKind.Reference;
|
||||
}
|
||||
return htmlService.CompletionItemKind.Property;
|
||||
}
|
||||
|
||||
function toTextEdit(textEdit: htmlService.TextEdit): editor.ISingleEditOperation {
|
||||
if (!textEdit) {
|
||||
return void 0;
|
||||
}
|
||||
return {
|
||||
range: toRange(textEdit.range),
|
||||
text: textEdit.newText
|
||||
};
|
||||
}
|
||||
|
||||
function toCommand(c: htmlService.Command | undefined): languages.Command {
|
||||
return c && c.command === 'editor.action.triggerSuggest' ? { id: c.command, title: c.title, arguments: c.arguments } : undefined
|
||||
}
|
||||
|
||||
export class CompletionAdapter implements languages.CompletionItemProvider {
|
||||
constructor(private _worker: WorkerAccessor) { }
|
||||
|
||||
public get triggerCharacters(): string[] {
|
||||
return ['.', ':', '<', '"', '=', '/'];
|
||||
}
|
||||
|
||||
provideCompletionItems(
|
||||
model: editor.IReadOnlyModel,
|
||||
position: Position,
|
||||
context: languages.CompletionContext,
|
||||
token: CancellationToken
|
||||
): Promise<languages.CompletionList> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) => {
|
||||
return worker.doComplete(resource.toString(), fromPosition(position));
|
||||
})
|
||||
.then((info) => {
|
||||
if (!info) {
|
||||
return;
|
||||
}
|
||||
const wordInfo = model.getWordUntilPosition(position);
|
||||
const wordRange = new Range(
|
||||
position.lineNumber,
|
||||
wordInfo.startColumn,
|
||||
position.lineNumber,
|
||||
wordInfo.endColumn
|
||||
);
|
||||
|
||||
const items: languages.CompletionItem[] = info.items.map((entry) => {
|
||||
const item: languages.CompletionItem = {
|
||||
label: entry.label,
|
||||
insertText: entry.insertText || entry.label,
|
||||
sortText: entry.sortText,
|
||||
filterText: entry.filterText,
|
||||
documentation: entry.documentation,
|
||||
command: toCommand(entry.command),
|
||||
detail: entry.detail,
|
||||
range: wordRange,
|
||||
kind: toCompletionItemKind(entry.kind)
|
||||
};
|
||||
if (entry.textEdit) {
|
||||
if (isInsertReplaceEdit(entry.textEdit)) {
|
||||
item.range = {
|
||||
insert: toRange(entry.textEdit.insert),
|
||||
replace: toRange(entry.textEdit.replace)
|
||||
};
|
||||
} else {
|
||||
item.range = toRange(entry.textEdit.range);
|
||||
}
|
||||
item.insertText = entry.textEdit.newText;
|
||||
}
|
||||
if (entry.additionalTextEdits) {
|
||||
item.additionalTextEdits = entry.additionalTextEdits.map(toTextEdit);
|
||||
}
|
||||
if (entry.insertTextFormat === htmlService.InsertTextFormat.Snippet) {
|
||||
item.insertTextRules = languages.CompletionItemInsertTextRule.InsertAsSnippet;
|
||||
}
|
||||
return item;
|
||||
});
|
||||
|
||||
return {
|
||||
isIncomplete: info.isIncomplete,
|
||||
suggestions: items
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// --- hover ------
|
||||
|
||||
function isMarkupContent(thing: any): thing is htmlService.MarkupContent {
|
||||
return (
|
||||
thing &&
|
||||
typeof thing === 'object' &&
|
||||
typeof (<htmlService.MarkupContent>thing).kind === 'string'
|
||||
);
|
||||
}
|
||||
|
||||
function toMarkdownString(
|
||||
entry: htmlService.MarkupContent | htmlService.MarkedString
|
||||
): IMarkdownString {
|
||||
if (typeof entry === 'string') {
|
||||
return {
|
||||
value: entry
|
||||
};
|
||||
}
|
||||
if (isMarkupContent(entry)) {
|
||||
if (entry.kind === 'plaintext') {
|
||||
return {
|
||||
value: entry.value.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&')
|
||||
};
|
||||
}
|
||||
return {
|
||||
value: entry.value
|
||||
};
|
||||
}
|
||||
|
||||
return { value: '```' + entry.language + '\n' + entry.value + '\n```\n' };
|
||||
}
|
||||
|
||||
function toMarkedStringArray(
|
||||
contents: htmlService.MarkupContent | htmlService.MarkedString | htmlService.MarkedString[]
|
||||
): IMarkdownString[] {
|
||||
if (!contents) {
|
||||
return void 0;
|
||||
}
|
||||
if (Array.isArray(contents)) {
|
||||
return contents.map(toMarkdownString);
|
||||
}
|
||||
return [toMarkdownString(contents)];
|
||||
}
|
||||
|
||||
export class HoverAdapter implements languages.HoverProvider {
|
||||
constructor(private _worker: WorkerAccessor) { }
|
||||
|
||||
provideHover(
|
||||
model: editor.IReadOnlyModel,
|
||||
position: Position,
|
||||
token: CancellationToken
|
||||
): Promise<languages.Hover> {
|
||||
let resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) => {
|
||||
return worker.doHover(resource.toString(), fromPosition(position));
|
||||
})
|
||||
.then((info) => {
|
||||
if (!info) {
|
||||
return;
|
||||
}
|
||||
return <languages.Hover>{
|
||||
range: toRange(info.range),
|
||||
contents: toMarkedStringArray(info.contents)
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// --- document highlights ------
|
||||
|
||||
function toHighlighKind(kind: htmlService.DocumentHighlightKind): languages.DocumentHighlightKind {
|
||||
const mKind = languages.DocumentHighlightKind;
|
||||
|
||||
switch (kind) {
|
||||
case htmlService.DocumentHighlightKind.Read:
|
||||
return mKind.Read;
|
||||
case htmlService.DocumentHighlightKind.Write:
|
||||
return mKind.Write;
|
||||
case htmlService.DocumentHighlightKind.Text:
|
||||
return mKind.Text;
|
||||
}
|
||||
return mKind.Text;
|
||||
}
|
||||
|
||||
export class DocumentHighlightAdapter implements languages.DocumentHighlightProvider {
|
||||
constructor(private _worker: WorkerAccessor) { }
|
||||
|
||||
public provideDocumentHighlights(
|
||||
model: editor.IReadOnlyModel,
|
||||
position: Position,
|
||||
token: CancellationToken
|
||||
): Promise<languages.DocumentHighlight[]> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) => worker.findDocumentHighlights(resource.toString(), fromPosition(position)))
|
||||
.then((items) => {
|
||||
if (!items) {
|
||||
return;
|
||||
}
|
||||
return items.map((item) => ({
|
||||
range: toRange(item.range),
|
||||
kind: toHighlighKind(item.kind)
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// --- document symbols ------
|
||||
|
||||
function toSymbolKind(kind: htmlService.SymbolKind): languages.SymbolKind {
|
||||
let mKind = languages.SymbolKind;
|
||||
|
||||
switch (kind) {
|
||||
case htmlService.SymbolKind.File:
|
||||
return mKind.Array;
|
||||
case htmlService.SymbolKind.Module:
|
||||
return mKind.Module;
|
||||
case htmlService.SymbolKind.Namespace:
|
||||
return mKind.Namespace;
|
||||
case htmlService.SymbolKind.Package:
|
||||
return mKind.Package;
|
||||
case htmlService.SymbolKind.Class:
|
||||
return mKind.Class;
|
||||
case htmlService.SymbolKind.Method:
|
||||
return mKind.Method;
|
||||
case htmlService.SymbolKind.Property:
|
||||
return mKind.Property;
|
||||
case htmlService.SymbolKind.Field:
|
||||
return mKind.Field;
|
||||
case htmlService.SymbolKind.Constructor:
|
||||
return mKind.Constructor;
|
||||
case htmlService.SymbolKind.Enum:
|
||||
return mKind.Enum;
|
||||
case htmlService.SymbolKind.Interface:
|
||||
return mKind.Interface;
|
||||
case htmlService.SymbolKind.Function:
|
||||
return mKind.Function;
|
||||
case htmlService.SymbolKind.Variable:
|
||||
return mKind.Variable;
|
||||
case htmlService.SymbolKind.Constant:
|
||||
return mKind.Constant;
|
||||
case htmlService.SymbolKind.String:
|
||||
return mKind.String;
|
||||
case htmlService.SymbolKind.Number:
|
||||
return mKind.Number;
|
||||
case htmlService.SymbolKind.Boolean:
|
||||
return mKind.Boolean;
|
||||
case htmlService.SymbolKind.Array:
|
||||
return mKind.Array;
|
||||
}
|
||||
return mKind.Function;
|
||||
}
|
||||
|
||||
export class DocumentSymbolAdapter implements languages.DocumentSymbolProvider {
|
||||
constructor(private _worker: WorkerAccessor) { }
|
||||
|
||||
public provideDocumentSymbols(
|
||||
model: editor.IReadOnlyModel,
|
||||
token: CancellationToken
|
||||
): Promise<languages.DocumentSymbol[]> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) => worker.findDocumentSymbols(resource.toString()))
|
||||
.then((items) => {
|
||||
if (!items) {
|
||||
return;
|
||||
}
|
||||
return items.map((item) => ({
|
||||
name: item.name,
|
||||
detail: '',
|
||||
containerName: item.containerName,
|
||||
kind: toSymbolKind(item.kind),
|
||||
tags: [],
|
||||
range: toRange(item.location.range),
|
||||
selectionRange: toRange(item.location.range)
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class DocumentLinkAdapter implements languages.LinkProvider {
|
||||
constructor(private _worker: WorkerAccessor) { }
|
||||
|
||||
public provideLinks(
|
||||
model: editor.IReadOnlyModel,
|
||||
token: CancellationToken
|
||||
): Promise<languages.ILinksList> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) => worker.findDocumentLinks(resource.toString()))
|
||||
.then((items) => {
|
||||
if (!items) {
|
||||
return;
|
||||
}
|
||||
return {
|
||||
links: items.map((item) => ({
|
||||
range: toRange(item.range),
|
||||
url: item.target
|
||||
}))
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function fromFormattingOptions(
|
||||
options: languages.FormattingOptions
|
||||
): htmlService.FormattingOptions {
|
||||
return {
|
||||
tabSize: options.tabSize,
|
||||
insertSpaces: options.insertSpaces
|
||||
};
|
||||
}
|
||||
|
||||
export class DocumentFormattingEditProvider implements languages.DocumentFormattingEditProvider {
|
||||
constructor(private _worker: WorkerAccessor) { }
|
||||
|
||||
public provideDocumentFormattingEdits(
|
||||
model: editor.IReadOnlyModel,
|
||||
options: languages.FormattingOptions,
|
||||
token: CancellationToken
|
||||
): Promise<editor.ISingleEditOperation[]> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource).then((worker) => {
|
||||
return worker
|
||||
.format(resource.toString(), null, fromFormattingOptions(options))
|
||||
.then((edits) => {
|
||||
if (!edits || edits.length === 0) {
|
||||
return;
|
||||
}
|
||||
return edits.map(toTextEdit);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class DocumentRangeFormattingEditProvider
|
||||
implements languages.DocumentRangeFormattingEditProvider {
|
||||
constructor(private _worker: WorkerAccessor) { }
|
||||
|
||||
public provideDocumentRangeFormattingEdits(
|
||||
model: editor.IReadOnlyModel,
|
||||
range: Range,
|
||||
options: languages.FormattingOptions,
|
||||
token: CancellationToken
|
||||
): Promise<editor.ISingleEditOperation[]> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource).then((worker) => {
|
||||
return worker
|
||||
.format(resource.toString(), fromRange(range), fromFormattingOptions(options))
|
||||
.then((edits) => {
|
||||
if (!edits || edits.length === 0) {
|
||||
return;
|
||||
}
|
||||
return edits.map(toTextEdit);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class RenameAdapter implements languages.RenameProvider {
|
||||
constructor(private _worker: WorkerAccessor) { }
|
||||
|
||||
provideRenameEdits(
|
||||
model: editor.IReadOnlyModel,
|
||||
position: Position,
|
||||
newName: string,
|
||||
token: CancellationToken
|
||||
): Promise<languages.WorkspaceEdit> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) => {
|
||||
return worker.doRename(resource.toString(), fromPosition(position), newName);
|
||||
})
|
||||
.then((edit) => {
|
||||
return toWorkspaceEdit(edit);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function toWorkspaceEdit(edit: htmlService.WorkspaceEdit): languages.WorkspaceEdit {
|
||||
if (!edit || !edit.changes) {
|
||||
return void 0;
|
||||
}
|
||||
let resourceEdits: languages.WorkspaceTextEdit[] = [];
|
||||
for (let uri in edit.changes) {
|
||||
const _uri = Uri.parse(uri);
|
||||
for (let e of edit.changes[uri]) {
|
||||
resourceEdits.push({
|
||||
resource: _uri,
|
||||
edit: {
|
||||
range: toRange(e.range),
|
||||
text: e.newText
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return {
|
||||
edits: resourceEdits
|
||||
};
|
||||
}
|
||||
|
||||
export class FoldingRangeAdapter implements languages.FoldingRangeProvider {
|
||||
constructor(private _worker: WorkerAccessor) { }
|
||||
|
||||
public provideFoldingRanges(
|
||||
model: editor.IReadOnlyModel,
|
||||
context: languages.FoldingContext,
|
||||
token: CancellationToken
|
||||
): Promise<languages.FoldingRange[]> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) => worker.getFoldingRanges(resource.toString(), context))
|
||||
.then((ranges) => {
|
||||
if (!ranges) {
|
||||
return;
|
||||
}
|
||||
return ranges.map((range) => {
|
||||
const result: languages.FoldingRange = {
|
||||
start: range.startLine + 1,
|
||||
end: range.endLine + 1
|
||||
};
|
||||
if (typeof range.kind !== 'undefined') {
|
||||
result.kind = toFoldingRangeKind(<htmlService.FoldingRangeKind>range.kind);
|
||||
}
|
||||
return result;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function toFoldingRangeKind(kind: htmlService.FoldingRangeKind): languages.FoldingRangeKind {
|
||||
switch (kind) {
|
||||
case htmlService.FoldingRangeKind.Comment:
|
||||
return languages.FoldingRangeKind.Comment;
|
||||
case htmlService.FoldingRangeKind.Imports:
|
||||
return languages.FoldingRangeKind.Imports;
|
||||
case htmlService.FoldingRangeKind.Region:
|
||||
return languages.FoldingRangeKind.Region;
|
||||
}
|
||||
}
|
||||
|
||||
export class SelectionRangeAdapter implements languages.SelectionRangeProvider {
|
||||
constructor(private _worker: WorkerAccessor) { }
|
||||
|
||||
public provideSelectionRanges(
|
||||
model: editor.IReadOnlyModel,
|
||||
positions: Position[],
|
||||
token: CancellationToken
|
||||
): Promise<languages.SelectionRange[][]> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) => worker.getSelectionRanges(resource.toString(), positions.map(fromPosition)))
|
||||
.then((selectionRanges) => {
|
||||
if (!selectionRanges) {
|
||||
return;
|
||||
}
|
||||
return selectionRanges.map((selectionRange) => {
|
||||
const result: languages.SelectionRange[] = [];
|
||||
while (selectionRange) {
|
||||
result.push({ range: toRange(selectionRange.range) });
|
||||
selectionRange = selectionRange.parent;
|
||||
}
|
||||
return result;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,316 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as mode from './htmlMode';
|
||||
import { languages, Emitter, IEvent, IDisposable } from './fillers/monaco-editor-core';
|
||||
|
||||
export interface HTMLFormatConfiguration {
|
||||
readonly tabSize: number;
|
||||
readonly insertSpaces: boolean;
|
||||
readonly wrapLineLength: number;
|
||||
readonly unformatted: string;
|
||||
readonly contentUnformatted: string;
|
||||
readonly indentInnerHtml: boolean;
|
||||
readonly preserveNewLines: boolean;
|
||||
readonly maxPreserveNewLines: number;
|
||||
readonly indentHandlebars: boolean;
|
||||
readonly endWithNewline: boolean;
|
||||
readonly extraLiners: string;
|
||||
readonly wrapAttributes: 'auto' | 'force' | 'force-aligned' | 'force-expand-multiline';
|
||||
}
|
||||
|
||||
export interface CompletionConfiguration {
|
||||
readonly [providerId: string]: boolean;
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
/**
|
||||
* If set, comments are tolerated. If set to false, syntax errors will be emitted for comments.
|
||||
*/
|
||||
readonly format?: HTMLFormatConfiguration;
|
||||
/**
|
||||
* A list of known schemas and/or associations of schemas to file names.
|
||||
*/
|
||||
readonly suggest?: CompletionConfiguration;
|
||||
/**
|
||||
* Configures the HTML data types known by the HTML langauge service.
|
||||
*/
|
||||
readonly data?: HTMLDataConfiguration;
|
||||
}
|
||||
|
||||
export interface ModeConfiguration {
|
||||
/**
|
||||
* Defines whether the built-in completionItemProvider is enabled.
|
||||
*/
|
||||
readonly completionItems?: boolean;
|
||||
|
||||
/**
|
||||
* Defines whether the built-in hoverProvider is enabled.
|
||||
*/
|
||||
readonly hovers?: boolean;
|
||||
|
||||
/**
|
||||
* Defines whether the built-in documentSymbolProvider is enabled.
|
||||
*/
|
||||
readonly documentSymbols?: boolean;
|
||||
|
||||
/**
|
||||
* Defines whether the built-in definitions provider is enabled.
|
||||
*/
|
||||
readonly links?: boolean;
|
||||
|
||||
/**
|
||||
* Defines whether the built-in references provider is enabled.
|
||||
*/
|
||||
readonly documentHighlights?: boolean;
|
||||
|
||||
/**
|
||||
* Defines whether the built-in rename provider is enabled.
|
||||
*/
|
||||
readonly rename?: boolean;
|
||||
|
||||
/**
|
||||
* Defines whether the built-in color provider is enabled.
|
||||
*/
|
||||
readonly colors?: boolean;
|
||||
|
||||
/**
|
||||
* Defines whether the built-in foldingRange provider is enabled.
|
||||
*/
|
||||
readonly foldingRanges?: boolean;
|
||||
|
||||
/**
|
||||
* Defines whether the built-in diagnostic provider is enabled.
|
||||
*/
|
||||
readonly diagnostics?: boolean;
|
||||
|
||||
/**
|
||||
* Defines whether the built-in selection range provider is enabled.
|
||||
*/
|
||||
readonly selectionRanges?: boolean;
|
||||
|
||||
/**
|
||||
* Defines whether the built-in documentFormattingEdit provider is enabled.
|
||||
*/
|
||||
readonly documentFormattingEdits?: boolean;
|
||||
|
||||
/**
|
||||
* Defines whether the built-in documentRangeFormattingEdit provider is enabled.
|
||||
*/
|
||||
readonly documentRangeFormattingEdits?: boolean;
|
||||
}
|
||||
|
||||
export interface LanguageServiceDefaults {
|
||||
readonly languageId: string;
|
||||
readonly modeConfiguration: ModeConfiguration;
|
||||
readonly onDidChange: IEvent<LanguageServiceDefaults>;
|
||||
readonly options: Options;
|
||||
setOptions(options: Options): void;
|
||||
setModeConfiguration(modeConfiguration: ModeConfiguration): void;
|
||||
}
|
||||
// --- HTML configuration and defaults ---------
|
||||
|
||||
class LanguageServiceDefaultsImpl implements LanguageServiceDefaults {
|
||||
private _onDidChange = new Emitter<LanguageServiceDefaults>();
|
||||
private _options: Options;
|
||||
private _modeConfiguration: ModeConfiguration;
|
||||
private _languageId: string;
|
||||
|
||||
constructor(languageId: string, options: Options, modeConfiguration: ModeConfiguration) {
|
||||
this._languageId = languageId;
|
||||
this.setOptions(options);
|
||||
this.setModeConfiguration(modeConfiguration);
|
||||
}
|
||||
|
||||
get onDidChange(): IEvent<LanguageServiceDefaults> {
|
||||
return this._onDidChange.event;
|
||||
}
|
||||
|
||||
get languageId(): string {
|
||||
return this._languageId;
|
||||
}
|
||||
|
||||
get options(): Options {
|
||||
return this._options;
|
||||
}
|
||||
|
||||
get modeConfiguration(): ModeConfiguration {
|
||||
return this._modeConfiguration;
|
||||
}
|
||||
|
||||
setOptions(options: Options): void {
|
||||
this._options = options || Object.create(null);
|
||||
this._onDidChange.fire(this);
|
||||
}
|
||||
|
||||
setModeConfiguration(modeConfiguration: ModeConfiguration): void {
|
||||
this._modeConfiguration = modeConfiguration || Object.create(null);
|
||||
this._onDidChange.fire(this);
|
||||
}
|
||||
}
|
||||
|
||||
const formatDefaults: Required<HTMLFormatConfiguration> = {
|
||||
tabSize: 4,
|
||||
insertSpaces: false,
|
||||
wrapLineLength: 120,
|
||||
unformatted:
|
||||
'default": "a, abbr, acronym, b, bdo, big, br, button, cite, code, dfn, em, i, img, input, kbd, label, map, object, q, samp, select, small, span, strong, sub, sup, textarea, tt, var',
|
||||
contentUnformatted: 'pre',
|
||||
indentInnerHtml: false,
|
||||
preserveNewLines: true,
|
||||
maxPreserveNewLines: null,
|
||||
indentHandlebars: false,
|
||||
endWithNewline: false,
|
||||
extraLiners: 'head, body, /html',
|
||||
wrapAttributes: 'auto'
|
||||
};
|
||||
|
||||
const optionsDefault: Required<Options> = {
|
||||
format: formatDefaults,
|
||||
suggest: {},
|
||||
data: { useDefaultDataProvider: true }
|
||||
};
|
||||
|
||||
|
||||
function getConfigurationDefault(languageId: string): Required<ModeConfiguration> {
|
||||
return {
|
||||
completionItems: true,
|
||||
hovers: true,
|
||||
documentSymbols: true,
|
||||
links: true,
|
||||
documentHighlights: true,
|
||||
rename: true,
|
||||
colors: true,
|
||||
foldingRanges: true,
|
||||
selectionRanges: true,
|
||||
diagnostics: languageId === htmlLanguageId, // turned off for Razor and Handlebar
|
||||
documentFormattingEdits: languageId === htmlLanguageId, // turned off for Razor and Handlebar
|
||||
documentRangeFormattingEdits: languageId === htmlLanguageId // turned off for Razor and Handlebar
|
||||
};
|
||||
}
|
||||
|
||||
const htmlLanguageId = 'html';
|
||||
const handlebarsLanguageId = 'handlebars';
|
||||
const razorLanguageId = 'razor';
|
||||
|
||||
export const htmlLanguageService = registerHTMLLanguageService(
|
||||
htmlLanguageId,
|
||||
optionsDefault,
|
||||
getConfigurationDefault(htmlLanguageId)
|
||||
);
|
||||
export const htmlDefaults = htmlLanguageService.defaults;
|
||||
|
||||
export const handlebarLanguageService = registerHTMLLanguageService(
|
||||
handlebarsLanguageId,
|
||||
optionsDefault,
|
||||
getConfigurationDefault(handlebarsLanguageId)
|
||||
);
|
||||
export const handlebarDefaults = handlebarLanguageService.defaults;
|
||||
|
||||
export const razorLanguageService = registerHTMLLanguageService(
|
||||
razorLanguageId,
|
||||
optionsDefault,
|
||||
getConfigurationDefault(razorLanguageId)
|
||||
);
|
||||
export const razorDefaults = razorLanguageService.defaults;
|
||||
|
||||
// export to the global based API
|
||||
(<any>languages).html = { htmlDefaults, razorDefaults, handlebarDefaults, htmlLanguageService, handlebarLanguageService, razorLanguageService, registerHTMLLanguageService };
|
||||
|
||||
|
||||
// --- Registration to monaco editor ---
|
||||
|
||||
function getMode(): Promise<typeof mode> {
|
||||
return import('./htmlMode');
|
||||
}
|
||||
|
||||
export interface LanguageServiceRegistration extends IDisposable {
|
||||
readonly defaults: LanguageServiceDefaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a new HTML language service for the languageId.
|
||||
* Note: 'html', 'handlebar' and 'razor' are registered by default.
|
||||
*
|
||||
* Use this method to register additional language ids with a HTML service.
|
||||
* The language server has to be registered before an editor model is opened.
|
||||
*/
|
||||
export function registerHTMLLanguageService(
|
||||
languageId: string,
|
||||
options: Options = optionsDefault,
|
||||
modeConfiguration: ModeConfiguration = getConfigurationDefault(languageId)
|
||||
): LanguageServiceRegistration {
|
||||
const defaults = new LanguageServiceDefaultsImpl(languageId, options, modeConfiguration);
|
||||
let mode: IDisposable | undefined;
|
||||
|
||||
// delay the initalization of the mode until the language is accessed the first time
|
||||
const onLanguageListener = languages.onLanguage(languageId, async () => {
|
||||
mode = (await getMode()).setupMode(defaults);
|
||||
});
|
||||
return {
|
||||
defaults,
|
||||
dispose() {
|
||||
onLanguageListener.dispose();
|
||||
mode?.dispose();
|
||||
mode = undefined;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
export interface HTMLDataConfiguration {
|
||||
/**
|
||||
* Defines whether the standard HTML tags and attributes are shown
|
||||
*/
|
||||
readonly useDefaultDataProvider?: boolean;
|
||||
/**
|
||||
* Provides a set of custom data providers.
|
||||
*/
|
||||
readonly dataProviders?: { [providerId: string]: HTMLDataV1 };
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom HTML tags attributes and attribute values
|
||||
* https://github.com/microsoft/vscode-html-languageservice/blob/main/docs/customData.md
|
||||
*/
|
||||
export interface HTMLDataV1 {
|
||||
readonly version: 1 | 1.1;
|
||||
readonly tags?: ITagData[];
|
||||
readonly globalAttributes?: IAttributeData[];
|
||||
readonly valueSets?: IValueSet[];
|
||||
}
|
||||
|
||||
export interface IReference {
|
||||
readonly name: string;
|
||||
readonly url: string;
|
||||
}
|
||||
export interface ITagData {
|
||||
readonly name: string;
|
||||
readonly description?: string | MarkupContent;
|
||||
readonly attributes: IAttributeData[];
|
||||
readonly references?: IReference[];
|
||||
}
|
||||
export interface IAttributeData {
|
||||
readonly name: string;
|
||||
readonly description?: string | MarkupContent;
|
||||
readonly valueSet?: string;
|
||||
readonly values?: IValueData[];
|
||||
readonly references?: IReference[];
|
||||
}
|
||||
export interface IValueData {
|
||||
readonly name: string;
|
||||
readonly description?: string | MarkupContent;
|
||||
readonly references?: IReference[];
|
||||
}
|
||||
export interface IValueSet {
|
||||
readonly name: string;
|
||||
readonly values: IValueData[];
|
||||
}
|
||||
export interface MarkupContent {
|
||||
readonly kind: MarkupKind;
|
||||
readonly value: string;
|
||||
}
|
||||
export declare type MarkupKind = 'plaintext' | 'markdown';
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "../out/esm",
|
||||
"declaration": true,
|
||||
"target": "es5",
|
||||
"lib": ["dom", "es5", "es2015.collection", "es2015.promise", "es2015.iterable"]
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "amd",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "../out/amd",
|
||||
"declaration": true,
|
||||
"target": "es5",
|
||||
"lib": ["dom", "es5", "es2015.collection", "es2015.promise", "es2015.iterable"]
|
||||
}
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { LanguageServiceDefaults } from './monaco.contribution';
|
||||
import type { HTMLWorker } from './htmlWorker';
|
||||
import { Uri, IDisposable, editor } from './fillers/monaco-editor-core';
|
||||
|
||||
const STOP_WHEN_IDLE_FOR = 2 * 60 * 1000; // 2min
|
||||
|
||||
export class WorkerManager {
|
||||
private _defaults: LanguageServiceDefaults;
|
||||
private _idleCheckInterval: number;
|
||||
private _lastUsedTime: number;
|
||||
private _configChangeListener: IDisposable;
|
||||
|
||||
private _worker: editor.MonacoWebWorker<HTMLWorker>;
|
||||
private _client: Promise<HTMLWorker>;
|
||||
|
||||
constructor(defaults: LanguageServiceDefaults) {
|
||||
this._defaults = defaults;
|
||||
this._worker = null;
|
||||
this._idleCheckInterval = setInterval(() => this._checkIfIdle(), 30 * 1000);
|
||||
this._lastUsedTime = 0;
|
||||
this._configChangeListener = this._defaults.onDidChange(() => this._stopWorker());
|
||||
}
|
||||
|
||||
private _stopWorker(): void {
|
||||
if (this._worker) {
|
||||
this._worker.dispose();
|
||||
this._worker = null;
|
||||
}
|
||||
this._client = null;
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
clearInterval(this._idleCheckInterval);
|
||||
this._configChangeListener.dispose();
|
||||
this._stopWorker();
|
||||
}
|
||||
|
||||
private _checkIfIdle(): void {
|
||||
if (!this._worker) {
|
||||
return;
|
||||
}
|
||||
let timePassedSinceLastUsed = Date.now() - this._lastUsedTime;
|
||||
if (timePassedSinceLastUsed > STOP_WHEN_IDLE_FOR) {
|
||||
this._stopWorker();
|
||||
}
|
||||
}
|
||||
|
||||
private _getClient(): Promise<HTMLWorker> {
|
||||
this._lastUsedTime = Date.now();
|
||||
|
||||
if (!this._client) {
|
||||
this._worker = editor.createWebWorker<HTMLWorker>({
|
||||
// module that exports the create() method and returns a `HTMLWorker` instance
|
||||
moduleId: 'vs/language/html/htmlWorker',
|
||||
|
||||
// passed in to the create() method
|
||||
createData: {
|
||||
languageSettings: this._defaults.options,
|
||||
languageId: this._defaults.languageId
|
||||
},
|
||||
|
||||
label: this._defaults.languageId
|
||||
});
|
||||
|
||||
this._client = <Promise<HTMLWorker>>this._worker.getProxy();
|
||||
}
|
||||
|
||||
return this._client;
|
||||
}
|
||||
|
||||
getLanguageServiceWorker(...resources: Uri[]): Promise<HTMLWorker> {
|
||||
let _client: HTMLWorker;
|
||||
return this._getClient()
|
||||
.then((client) => {
|
||||
_client = client;
|
||||
})
|
||||
.then((_) => {
|
||||
if (this._worker) {
|
||||
return this._worker.withSyncedResources(resources);
|
||||
}
|
||||
})
|
||||
.then((_) => _client);
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<link
|
||||
rel="stylesheet"
|
||||
data-name="vs/editor/editor.main"
|
||||
href="../node_modules/monaco-editor-core/dev/vs/editor/editor.main.css"
|
||||
/>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Monaco Editor HTML test page</h2>
|
||||
<div id="container" style="width: 800px; height: 600px; border: 1px solid grey"></div>
|
||||
|
||||
<script>
|
||||
// Loading basic-languages to get the html language definition
|
||||
var paths = {
|
||||
'vs/basic-languages': '../node_modules/monaco-languages/release/dev',
|
||||
'vs/language/html': '../release/dev',
|
||||
vs: '../node_modules/monaco-editor-core/dev/vs'
|
||||
};
|
||||
if (document.location.protocol === 'http:') {
|
||||
// Add support for running local http server
|
||||
let testIndex = document.location.pathname.indexOf('/test/');
|
||||
if (testIndex !== -1) {
|
||||
let prefix = document.location.pathname.substr(0, testIndex);
|
||||
paths['vs/language/html'] = prefix + '/release/dev';
|
||||
}
|
||||
}
|
||||
var require = {
|
||||
paths: paths
|
||||
};
|
||||
</script>
|
||||
<script src="../node_modules/monaco-editor-core/dev/vs/loader.js"></script>
|
||||
<script src="../node_modules/monaco-editor-core/dev/vs/editor/editor.main.nls.js"></script>
|
||||
<script src="../node_modules/monaco-editor-core/dev/vs/editor/editor.main.js"></script>
|
||||
|
||||
<script>
|
||||
require([
|
||||
'vs/basic-languages/monaco.contribution',
|
||||
'vs/language/html/monaco.contribution'
|
||||
], function () {
|
||||
var editor = monaco.editor.create(document.getElementById('container'), {
|
||||
value: [
|
||||
'<!DOCTYPE HTML>',
|
||||
'<!--',
|
||||
' Comments are overrated',
|
||||
'-->',
|
||||
'<html>',
|
||||
'<head>',
|
||||
' <title>HTML Sample</title>',
|
||||
' <meta http-equiv="X-UA-Compatible" content="IE=edge">',
|
||||
' <style type="text/css">',
|
||||
' h1 {',
|
||||
' color: #CCA3A3;',
|
||||
' }',
|
||||
' </style>',
|
||||
' <script type="text/javascript">',
|
||||
' window.alert("I am a sample...");',
|
||||
' var x = 3;',
|
||||
' </' + 'script>',
|
||||
'</head>',
|
||||
'<body>',
|
||||
' <h1>Heading No.1</h1>',
|
||||
' <input disabled type="button" value="Click me" />',
|
||||
'</body>',
|
||||
'</html>'
|
||||
].join('\n'),
|
||||
language: 'html'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,399 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@types/minimatch@^3.0.3":
|
||||
version "3.0.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.4.tgz#f0ec25dbf2f0e4b18647313ac031134ca5b24b21"
|
||||
integrity sha512-1z8k4wzFnNjVK/tlxvrWuK5WMt6mydWWP7+zvH5eFep4oj+UkrfiJTRtjCeBXNpwaA/FYqqtb4/QS4ianFpIRA==
|
||||
|
||||
ansi-styles@^4.1.0:
|
||||
version "4.3.0"
|
||||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937"
|
||||
integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==
|
||||
dependencies:
|
||||
color-convert "^2.0.1"
|
||||
|
||||
array-differ@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-3.0.0.tgz#3cbb3d0f316810eafcc47624734237d6aee4ae6b"
|
||||
integrity sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==
|
||||
|
||||
array-union@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d"
|
||||
integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==
|
||||
|
||||
arrify@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa"
|
||||
integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==
|
||||
|
||||
balanced-match@^1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
|
||||
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
|
||||
|
||||
brace-expansion@^1.1.7:
|
||||
version "1.1.11"
|
||||
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
|
||||
integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==
|
||||
dependencies:
|
||||
balanced-match "^1.0.0"
|
||||
concat-map "0.0.1"
|
||||
|
||||
buffer-from@^1.0.0:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
|
||||
integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==
|
||||
|
||||
chalk@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4"
|
||||
integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==
|
||||
dependencies:
|
||||
ansi-styles "^4.1.0"
|
||||
supports-color "^7.1.0"
|
||||
|
||||
color-convert@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"
|
||||
integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==
|
||||
dependencies:
|
||||
color-name "~1.1.4"
|
||||
|
||||
color-name@~1.1.4:
|
||||
version "1.1.4"
|
||||
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
|
||||
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
||||
|
||||
commander@^2.20.0:
|
||||
version "2.20.3"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
|
||||
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==
|
||||
|
||||
concat-map@0.0.1:
|
||||
version "0.0.1"
|
||||
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
||||
integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
|
||||
|
||||
cross-spawn@^7.0.0:
|
||||
version "7.0.3"
|
||||
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
|
||||
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
|
||||
dependencies:
|
||||
path-key "^3.1.0"
|
||||
shebang-command "^2.0.0"
|
||||
which "^2.0.1"
|
||||
|
||||
end-of-stream@^1.1.0:
|
||||
version "1.4.4"
|
||||
resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0"
|
||||
integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==
|
||||
dependencies:
|
||||
once "^1.4.0"
|
||||
|
||||
execa@^4.0.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/execa/-/execa-4.1.0.tgz#4e5491ad1572f2f17a77d388c6c857135b22847a"
|
||||
integrity sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==
|
||||
dependencies:
|
||||
cross-spawn "^7.0.0"
|
||||
get-stream "^5.0.0"
|
||||
human-signals "^1.1.1"
|
||||
is-stream "^2.0.0"
|
||||
merge-stream "^2.0.0"
|
||||
npm-run-path "^4.0.0"
|
||||
onetime "^5.1.0"
|
||||
signal-exit "^3.0.2"
|
||||
strip-final-newline "^2.0.0"
|
||||
|
||||
find-up@^4.1.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19"
|
||||
integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==
|
||||
dependencies:
|
||||
locate-path "^5.0.0"
|
||||
path-exists "^4.0.0"
|
||||
|
||||
get-stream@^5.0.0:
|
||||
version "5.2.0"
|
||||
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3"
|
||||
integrity sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==
|
||||
dependencies:
|
||||
pump "^3.0.0"
|
||||
|
||||
has-flag@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
|
||||
integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==
|
||||
|
||||
human-signals@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3"
|
||||
integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==
|
||||
|
||||
husky@^5.1.3:
|
||||
version "5.2.0"
|
||||
resolved "https://registry.yarnpkg.com/husky/-/husky-5.2.0.tgz#fc5e1c2300d34855d47de4753607d00943fc0802"
|
||||
integrity sha512-AM8T/auHXRBxlrfPVLKP6jt49GCM2Zz47m8G3FOMsLmTv8Dj/fKVWE0Rh2d4Qrvmy131xEsdQnb3OXRib67PGg==
|
||||
|
||||
ignore@^5.1.4:
|
||||
version "5.1.8"
|
||||
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57"
|
||||
integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==
|
||||
|
||||
is-stream@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3"
|
||||
integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==
|
||||
|
||||
isexe@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
|
||||
integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=
|
||||
|
||||
locate-path@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0"
|
||||
integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==
|
||||
dependencies:
|
||||
p-locate "^4.1.0"
|
||||
|
||||
merge-stream@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60"
|
||||
integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==
|
||||
|
||||
mimic-fn@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b"
|
||||
integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==
|
||||
|
||||
minimatch@^3.0.4:
|
||||
version "3.0.4"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
|
||||
integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==
|
||||
dependencies:
|
||||
brace-expansion "^1.1.7"
|
||||
|
||||
monaco-editor-core@0.27.0:
|
||||
version "0.27.0"
|
||||
resolved "https://registry.yarnpkg.com/monaco-editor-core/-/monaco-editor-core-0.27.0.tgz#2a24d1155d6331f966525e82154a0591e4b179f3"
|
||||
integrity sha512-x7I0QiIwwvxt1lzYSoQjf1xGjtEPobFx3Zvrj+tWbJbJFsXUy11IJ6TEIZ2yRjEFzuy+vrlbcfASC6lcGg/xhw==
|
||||
|
||||
monaco-languages@^2.4.0:
|
||||
version "2.5.0"
|
||||
resolved "https://registry.yarnpkg.com/monaco-languages/-/monaco-languages-2.5.0.tgz#9bef3f59729980ea4375c1e01547e732d4267323"
|
||||
integrity sha512-nwVv15bM/RJFoW/17CQ9XN8N3pzx+JEX8zNGBIpPrHpuPM47XkPzzh//MiLdEM9eoYf0xUQpbv3ZFbHqtiCu8A==
|
||||
|
||||
monaco-plugin-helpers@^1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/monaco-plugin-helpers/-/monaco-plugin-helpers-1.0.3.tgz#d12458eb4a41f54a553226f11134f1f2283d0c20"
|
||||
integrity sha512-6AYI3ONAy8ki74qG2JqtFrLdiJHQlgeO5l4Rwr0OMyIpGXhc94y5rZuFxOtgGkxgSrZfHSwOt/MulUNZ/mOQOw==
|
||||
dependencies:
|
||||
typescript "^2.7.2"
|
||||
|
||||
mri@^1.1.5:
|
||||
version "1.1.6"
|
||||
resolved "https://registry.yarnpkg.com/mri/-/mri-1.1.6.tgz#49952e1044db21dbf90f6cd92bc9c9a777d415a6"
|
||||
integrity sha512-oi1b3MfbyGa7FJMP9GmLTttni5JoICpYBRlq+x5V16fZbLsnL9N3wFqqIm/nIG43FjUFkFh9Epzp/kzUGUnJxQ==
|
||||
|
||||
multimatch@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-4.0.0.tgz#8c3c0f6e3e8449ada0af3dd29efb491a375191b3"
|
||||
integrity sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ==
|
||||
dependencies:
|
||||
"@types/minimatch" "^3.0.3"
|
||||
array-differ "^3.0.0"
|
||||
array-union "^2.1.0"
|
||||
arrify "^2.0.1"
|
||||
minimatch "^3.0.4"
|
||||
|
||||
npm-run-path@^4.0.0:
|
||||
version "4.0.1"
|
||||
resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea"
|
||||
integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==
|
||||
dependencies:
|
||||
path-key "^3.0.0"
|
||||
|
||||
once@^1.3.1, once@^1.4.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
|
||||
integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E=
|
||||
dependencies:
|
||||
wrappy "1"
|
||||
|
||||
onetime@^5.1.0:
|
||||
version "5.1.2"
|
||||
resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e"
|
||||
integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==
|
||||
dependencies:
|
||||
mimic-fn "^2.1.0"
|
||||
|
||||
p-limit@^2.2.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1"
|
||||
integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==
|
||||
dependencies:
|
||||
p-try "^2.0.0"
|
||||
|
||||
p-locate@^4.1.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07"
|
||||
integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==
|
||||
dependencies:
|
||||
p-limit "^2.2.0"
|
||||
|
||||
p-try@^2.0.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6"
|
||||
integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==
|
||||
|
||||
path-exists@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3"
|
||||
integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==
|
||||
|
||||
path-key@^3.0.0, path-key@^3.1.0:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375"
|
||||
integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==
|
||||
|
||||
prettier@^2.2.1:
|
||||
version "2.3.2"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.2.tgz#ef280a05ec253712e486233db5c6f23441e7342d"
|
||||
integrity sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==
|
||||
|
||||
pretty-quick@^3.1.0:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/pretty-quick/-/pretty-quick-3.1.1.tgz#93ca4e2dd38cc4e970e3f54a0ead317a25454688"
|
||||
integrity sha512-ZYLGiMoV2jcaas3vTJrLvKAYsxDoXQBUn8OSTxkl67Fyov9lyXivJTl0+2WVh+y6EovGcw7Lm5ThYpH+Sh3XxQ==
|
||||
dependencies:
|
||||
chalk "^3.0.0"
|
||||
execa "^4.0.0"
|
||||
find-up "^4.1.0"
|
||||
ignore "^5.1.4"
|
||||
mri "^1.1.5"
|
||||
multimatch "^4.0.0"
|
||||
|
||||
pump@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64"
|
||||
integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==
|
||||
dependencies:
|
||||
end-of-stream "^1.1.0"
|
||||
once "^1.3.1"
|
||||
|
||||
requirejs@^2.3.6:
|
||||
version "2.3.6"
|
||||
resolved "https://registry.yarnpkg.com/requirejs/-/requirejs-2.3.6.tgz#e5093d9601c2829251258c0b9445d4d19fa9e7c9"
|
||||
integrity sha512-ipEzlWQe6RK3jkzikgCupiTbTvm4S0/CAU5GlgptkN5SO6F3u0UD0K18wy6ErDqiCyP4J4YYe1HuAShvsxePLg==
|
||||
|
||||
shebang-command@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea"
|
||||
integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==
|
||||
dependencies:
|
||||
shebang-regex "^3.0.0"
|
||||
|
||||
shebang-regex@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"
|
||||
integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==
|
||||
|
||||
signal-exit@^3.0.2:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c"
|
||||
integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==
|
||||
|
||||
source-map-support@~0.5.19:
|
||||
version "0.5.19"
|
||||
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61"
|
||||
integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==
|
||||
dependencies:
|
||||
buffer-from "^1.0.0"
|
||||
source-map "^0.6.0"
|
||||
|
||||
source-map@^0.6.0:
|
||||
version "0.6.1"
|
||||
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
|
||||
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
|
||||
|
||||
source-map@~0.7.2:
|
||||
version "0.7.3"
|
||||
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383"
|
||||
integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==
|
||||
|
||||
strip-final-newline@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad"
|
||||
integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==
|
||||
|
||||
supports-color@^7.1.0:
|
||||
version "7.2.0"
|
||||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da"
|
||||
integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==
|
||||
dependencies:
|
||||
has-flag "^4.0.0"
|
||||
|
||||
terser@^5.6.0:
|
||||
version "5.7.1"
|
||||
resolved "https://registry.yarnpkg.com/terser/-/terser-5.7.1.tgz#2dc7a61009b66bb638305cb2a824763b116bf784"
|
||||
integrity sha512-b3e+d5JbHAe/JSjwsC3Zn55wsBIM7AsHLjKxT31kGCldgbpFePaFo+PiddtO6uwRZWRw7sPXmAN8dTW61xmnSg==
|
||||
dependencies:
|
||||
commander "^2.20.0"
|
||||
source-map "~0.7.2"
|
||||
source-map-support "~0.5.19"
|
||||
|
||||
typescript@^2.7.2:
|
||||
version "2.9.2"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.2.tgz#1cbf61d05d6b96269244eb6a3bce4bd914e0f00c"
|
||||
integrity sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==
|
||||
|
||||
typescript@^4.2.3:
|
||||
version "4.3.5"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4"
|
||||
integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==
|
||||
|
||||
vscode-html-languageservice@^4.0.8:
|
||||
version "4.0.8"
|
||||
resolved "https://registry.yarnpkg.com/vscode-html-languageservice/-/vscode-html-languageservice-4.0.8.tgz#9429bacce3244dcfcb3a7172903f33b6f418db3b"
|
||||
integrity sha512-VJ4boG3uOD5Ls0pCvml7ZkHY+f1uDuxr+wR39XrerPr7qQFAu91DRTBuOzBsp6lV3x5Vz2S835AS2ZzLNmezbg==
|
||||
dependencies:
|
||||
vscode-languageserver-textdocument "^1.0.1"
|
||||
vscode-languageserver-types "^3.16.0"
|
||||
vscode-nls "^5.0.0"
|
||||
vscode-uri "^3.0.2"
|
||||
|
||||
vscode-languageserver-textdocument@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.1.tgz#178168e87efad6171b372add1dea34f53e5d330f"
|
||||
integrity sha512-UIcJDjX7IFkck7cSkNNyzIz5FyvpQfY7sdzVy+wkKN/BLaD4DQ0ppXQrKePomCxTS7RrolK1I0pey0bG9eh8dA==
|
||||
|
||||
vscode-languageserver-types@3.16.0, vscode-languageserver-types@^3.16.0:
|
||||
version "3.16.0"
|
||||
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0.tgz#ecf393fc121ec6974b2da3efb3155644c514e247"
|
||||
integrity sha512-k8luDIWJWyenLc5ToFQQMaSrqCHiLwyKPHKPQZ5zz21vM+vIVUSvsRpcbiECH4WR88K2XZqc4ScRcZ7nk/jbeA==
|
||||
|
||||
vscode-nls@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
|
||||
integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==
|
||||
|
||||
vscode-uri@^3.0.2:
|
||||
version "3.0.2"
|
||||
resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-3.0.2.tgz#ecfd1d066cb8ef4c3a208decdbab9a8c23d055d0"
|
||||
integrity sha512-jkjy6pjU1fxUvI51P+gCsxg1u2n8LSt0W6KrCNQceaziKzff74GoWmjVG46KieVzybO1sttPQmYfrwSHey7GUA==
|
||||
|
||||
which@^2.0.1:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"
|
||||
integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==
|
||||
dependencies:
|
||||
isexe "^2.0.0"
|
||||
|
||||
wrappy@1:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
||||
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
|
@ -0,0 +1,3 @@
|
||||
/node_modules/
|
||||
/out/
|
||||
/release/
|
@ -0,0 +1,12 @@
|
||||
/.vscode/
|
||||
/out/
|
||||
/scripts/
|
||||
/src/
|
||||
/test/
|
||||
/.gitignore
|
||||
/.npmignore
|
||||
/.prettierrc
|
||||
/.prettierignore
|
||||
/package-lock.json
|
||||
/webpack.dev.config.js
|
||||
/webpack.min.config.js
|
@ -0,0 +1,2 @@
|
||||
/out/
|
||||
/release/
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"arrowParens": "always",
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"semi": true,
|
||||
"useTabs": true,
|
||||
"printWidth": 100
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
"files.trimTrailingWhitespace": true,
|
||||
"search.exclude": {
|
||||
"**/node_modules": true,
|
||||
"**/release": true,
|
||||
"**/out": true
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Microsoft Corporation
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -0,0 +1,39 @@
|
||||
# Monaco JSON
|
||||
|
||||
JSON language plugin for the Monaco Editor. It provides the following features when editing JSON files:
|
||||
|
||||
- Code completion, based on JSON schemas or by looking at similar objects in the same file
|
||||
- Hovers, based on JSON schemas
|
||||
- Validation: Syntax errors and schema validation
|
||||
- Formatting
|
||||
- Document Symbols
|
||||
- Syntax highlighting
|
||||
- Color decorators for all properties matching a schema containing `format: "color-hex"'` (non-standard schema extension)
|
||||
|
||||
Schemas can be provided by configuration. See [here](https://github.com/Microsoft/monaco-json/blob/master/monaco.d.ts)
|
||||
for the API that the JSON plugin offers to configure the JSON language support.
|
||||
|
||||
Internally the JSON plugin uses the [vscode-json-languageservice](https://github.com/Microsoft/vscode-json-languageservice)
|
||||
node module, providing the implementation of the features listed above. The same module is also used
|
||||
in [Visual Studio Code](https://github.com/Microsoft/vscode) to power the JSON editing experience.
|
||||
|
||||
## Issues
|
||||
|
||||
Please file issues concerning `monaco-json` in the [`monaco-editor` repository](https://github.com/Microsoft/monaco-editor/issues).
|
||||
|
||||
## Installing
|
||||
|
||||
This npm module is bundled and distributed in the [monaco-editor](https://www.npmjs.com/package/monaco-editor) npm module.
|
||||
|
||||
## Development
|
||||
|
||||
- `git clone https://github.com/Microsoft/monaco-json`
|
||||
- `npm install .`
|
||||
- compile with `npm run compile`
|
||||
- watch with `npm run watch`
|
||||
- `npm run prepublishOnly`
|
||||
- open `$/monaco-json/test/index.html` in your favorite browser.
|
||||
|
||||
## License
|
||||
|
||||
[MIT](https://github.com/Microsoft/monaco-json/blob/master/LICENSE.md)
|
@ -0,0 +1,41 @@
|
||||
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.5 BLOCK -->
|
||||
|
||||
## Security
|
||||
|
||||
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
|
||||
|
||||
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](<https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)>), please report it to us as described below.
|
||||
|
||||
## Reporting Security Issues
|
||||
|
||||
**Please do not report security vulnerabilities through public GitHub issues.**
|
||||
|
||||
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).
|
||||
|
||||
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).
|
||||
|
||||
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
|
||||
|
||||
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
||||
|
||||
- Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
|
||||
- Full paths of source file(s) related to the manifestation of the issue
|
||||
- The location of the affected source code (tag/branch/commit or direct URL)
|
||||
- Any special configuration required to reproduce the issue
|
||||
- Step-by-step instructions to reproduce the issue
|
||||
- Proof-of-concept or exploit code (if possible)
|
||||
- Impact of the issue, including how an attacker might exploit the issue
|
||||
|
||||
This information will help us triage your report more quickly.
|
||||
|
||||
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs.
|
||||
|
||||
## Preferred Languages
|
||||
|
||||
We prefer all communications to be in English.
|
||||
|
||||
## Policy
|
||||
|
||||
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).
|
||||
|
||||
<!-- END MICROSOFT SECURITY.MD BLOCK -->
|
@ -0,0 +1,113 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/// <reference path="node_modules/monaco-editor-core/monaco.d.ts" />
|
||||
|
||||
declare namespace monaco.languages.json {
|
||||
export interface DiagnosticsOptions {
|
||||
/**
|
||||
* If set, the validator will be enabled and perform syntax and schema based validation,
|
||||
* unless `DiagnosticsOptions.schemaValidation` is set to `ignore`.
|
||||
*/
|
||||
readonly validate?: boolean;
|
||||
/**
|
||||
* If set, comments are tolerated. If set to false, syntax errors will be emitted for comments.
|
||||
* `DiagnosticsOptions.allowComments` will override this setting.
|
||||
*/
|
||||
readonly allowComments?: boolean;
|
||||
/**
|
||||
* A list of known schemas and/or associations of schemas to file names.
|
||||
*/
|
||||
readonly schemas?: {
|
||||
/**
|
||||
* The URI of the schema, which is also the identifier of the schema.
|
||||
*/
|
||||
readonly uri: string;
|
||||
/**
|
||||
* A list of glob patterns that describe for which file URIs the JSON schema will be used.
|
||||
* '*' and '**' wildcards are supported. Exclusion patterns start with '!'.
|
||||
* For example '*.schema.json', 'package.json', '!foo*.schema.json', 'foo/**\/BADRESP.json'.
|
||||
* A match succeeds when there is at least one pattern matching and last matching pattern does not start with '!'.
|
||||
*/
|
||||
readonly fileMatch?: string[];
|
||||
/**
|
||||
* The schema for the given URI.
|
||||
*/
|
||||
readonly schema?: any;
|
||||
}[];
|
||||
/**
|
||||
* If set, the schema service would load schema content on-demand with 'fetch' if available
|
||||
*/
|
||||
readonly enableSchemaRequest?: boolean;
|
||||
/**
|
||||
* The severity of problems from schema validation. If set to 'ignore', schema validation will be skipped. If not set, 'warning' is used.
|
||||
*/
|
||||
readonly schemaValidation?: SeverityLevel;
|
||||
/**
|
||||
* The severity of problems that occurred when resolving and loading schemas. If set to 'ignore', schema resolving problems are not reported. If not set, 'warning' is used.
|
||||
*/
|
||||
readonly schemaRequest?: SeverityLevel;
|
||||
/**
|
||||
* The severity of reported trailing commas. If not set, trailing commas will be reported as errors.
|
||||
*/
|
||||
readonly trailingCommas?: SeverityLevel;
|
||||
/**
|
||||
* The severity of reported comments. If not set, 'DiagnosticsOptions.allowComments' defines whether comments are ignored or reported as errors.
|
||||
*/
|
||||
readonly comments?: SeverityLevel;
|
||||
}
|
||||
export type SeverityLevel = 'error' | 'warning' | 'ignore';
|
||||
export interface ModeConfiguration {
|
||||
/**
|
||||
* Defines whether the built-in documentFormattingEdit provider is enabled.
|
||||
*/
|
||||
readonly documentFormattingEdits?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in documentRangeFormattingEdit provider is enabled.
|
||||
*/
|
||||
readonly documentRangeFormattingEdits?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in completionItemProvider is enabled.
|
||||
*/
|
||||
readonly completionItems?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in hoverProvider is enabled.
|
||||
*/
|
||||
readonly hovers?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in documentSymbolProvider is enabled.
|
||||
*/
|
||||
readonly documentSymbols?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in tokens provider is enabled.
|
||||
*/
|
||||
readonly tokens?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in color provider is enabled.
|
||||
*/
|
||||
readonly colors?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in foldingRange provider is enabled.
|
||||
*/
|
||||
readonly foldingRanges?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in diagnostic provider is enabled.
|
||||
*/
|
||||
readonly diagnostics?: boolean;
|
||||
/**
|
||||
* Defines whether the built-in selection range provider is enabled.
|
||||
*/
|
||||
readonly selectionRanges?: boolean;
|
||||
}
|
||||
export interface LanguageServiceDefaults {
|
||||
readonly languageId: string;
|
||||
readonly onDidChange: IEvent<LanguageServiceDefaults>;
|
||||
readonly diagnosticsOptions: DiagnosticsOptions;
|
||||
readonly modeConfiguration: ModeConfiguration;
|
||||
setDiagnosticsOptions(options: DiagnosticsOptions): void;
|
||||
setModeConfiguration(modeConfiguration: ModeConfiguration): void;
|
||||
}
|
||||
export const jsonDefaults: LanguageServiceDefaults;
|
||||
}
|
@ -0,0 +1,504 @@
|
||||
{
|
||||
"name": "monaco-json",
|
||||
"version": "3.9.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@types/minimatch": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz",
|
||||
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==",
|
||||
"dev": true
|
||||
},
|
||||
"ansi-styles": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-convert": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"array-differ": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz",
|
||||
"integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==",
|
||||
"dev": true
|
||||
},
|
||||
"array-union": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz",
|
||||
"integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==",
|
||||
"dev": true
|
||||
},
|
||||
"arrify": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz",
|
||||
"integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==",
|
||||
"dev": true
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
|
||||
"dev": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"buffer-from": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
|
||||
"integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==",
|
||||
"dev": true
|
||||
},
|
||||
"chalk": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
|
||||
"integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-styles": "^4.1.0",
|
||||
"supports-color": "^7.1.0"
|
||||
}
|
||||
},
|
||||
"color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-name": "~1.1.4"
|
||||
}
|
||||
},
|
||||
"color-name": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||
"dev": true
|
||||
},
|
||||
"commander": {
|
||||
"version": "2.20.3",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
|
||||
"dev": true
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
|
||||
"dev": true
|
||||
},
|
||||
"cross-spawn": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"path-key": "^3.1.0",
|
||||
"shebang-command": "^2.0.0",
|
||||
"which": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"end-of-stream": {
|
||||
"version": "1.4.4",
|
||||
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
|
||||
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"once": "^1.4.0"
|
||||
}
|
||||
},
|
||||
"execa": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz",
|
||||
"integrity": "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"cross-spawn": "^7.0.0",
|
||||
"get-stream": "^5.0.0",
|
||||
"human-signals": "^1.1.1",
|
||||
"is-stream": "^2.0.0",
|
||||
"merge-stream": "^2.0.0",
|
||||
"npm-run-path": "^4.0.0",
|
||||
"onetime": "^5.1.0",
|
||||
"signal-exit": "^3.0.2",
|
||||
"strip-final-newline": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"find-up": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
|
||||
"integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"locate-path": "^5.0.0",
|
||||
"path-exists": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"get-stream": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
|
||||
"integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"pump": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||
"dev": true
|
||||
},
|
||||
"human-signals": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz",
|
||||
"integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==",
|
||||
"dev": true
|
||||
},
|
||||
"husky": {
|
||||
"version": "5.1.3",
|
||||
"resolved": "https://registry.npmjs.org/husky/-/husky-5.1.3.tgz",
|
||||
"integrity": "sha512-fbNJ+Gz5wx2LIBtMweJNY1D7Uc8p1XERi5KNRMccwfQA+rXlxWNSdUxswo0gT8XqxywTIw7Ywm/F4v/O35RdMg==",
|
||||
"dev": true
|
||||
},
|
||||
"ignore": {
|
||||
"version": "5.1.8",
|
||||
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz",
|
||||
"integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==",
|
||||
"dev": true
|
||||
},
|
||||
"is-stream": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz",
|
||||
"integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==",
|
||||
"dev": true
|
||||
},
|
||||
"isexe": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
|
||||
"dev": true
|
||||
},
|
||||
"jsonc-parser": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz",
|
||||
"integrity": "sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==",
|
||||
"dev": true
|
||||
},
|
||||
"locate-path": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
|
||||
"integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"p-locate": "^4.1.0"
|
||||
}
|
||||
},
|
||||
"merge-stream": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
|
||||
"integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
|
||||
"dev": true
|
||||
},
|
||||
"mimic-fn": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
|
||||
"integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
|
||||
"dev": true
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
},
|
||||
"monaco-editor-core": {
|
||||
"version": "0.30.0",
|
||||
"resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.30.0.tgz",
|
||||
"integrity": "sha512-vFJ7BEOCqLv4xWgFW+UheI/PtccHHNht29lNmo79Re1kNhWCBLLb2nThjRMLPO1rd41vX9hhd9C07/iKOk9/jQ==",
|
||||
"dev": true
|
||||
},
|
||||
"monaco-languages": {
|
||||
"version": "2.11.0",
|
||||
"resolved": "https://registry.npmjs.org/monaco-languages/-/monaco-languages-2.11.0.tgz",
|
||||
"integrity": "sha512-fpeP8XUPejcdoUEMZ5bo4MW8VzEadhrsuyDtT48p2a2PSRT/CXptQm4eGnIfgxf5R95jrCZ0456c5dSEPBuktA==",
|
||||
"dev": true
|
||||
},
|
||||
"monaco-plugin-helpers": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/monaco-plugin-helpers/-/monaco-plugin-helpers-1.0.3.tgz",
|
||||
"integrity": "sha512-6AYI3ONAy8ki74qG2JqtFrLdiJHQlgeO5l4Rwr0OMyIpGXhc94y5rZuFxOtgGkxgSrZfHSwOt/MulUNZ/mOQOw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"typescript": "^2.7.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"typescript": {
|
||||
"version": "2.9.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz",
|
||||
"integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"mri": {
|
||||
"version": "1.1.6",
|
||||
"resolved": "https://registry.npmjs.org/mri/-/mri-1.1.6.tgz",
|
||||
"integrity": "sha512-oi1b3MfbyGa7FJMP9GmLTttni5JoICpYBRlq+x5V16fZbLsnL9N3wFqqIm/nIG43FjUFkFh9Epzp/kzUGUnJxQ==",
|
||||
"dev": true
|
||||
},
|
||||
"multimatch": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/multimatch/-/multimatch-4.0.0.tgz",
|
||||
"integrity": "sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/minimatch": "^3.0.3",
|
||||
"array-differ": "^3.0.0",
|
||||
"array-union": "^2.1.0",
|
||||
"arrify": "^2.0.1",
|
||||
"minimatch": "^3.0.4"
|
||||
}
|
||||
},
|
||||
"npm-run-path": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
|
||||
"integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"path-key": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"onetime": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
|
||||
"integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"mimic-fn": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"p-limit": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
|
||||
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"p-try": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"p-locate": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
|
||||
"integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"p-limit": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"p-try": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
|
||||
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
|
||||
"dev": true
|
||||
},
|
||||
"path-exists": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
|
||||
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
|
||||
"dev": true
|
||||
},
|
||||
"path-key": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
|
||||
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
|
||||
"dev": true
|
||||
},
|
||||
"prettier": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz",
|
||||
"integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==",
|
||||
"dev": true
|
||||
},
|
||||
"pretty-quick": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/pretty-quick/-/pretty-quick-3.1.0.tgz",
|
||||
"integrity": "sha512-DtxIxksaUWCgPFN7E1ZZk4+Aav3CCuRdhrDSFZENb404sYMtuo9Zka823F+Mgeyt8Zt3bUiCjFzzWYE9LYqkmQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "^3.0.0",
|
||||
"execa": "^4.0.0",
|
||||
"find-up": "^4.1.0",
|
||||
"ignore": "^5.1.4",
|
||||
"mri": "^1.1.5",
|
||||
"multimatch": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"pump": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
||||
"integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"end-of-stream": "^1.1.0",
|
||||
"once": "^1.3.1"
|
||||
}
|
||||
},
|
||||
"requirejs": {
|
||||
"version": "2.3.6",
|
||||
"resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.6.tgz",
|
||||
"integrity": "sha512-ipEzlWQe6RK3jkzikgCupiTbTvm4S0/CAU5GlgptkN5SO6F3u0UD0K18wy6ErDqiCyP4J4YYe1HuAShvsxePLg==",
|
||||
"dev": true
|
||||
},
|
||||
"shebang-command": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"shebang-regex": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"shebang-regex": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
|
||||
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
|
||||
"dev": true
|
||||
},
|
||||
"signal-exit": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
|
||||
"integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==",
|
||||
"dev": true
|
||||
},
|
||||
"source-map": {
|
||||
"version": "0.7.3",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
|
||||
"integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==",
|
||||
"dev": true
|
||||
},
|
||||
"source-map-support": {
|
||||
"version": "0.5.19",
|
||||
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz",
|
||||
"integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"buffer-from": "^1.0.0",
|
||||
"source-map": "^0.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"strip-final-newline": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz",
|
||||
"integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",
|
||||
"dev": true
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has-flag": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"terser": {
|
||||
"version": "5.6.0",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.6.0.tgz",
|
||||
"integrity": "sha512-vyqLMoqadC1uR0vywqOZzriDYzgEkNJFK4q9GeyOBHIbiECHiWLKcWfbQWAUaPfxkjDhapSlZB9f7fkMrvkVjA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"commander": "^2.20.0",
|
||||
"source-map": "~0.7.2",
|
||||
"source-map-support": "~0.5.19"
|
||||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "4.2.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz",
|
||||
"integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==",
|
||||
"dev": true
|
||||
},
|
||||
"vscode-json-languageservice": {
|
||||
"version": "4.1.9",
|
||||
"resolved": "https://registry.npmjs.org/vscode-json-languageservice/-/vscode-json-languageservice-4.1.9.tgz",
|
||||
"integrity": "sha512-kxNHitUy2fCxmP6vAp0SRLrUSuecUYzzxlC+85cC3jJlFHWmvtCJOzikC+kcUnIdls9fQSB8n0yHs8Sl6taxJw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"jsonc-parser": "^3.0.0",
|
||||
"vscode-languageserver-textdocument": "^1.0.1",
|
||||
"vscode-languageserver-types": "^3.16.0",
|
||||
"vscode-nls": "^5.0.0",
|
||||
"vscode-uri": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"vscode-languageserver-textdocument": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.2.tgz",
|
||||
"integrity": "sha512-T7uPC18+f8mYE4lbVZwb3OSmvwTZm3cuFhrdx9Bn2l11lmp3SvSuSVjy2JtvrghzjAo4G6Trqny2m9XGnFnWVA==",
|
||||
"dev": true
|
||||
},
|
||||
"vscode-languageserver-types": {
|
||||
"version": "3.16.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0.tgz",
|
||||
"integrity": "sha512-k8luDIWJWyenLc5ToFQQMaSrqCHiLwyKPHKPQZ5zz21vM+vIVUSvsRpcbiECH4WR88K2XZqc4ScRcZ7nk/jbeA==",
|
||||
"dev": true
|
||||
},
|
||||
"vscode-nls": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-5.0.0.tgz",
|
||||
"integrity": "sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==",
|
||||
"dev": true
|
||||
},
|
||||
"vscode-uri": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.2.tgz",
|
||||
"integrity": "sha512-jkjy6pjU1fxUvI51P+gCsxg1u2n8LSt0W6KrCNQceaziKzff74GoWmjVG46KieVzybO1sttPQmYfrwSHey7GUA==",
|
||||
"dev": true
|
||||
},
|
||||
"which": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"isexe": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "monaco-json",
|
||||
"version": "3.9.0",
|
||||
"description": "JSON plugin for the Monaco Editor",
|
||||
"scripts": {
|
||||
"compile": "mrmdir ./out && tsc -p ./src/tsconfig.json && tsc -p ./src/tsconfig.esm.json && node ./scripts/dts && prettier --write ./monaco.d.ts",
|
||||
"watch": "tsc -p ./src --watch",
|
||||
"prepublishOnly": "mrmdir ./release && npm run compile && node ./scripts/release.js && node ./scripts/bundle && mcopy ./monaco.d.ts ./release/monaco.d.ts && mcopy ./out/esm/monaco.contribution.d.ts ./release/esm/monaco.contribution.d.ts && mcopy ./out/esm/fillers/monaco-editor-core.d.ts ./release/esm/fillers/monaco-editor-core.d.ts",
|
||||
"install-service-next": "npm install vscode-json-languageservice@next -f -D && npm install vscode-languageserver-types@next -f -D",
|
||||
"install-service-local": "npm install ../vscode-json-languageservice -f -D && npm install ../vscode-languageserver-node/types -f -D",
|
||||
"prettier": "prettier --write ."
|
||||
},
|
||||
"author": "Microsoft Corporation",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Microsoft/monaco-json"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Microsoft/monaco-json/issues"
|
||||
},
|
||||
"module": "./release/esm/monaco.contribution.js",
|
||||
"typings": "./release/esm/monaco.contribution.d.ts",
|
||||
"devDependencies": {
|
||||
"husky": "^5.1.3",
|
||||
"jsonc-parser": "^3.0.0",
|
||||
"monaco-editor-core": "0.30.0",
|
||||
"monaco-languages": "2.11.0",
|
||||
"monaco-plugin-helpers": "^1.0.3",
|
||||
"prettier": "^2.2.1",
|
||||
"pretty-quick": "^3.1.0",
|
||||
"requirejs": "^2.3.6",
|
||||
"terser": "^5.6.0",
|
||||
"typescript": "4.2.4",
|
||||
"vscode-json-languageservice": "4.1.9",
|
||||
"vscode-uri": "3.0.2"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "pretty-quick --staged"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
const requirejs = require('requirejs');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const Terser = require('terser');
|
||||
const helpers = require('monaco-plugin-helpers');
|
||||
|
||||
const REPO_ROOT = path.resolve(__dirname, '..');
|
||||
|
||||
const sha1 = helpers.getGitVersion(REPO_ROOT);
|
||||
const semver = require('../package.json').version;
|
||||
const headerVersion = semver + '(' + sha1 + ')';
|
||||
|
||||
const BUNDLED_FILE_HEADER = [
|
||||
'/*!-----------------------------------------------------------------------------',
|
||||
' * Copyright (c) Microsoft Corporation. All rights reserved.',
|
||||
' * monaco-json version: ' + headerVersion,
|
||||
' * Released under the MIT license',
|
||||
' * https://github.com/Microsoft/monaco-json/blob/master/LICENSE.md',
|
||||
' *-----------------------------------------------------------------------------*/',
|
||||
''
|
||||
].join('\n');
|
||||
|
||||
bundleOne('monaco.contribution');
|
||||
bundleOne('jsonMode', ['vs/language/json/monaco.contribution']);
|
||||
bundleOne('jsonWorker');
|
||||
|
||||
function bundleOne(moduleId, exclude) {
|
||||
requirejs.optimize(
|
||||
{
|
||||
baseUrl: 'out/amd/',
|
||||
name: 'vs/language/json/' + moduleId,
|
||||
out: 'release/dev/' + moduleId + '.js',
|
||||
exclude: exclude,
|
||||
paths: {
|
||||
'vs/language/json': REPO_ROOT + '/out/amd',
|
||||
'vs/language/json/fillers/monaco-editor-core':
|
||||
REPO_ROOT + '/out/amd/fillers/monaco-editor-core-amd'
|
||||
},
|
||||
optimize: 'none',
|
||||
packages: [
|
||||
{
|
||||
name: 'vscode-json-languageservice',
|
||||
location: path.join(REPO_ROOT, 'node_modules/vscode-json-languageservice/lib/umd'),
|
||||
main: 'jsonLanguageService'
|
||||
},
|
||||
{
|
||||
name: 'vscode-languageserver-types',
|
||||
location: path.join(REPO_ROOT, 'node_modules/vscode-languageserver-types/lib/umd'),
|
||||
main: 'main'
|
||||
},
|
||||
{
|
||||
name: 'vscode-languageserver-textdocument',
|
||||
location: path.join(REPO_ROOT, 'node_modules/vscode-languageserver-textdocument/lib/umd'),
|
||||
main: 'main'
|
||||
},
|
||||
{
|
||||
name: 'jsonc-parser',
|
||||
location: path.join(REPO_ROOT, 'node_modules/jsonc-parser/lib/umd'),
|
||||
main: 'main'
|
||||
},
|
||||
{
|
||||
name: 'vscode-uri',
|
||||
location: path.join(REPO_ROOT, 'node_modules/vscode-uri/lib/umd'),
|
||||
main: 'index'
|
||||
},
|
||||
{
|
||||
name: 'vscode-nls',
|
||||
location: path.join(REPO_ROOT, '/out/amd/fillers'),
|
||||
main: 'vscode-nls'
|
||||
}
|
||||
]
|
||||
},
|
||||
async function (buildResponse) {
|
||||
const devFilePath = path.join(REPO_ROOT, 'release/dev/' + moduleId + '.js');
|
||||
const minFilePath = path.join(REPO_ROOT, 'release/min/' + moduleId + '.js');
|
||||
const fileContents = fs.readFileSync(devFilePath).toString();
|
||||
console.log(`Minifying ${devFilePath}...`);
|
||||
const result = await Terser.minify(fileContents, {
|
||||
output: {
|
||||
comments: 'some'
|
||||
}
|
||||
});
|
||||
console.log(`Done minifying ${devFilePath}.`);
|
||||
try {
|
||||
fs.mkdirSync(path.join(REPO_ROOT, 'release/min'));
|
||||
} catch (err) {}
|
||||
fs.writeFileSync(minFilePath, BUNDLED_FILE_HEADER + result.code);
|
||||
}
|
||||
);
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
const REPO_ROOT = path.join(__dirname, '../');
|
||||
const SRC_PATH = path.join(REPO_ROOT, 'out/amd/monaco.contribution.d.ts');
|
||||
const DST_PATH = path.join(REPO_ROOT, 'monaco.d.ts');
|
||||
|
||||
const lines = fs
|
||||
.readFileSync(SRC_PATH)
|
||||
.toString()
|
||||
.split(/\r\n|\r|\n/);
|
||||
let result = [
|
||||
`/*---------------------------------------------------------------------------------------------`,
|
||||
` * Copyright (c) Microsoft Corporation. All rights reserved.`,
|
||||
` * Licensed under the MIT License. See License.txt in the project root for license information.`,
|
||||
` *--------------------------------------------------------------------------------------------*/`,
|
||||
``,
|
||||
`/// <reference path="node_modules/monaco-editor-core/monaco.d.ts" />`,
|
||||
``,
|
||||
`declare namespace monaco.languages.json {`
|
||||
];
|
||||
for (let line of lines) {
|
||||
if (/^import/.test(line)) {
|
||||
continue;
|
||||
}
|
||||
line = line.replace(/ /g, '\t');
|
||||
line = line.replace(/declare /g, '');
|
||||
if (line.length > 0) {
|
||||
line = `\t${line}`;
|
||||
result.push(line);
|
||||
}
|
||||
}
|
||||
result.push(`}`);
|
||||
result.push(``);
|
||||
|
||||
fs.writeFileSync(DST_PATH, result.join('\n'));
|
@ -0,0 +1,27 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
const path = require('path');
|
||||
const helpers = require('monaco-plugin-helpers');
|
||||
|
||||
const REPO_ROOT = path.join(__dirname, '../');
|
||||
|
||||
helpers.packageESM({
|
||||
repoRoot: REPO_ROOT,
|
||||
esmSource: 'out/esm',
|
||||
esmDestination: 'release/esm',
|
||||
entryPoints: ['monaco.contribution.js', 'jsonMode.js', 'json.worker.js'],
|
||||
resolveAlias: {
|
||||
'vscode-nls': path.join(REPO_ROOT, 'out/esm/fillers/vscode-nls.js')
|
||||
},
|
||||
resolveSkip: ['monaco-editor-core'],
|
||||
destinationFolderSimplification: {
|
||||
node_modules: '_deps',
|
||||
'jsonc-parser/lib/esm': 'jsonc-parser',
|
||||
'vscode-languageserver-types/lib/esm': 'vscode-languageserver-types',
|
||||
'vscode-uri/lib/esm': 'vscode-uri',
|
||||
'vscode-json-languageservice/lib/esm': 'vscode-json-languageservice'
|
||||
}
|
||||
});
|
@ -0,0 +1,12 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
// Resolves with the global monaco API
|
||||
|
||||
declare var define;
|
||||
|
||||
define([], function () {
|
||||
return (<any>self).monaco;
|
||||
});
|
@ -0,0 +1,6 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
export * from 'monaco-editor-core';
|
@ -0,0 +1,46 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
export interface Options {
|
||||
locale?: string;
|
||||
cacheLanguageResolution?: boolean;
|
||||
}
|
||||
export interface LocalizeInfo {
|
||||
key: string;
|
||||
comment: string[];
|
||||
}
|
||||
export interface LocalizeFunc {
|
||||
(info: LocalizeInfo, message: string, ...args: any[]): string;
|
||||
(key: string, message: string, ...args: any[]): string;
|
||||
}
|
||||
export interface LoadFunc {
|
||||
(file?: string): LocalizeFunc;
|
||||
}
|
||||
|
||||
function format(message: string, args: any[]): string {
|
||||
let result: string;
|
||||
|
||||
if (args.length === 0) {
|
||||
result = message;
|
||||
} else {
|
||||
result = message.replace(/\{(\d+)\}/g, (match, rest) => {
|
||||
let index = rest[0];
|
||||
return typeof args[index] !== 'undefined' ? args[index] : match;
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function localize(key: string | LocalizeInfo, message: string, ...args: any[]): string {
|
||||
return format(message, args);
|
||||
}
|
||||
|
||||
export function loadMessageBundle(file?: string): LocalizeFunc {
|
||||
return localize;
|
||||
}
|
||||
|
||||
export function config(opt?: Options | string): LoadFunc {
|
||||
return loadMessageBundle;
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as worker from 'monaco-editor-core/esm/vs/editor/editor.worker';
|
||||
import { JSONWorker } from './jsonWorker';
|
||||
|
||||
self.onmessage = () => {
|
||||
// ignore the first message
|
||||
worker.initialize((ctx, createData) => {
|
||||
return new JSONWorker(ctx, createData);
|
||||
});
|
||||
};
|
@ -0,0 +1,143 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { WorkerManager } from './workerManager';
|
||||
import type { JSONWorker } from './jsonWorker';
|
||||
import { LanguageServiceDefaults } from './monaco.contribution';
|
||||
import * as languageFeatures from './languageFeatures';
|
||||
import { createTokenizationSupport } from './tokenization';
|
||||
import { Uri, IDisposable, languages } from './fillers/monaco-editor-core';
|
||||
|
||||
export function setupMode(defaults: LanguageServiceDefaults): IDisposable {
|
||||
const disposables: IDisposable[] = [];
|
||||
const providers: IDisposable[] = [];
|
||||
|
||||
const client = new WorkerManager(defaults);
|
||||
disposables.push(client);
|
||||
|
||||
const worker: languageFeatures.WorkerAccessor = (...uris: Uri[]): Promise<JSONWorker> => {
|
||||
return client.getLanguageServiceWorker(...uris);
|
||||
};
|
||||
|
||||
function registerProviders(): void {
|
||||
const { languageId, modeConfiguration } = defaults;
|
||||
|
||||
disposeAll(providers);
|
||||
|
||||
if (modeConfiguration.documentFormattingEdits) {
|
||||
providers.push(
|
||||
languages.registerDocumentFormattingEditProvider(
|
||||
languageId,
|
||||
new languageFeatures.DocumentFormattingEditProvider(worker)
|
||||
)
|
||||
);
|
||||
}
|
||||
if (modeConfiguration.documentRangeFormattingEdits) {
|
||||
providers.push(
|
||||
languages.registerDocumentRangeFormattingEditProvider(
|
||||
languageId,
|
||||
new languageFeatures.DocumentRangeFormattingEditProvider(worker)
|
||||
)
|
||||
);
|
||||
}
|
||||
if (modeConfiguration.completionItems) {
|
||||
providers.push(
|
||||
languages.registerCompletionItemProvider(
|
||||
languageId,
|
||||
new languageFeatures.CompletionAdapter(worker)
|
||||
)
|
||||
);
|
||||
}
|
||||
if (modeConfiguration.hovers) {
|
||||
providers.push(
|
||||
languages.registerHoverProvider(languageId, new languageFeatures.HoverAdapter(worker))
|
||||
);
|
||||
}
|
||||
if (modeConfiguration.documentSymbols) {
|
||||
providers.push(
|
||||
languages.registerDocumentSymbolProvider(
|
||||
languageId,
|
||||
new languageFeatures.DocumentSymbolAdapter(worker)
|
||||
)
|
||||
);
|
||||
}
|
||||
if (modeConfiguration.tokens) {
|
||||
providers.push(languages.setTokensProvider(languageId, createTokenizationSupport(true)));
|
||||
}
|
||||
if (modeConfiguration.colors) {
|
||||
providers.push(
|
||||
languages.registerColorProvider(
|
||||
languageId,
|
||||
new languageFeatures.DocumentColorAdapter(worker)
|
||||
)
|
||||
);
|
||||
}
|
||||
if (modeConfiguration.foldingRanges) {
|
||||
providers.push(
|
||||
languages.registerFoldingRangeProvider(
|
||||
languageId,
|
||||
new languageFeatures.FoldingRangeAdapter(worker)
|
||||
)
|
||||
);
|
||||
}
|
||||
if (modeConfiguration.diagnostics) {
|
||||
providers.push(new languageFeatures.DiagnosticsAdapter(languageId, worker, defaults));
|
||||
}
|
||||
if (modeConfiguration.selectionRanges) {
|
||||
providers.push(
|
||||
languages.registerSelectionRangeProvider(
|
||||
languageId,
|
||||
new languageFeatures.SelectionRangeAdapter(worker)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
registerProviders();
|
||||
|
||||
disposables.push(languages.setLanguageConfiguration(defaults.languageId, richEditConfiguration));
|
||||
|
||||
let modeConfiguration = defaults.modeConfiguration;
|
||||
defaults.onDidChange((newDefaults) => {
|
||||
if (newDefaults.modeConfiguration !== modeConfiguration) {
|
||||
modeConfiguration = newDefaults.modeConfiguration;
|
||||
registerProviders();
|
||||
}
|
||||
});
|
||||
|
||||
disposables.push(asDisposable(providers));
|
||||
|
||||
return asDisposable(disposables);
|
||||
}
|
||||
|
||||
function asDisposable(disposables: IDisposable[]): IDisposable {
|
||||
return { dispose: () => disposeAll(disposables) };
|
||||
}
|
||||
|
||||
function disposeAll(disposables: IDisposable[]) {
|
||||
while (disposables.length) {
|
||||
disposables.pop().dispose();
|
||||
}
|
||||
}
|
||||
|
||||
const richEditConfiguration: languages.LanguageConfiguration = {
|
||||
wordPattern: /(-?\d*\.\d\w*)|([^\[\{\]\}\:\"\,\s]+)/g,
|
||||
|
||||
comments: {
|
||||
lineComment: '//',
|
||||
blockComment: ['/*', '*/']
|
||||
},
|
||||
|
||||
brackets: [
|
||||
['{', '}'],
|
||||
['[', ']']
|
||||
],
|
||||
|
||||
autoClosingPairs: [
|
||||
{ open: '{', close: '}', notIn: ['string'] },
|
||||
{ open: '[', close: ']', notIn: ['string'] },
|
||||
{ open: '"', close: '"', notIn: ['string'] }
|
||||
]
|
||||
};
|
@ -0,0 +1,192 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as jsonService from 'vscode-json-languageservice';
|
||||
import type { worker } from './fillers/monaco-editor-core';
|
||||
import { URI } from 'vscode-uri';
|
||||
import { DiagnosticsOptions } from './monaco.contribution';
|
||||
|
||||
let defaultSchemaRequestService;
|
||||
if (typeof fetch !== 'undefined') {
|
||||
defaultSchemaRequestService = function (url) {
|
||||
return fetch(url).then((response) => response.text());
|
||||
};
|
||||
}
|
||||
|
||||
export class JSONWorker {
|
||||
private _ctx: worker.IWorkerContext;
|
||||
private _languageService: jsonService.LanguageService;
|
||||
private _languageSettings: DiagnosticsOptions;
|
||||
private _languageId: string;
|
||||
|
||||
constructor(ctx: worker.IWorkerContext, createData: ICreateData) {
|
||||
this._ctx = ctx;
|
||||
this._languageSettings = createData.languageSettings;
|
||||
this._languageId = createData.languageId;
|
||||
this._languageService = jsonService.getLanguageService({
|
||||
workspaceContext: {
|
||||
resolveRelativePath: (relativePath: string, resource: string) => {
|
||||
const base = resource.substr(0, resource.lastIndexOf('/') + 1);
|
||||
return resolvePath(base, relativePath);
|
||||
}
|
||||
},
|
||||
schemaRequestService: createData.enableSchemaRequest && defaultSchemaRequestService
|
||||
});
|
||||
this._languageService.configure(this._languageSettings);
|
||||
}
|
||||
|
||||
async doValidation(uri: string): Promise<jsonService.Diagnostic[]> {
|
||||
let document = this._getTextDocument(uri);
|
||||
if (document) {
|
||||
let jsonDocument = this._languageService.parseJSONDocument(document);
|
||||
return this._languageService.doValidation(document, jsonDocument, this._languageSettings);
|
||||
}
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
async doComplete(
|
||||
uri: string,
|
||||
position: jsonService.Position
|
||||
): Promise<jsonService.CompletionList> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let jsonDocument = this._languageService.parseJSONDocument(document);
|
||||
return this._languageService.doComplete(document, position, jsonDocument);
|
||||
}
|
||||
async doResolve(item: jsonService.CompletionItem): Promise<jsonService.CompletionItem> {
|
||||
return this._languageService.doResolve(item);
|
||||
}
|
||||
async doHover(uri: string, position: jsonService.Position): Promise<jsonService.Hover> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let jsonDocument = this._languageService.parseJSONDocument(document);
|
||||
return this._languageService.doHover(document, position, jsonDocument);
|
||||
}
|
||||
async format(
|
||||
uri: string,
|
||||
range: jsonService.Range,
|
||||
options: jsonService.FormattingOptions
|
||||
): Promise<jsonService.TextEdit[]> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let textEdits = this._languageService.format(document, range, options);
|
||||
return Promise.resolve(textEdits);
|
||||
}
|
||||
async resetSchema(uri: string): Promise<boolean> {
|
||||
return Promise.resolve(this._languageService.resetSchema(uri));
|
||||
}
|
||||
async findDocumentSymbols(uri: string): Promise<jsonService.SymbolInformation[]> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let jsonDocument = this._languageService.parseJSONDocument(document);
|
||||
let symbols = this._languageService.findDocumentSymbols(document, jsonDocument);
|
||||
return Promise.resolve(symbols);
|
||||
}
|
||||
async findDocumentColors(uri: string): Promise<jsonService.ColorInformation[]> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let jsonDocument = this._languageService.parseJSONDocument(document);
|
||||
let colorSymbols = this._languageService.findDocumentColors(document, jsonDocument);
|
||||
return Promise.resolve(colorSymbols);
|
||||
}
|
||||
async getColorPresentations(
|
||||
uri: string,
|
||||
color: jsonService.Color,
|
||||
range: jsonService.Range
|
||||
): Promise<jsonService.ColorPresentation[]> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let jsonDocument = this._languageService.parseJSONDocument(document);
|
||||
let colorPresentations = this._languageService.getColorPresentations(
|
||||
document,
|
||||
jsonDocument,
|
||||
color,
|
||||
range
|
||||
);
|
||||
return Promise.resolve(colorPresentations);
|
||||
}
|
||||
async getFoldingRanges(
|
||||
uri: string,
|
||||
context?: { rangeLimit?: number }
|
||||
): Promise<jsonService.FoldingRange[]> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let ranges = this._languageService.getFoldingRanges(document, context);
|
||||
return Promise.resolve(ranges);
|
||||
}
|
||||
async getSelectionRanges(
|
||||
uri: string,
|
||||
positions: jsonService.Position[]
|
||||
): Promise<jsonService.SelectionRange[]> {
|
||||
let document = this._getTextDocument(uri);
|
||||
let jsonDocument = this._languageService.parseJSONDocument(document);
|
||||
let ranges = this._languageService.getSelectionRanges(document, positions, jsonDocument);
|
||||
return Promise.resolve(ranges);
|
||||
}
|
||||
private _getTextDocument(uri: string): jsonService.TextDocument {
|
||||
let models = this._ctx.getMirrorModels();
|
||||
for (let model of models) {
|
||||
if (model.uri.toString() === uri) {
|
||||
return jsonService.TextDocument.create(
|
||||
uri,
|
||||
this._languageId,
|
||||
model.version,
|
||||
model.getValue()
|
||||
);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// URI path utilities, will (hopefully) move to vscode-uri
|
||||
|
||||
const Slash = '/'.charCodeAt(0);
|
||||
const Dot = '.'.charCodeAt(0);
|
||||
|
||||
function isAbsolutePath(path: string) {
|
||||
return path.charCodeAt(0) === Slash;
|
||||
}
|
||||
|
||||
function resolvePath(uriString: string, path: string): string {
|
||||
if (isAbsolutePath(path)) {
|
||||
const uri = URI.parse(uriString);
|
||||
const parts = path.split('/');
|
||||
return uri.with({ path: normalizePath(parts) }).toString();
|
||||
}
|
||||
return joinPath(uriString, path);
|
||||
}
|
||||
|
||||
function normalizePath(parts: string[]): string {
|
||||
const newParts: string[] = [];
|
||||
for (const part of parts) {
|
||||
if (part.length === 0 || (part.length === 1 && part.charCodeAt(0) === Dot)) {
|
||||
// ignore
|
||||
} else if (part.length === 2 && part.charCodeAt(0) === Dot && part.charCodeAt(1) === Dot) {
|
||||
newParts.pop();
|
||||
} else {
|
||||
newParts.push(part);
|
||||
}
|
||||
}
|
||||
if (parts.length > 1 && parts[parts.length - 1].length === 0) {
|
||||
newParts.push('');
|
||||
}
|
||||
let res = newParts.join('/');
|
||||
if (parts[0].length === 0) {
|
||||
res = '/' + res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
function joinPath(uriString: string, ...paths: string[]): string {
|
||||
const uri = URI.parse(uriString);
|
||||
const parts = uri.path.split('/');
|
||||
for (let path of paths) {
|
||||
parts.push(...path.split('/'));
|
||||
}
|
||||
return uri.with({ path: normalizePath(parts) }).toString();
|
||||
}
|
||||
|
||||
export interface ICreateData {
|
||||
languageId: string;
|
||||
languageSettings: DiagnosticsOptions;
|
||||
enableSchemaRequest: boolean;
|
||||
}
|
||||
|
||||
export function create(ctx: worker.IWorkerContext, createData: ICreateData): JSONWorker {
|
||||
return new JSONWorker(ctx, createData);
|
||||
}
|
@ -0,0 +1,722 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { LanguageServiceDefaults } from './monaco.contribution';
|
||||
import type { JSONWorker } from './jsonWorker';
|
||||
import {
|
||||
Uri,
|
||||
Position,
|
||||
Range,
|
||||
IRange,
|
||||
CancellationToken,
|
||||
IDisposable,
|
||||
editor,
|
||||
languages,
|
||||
MarkerSeverity,
|
||||
IMarkdownString
|
||||
} from './fillers/monaco-editor-core';
|
||||
import * as jsonService from 'vscode-json-languageservice';
|
||||
|
||||
export interface WorkerAccessor {
|
||||
(...more: Uri[]): Promise<JSONWorker>;
|
||||
}
|
||||
|
||||
// --- diagnostics --- ---
|
||||
|
||||
export class DiagnosticsAdapter {
|
||||
private _disposables: IDisposable[] = [];
|
||||
private _listener: { [uri: string]: IDisposable } = Object.create(null);
|
||||
|
||||
constructor(
|
||||
private _languageId: string,
|
||||
private _worker: WorkerAccessor,
|
||||
defaults: LanguageServiceDefaults
|
||||
) {
|
||||
const onModelAdd = (model: editor.IModel): void => {
|
||||
let modeId = model.getLanguageId();
|
||||
if (modeId !== this._languageId) {
|
||||
return;
|
||||
}
|
||||
|
||||
let handle: number;
|
||||
this._listener[model.uri.toString()] = model.onDidChangeContent(() => {
|
||||
clearTimeout(handle);
|
||||
handle = setTimeout(() => this._doValidate(model.uri, modeId), 500);
|
||||
});
|
||||
|
||||
this._doValidate(model.uri, modeId);
|
||||
};
|
||||
|
||||
const onModelRemoved = (model: editor.IModel): void => {
|
||||
editor.setModelMarkers(model, this._languageId, []);
|
||||
let uriStr = model.uri.toString();
|
||||
let listener = this._listener[uriStr];
|
||||
if (listener) {
|
||||
listener.dispose();
|
||||
delete this._listener[uriStr];
|
||||
}
|
||||
};
|
||||
|
||||
this._disposables.push(editor.onDidCreateModel(onModelAdd));
|
||||
this._disposables.push(
|
||||
editor.onWillDisposeModel((model) => {
|
||||
onModelRemoved(model);
|
||||
this._resetSchema(model.uri);
|
||||
})
|
||||
);
|
||||
this._disposables.push(
|
||||
editor.onDidChangeModelLanguage((event) => {
|
||||
onModelRemoved(event.model);
|
||||
onModelAdd(event.model);
|
||||
this._resetSchema(event.model.uri);
|
||||
})
|
||||
);
|
||||
|
||||
this._disposables.push(
|
||||
defaults.onDidChange((_) => {
|
||||
editor.getModels().forEach((model) => {
|
||||
if (model.getLanguageId() === this._languageId) {
|
||||
onModelRemoved(model);
|
||||
onModelAdd(model);
|
||||
}
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
this._disposables.push({
|
||||
dispose: () => {
|
||||
editor.getModels().forEach(onModelRemoved);
|
||||
for (let key in this._listener) {
|
||||
this._listener[key].dispose();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
editor.getModels().forEach(onModelAdd);
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this._disposables.forEach((d) => d && d.dispose());
|
||||
this._disposables = [];
|
||||
}
|
||||
|
||||
private _resetSchema(resource: Uri): void {
|
||||
this._worker().then((worker) => {
|
||||
worker.resetSchema(resource.toString());
|
||||
});
|
||||
}
|
||||
|
||||
private _doValidate(resource: Uri, languageId: string): void {
|
||||
this._worker(resource)
|
||||
.then((worker) => {
|
||||
return worker.doValidation(resource.toString()).then((diagnostics) => {
|
||||
const markers = diagnostics.map((d) => toDiagnostics(resource, d));
|
||||
let model = editor.getModel(resource);
|
||||
if (model && model.getLanguageId() === languageId) {
|
||||
editor.setModelMarkers(model, languageId, markers);
|
||||
}
|
||||
});
|
||||
})
|
||||
.then(undefined, (err) => {
|
||||
console.error(err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function toSeverity(lsSeverity: number): MarkerSeverity {
|
||||
switch (lsSeverity) {
|
||||
case jsonService.DiagnosticSeverity.Error:
|
||||
return MarkerSeverity.Error;
|
||||
case jsonService.DiagnosticSeverity.Warning:
|
||||
return MarkerSeverity.Warning;
|
||||
case jsonService.DiagnosticSeverity.Information:
|
||||
return MarkerSeverity.Info;
|
||||
case jsonService.DiagnosticSeverity.Hint:
|
||||
return MarkerSeverity.Hint;
|
||||
default:
|
||||
return MarkerSeverity.Info;
|
||||
}
|
||||
}
|
||||
|
||||
function toDiagnostics(resource: Uri, diag: jsonService.Diagnostic): editor.IMarkerData {
|
||||
let code = typeof diag.code === 'number' ? String(diag.code) : <string>diag.code;
|
||||
|
||||
return {
|
||||
severity: toSeverity(diag.severity),
|
||||
startLineNumber: diag.range.start.line + 1,
|
||||
startColumn: diag.range.start.character + 1,
|
||||
endLineNumber: diag.range.end.line + 1,
|
||||
endColumn: diag.range.end.character + 1,
|
||||
message: diag.message,
|
||||
code: code,
|
||||
source: diag.source
|
||||
};
|
||||
}
|
||||
|
||||
// --- completion ------
|
||||
|
||||
function fromPosition(position: Position): jsonService.Position {
|
||||
if (!position) {
|
||||
return void 0;
|
||||
}
|
||||
return { character: position.column - 1, line: position.lineNumber - 1 };
|
||||
}
|
||||
|
||||
function fromRange(range: IRange): jsonService.Range {
|
||||
if (!range) {
|
||||
return void 0;
|
||||
}
|
||||
return {
|
||||
start: {
|
||||
line: range.startLineNumber - 1,
|
||||
character: range.startColumn - 1
|
||||
},
|
||||
end: { line: range.endLineNumber - 1, character: range.endColumn - 1 }
|
||||
};
|
||||
}
|
||||
function toRange(range: jsonService.Range): Range {
|
||||
if (!range) {
|
||||
return void 0;
|
||||
}
|
||||
return new Range(
|
||||
range.start.line + 1,
|
||||
range.start.character + 1,
|
||||
range.end.line + 1,
|
||||
range.end.character + 1
|
||||
);
|
||||
}
|
||||
|
||||
interface InsertReplaceEdit {
|
||||
/**
|
||||
* The string to be inserted.
|
||||
*/
|
||||
newText: string;
|
||||
/**
|
||||
* The range if the insert is requested
|
||||
*/
|
||||
insert: jsonService.Range;
|
||||
/**
|
||||
* The range if the replace is requested.
|
||||
*/
|
||||
replace: jsonService.Range;
|
||||
}
|
||||
|
||||
function isInsertReplaceEdit(
|
||||
edit: jsonService.TextEdit | InsertReplaceEdit
|
||||
): edit is InsertReplaceEdit {
|
||||
return (
|
||||
typeof (<InsertReplaceEdit>edit).insert !== 'undefined' &&
|
||||
typeof (<InsertReplaceEdit>edit).replace !== 'undefined'
|
||||
);
|
||||
}
|
||||
|
||||
function toCompletionItemKind(kind: number): languages.CompletionItemKind {
|
||||
let mItemKind = languages.CompletionItemKind;
|
||||
|
||||
switch (kind) {
|
||||
case jsonService.CompletionItemKind.Text:
|
||||
return mItemKind.Text;
|
||||
case jsonService.CompletionItemKind.Method:
|
||||
return mItemKind.Method;
|
||||
case jsonService.CompletionItemKind.Function:
|
||||
return mItemKind.Function;
|
||||
case jsonService.CompletionItemKind.Constructor:
|
||||
return mItemKind.Constructor;
|
||||
case jsonService.CompletionItemKind.Field:
|
||||
return mItemKind.Field;
|
||||
case jsonService.CompletionItemKind.Variable:
|
||||
return mItemKind.Variable;
|
||||
case jsonService.CompletionItemKind.Class:
|
||||
return mItemKind.Class;
|
||||
case jsonService.CompletionItemKind.Interface:
|
||||
return mItemKind.Interface;
|
||||
case jsonService.CompletionItemKind.Module:
|
||||
return mItemKind.Module;
|
||||
case jsonService.CompletionItemKind.Property:
|
||||
return mItemKind.Property;
|
||||
case jsonService.CompletionItemKind.Unit:
|
||||
return mItemKind.Unit;
|
||||
case jsonService.CompletionItemKind.Value:
|
||||
return mItemKind.Value;
|
||||
case jsonService.CompletionItemKind.Enum:
|
||||
return mItemKind.Enum;
|
||||
case jsonService.CompletionItemKind.Keyword:
|
||||
return mItemKind.Keyword;
|
||||
case jsonService.CompletionItemKind.Snippet:
|
||||
return mItemKind.Snippet;
|
||||
case jsonService.CompletionItemKind.Color:
|
||||
return mItemKind.Color;
|
||||
case jsonService.CompletionItemKind.File:
|
||||
return mItemKind.File;
|
||||
case jsonService.CompletionItemKind.Reference:
|
||||
return mItemKind.Reference;
|
||||
}
|
||||
return mItemKind.Property;
|
||||
}
|
||||
|
||||
function fromCompletionItemKind(
|
||||
kind: languages.CompletionItemKind
|
||||
): jsonService.CompletionItemKind {
|
||||
let mItemKind = languages.CompletionItemKind;
|
||||
|
||||
switch (kind) {
|
||||
case mItemKind.Text:
|
||||
return jsonService.CompletionItemKind.Text;
|
||||
case mItemKind.Method:
|
||||
return jsonService.CompletionItemKind.Method;
|
||||
case mItemKind.Function:
|
||||
return jsonService.CompletionItemKind.Function;
|
||||
case mItemKind.Constructor:
|
||||
return jsonService.CompletionItemKind.Constructor;
|
||||
case mItemKind.Field:
|
||||
return jsonService.CompletionItemKind.Field;
|
||||
case mItemKind.Variable:
|
||||
return jsonService.CompletionItemKind.Variable;
|
||||
case mItemKind.Class:
|
||||
return jsonService.CompletionItemKind.Class;
|
||||
case mItemKind.Interface:
|
||||
return jsonService.CompletionItemKind.Interface;
|
||||
case mItemKind.Module:
|
||||
return jsonService.CompletionItemKind.Module;
|
||||
case mItemKind.Property:
|
||||
return jsonService.CompletionItemKind.Property;
|
||||
case mItemKind.Unit:
|
||||
return jsonService.CompletionItemKind.Unit;
|
||||
case mItemKind.Value:
|
||||
return jsonService.CompletionItemKind.Value;
|
||||
case mItemKind.Enum:
|
||||
return jsonService.CompletionItemKind.Enum;
|
||||
case mItemKind.Keyword:
|
||||
return jsonService.CompletionItemKind.Keyword;
|
||||
case mItemKind.Snippet:
|
||||
return jsonService.CompletionItemKind.Snippet;
|
||||
case mItemKind.Color:
|
||||
return jsonService.CompletionItemKind.Color;
|
||||
case mItemKind.File:
|
||||
return jsonService.CompletionItemKind.File;
|
||||
case mItemKind.Reference:
|
||||
return jsonService.CompletionItemKind.Reference;
|
||||
}
|
||||
return jsonService.CompletionItemKind.Property;
|
||||
}
|
||||
|
||||
function toTextEdit(textEdit: jsonService.TextEdit): editor.ISingleEditOperation {
|
||||
if (!textEdit) {
|
||||
return void 0;
|
||||
}
|
||||
return {
|
||||
range: toRange(textEdit.range),
|
||||
text: textEdit.newText
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
function toCommand(c: jsonService.Command | undefined): languages.Command {
|
||||
return c && c.command === 'editor.action.triggerSuggest' ? { id: c.command, title: c.title, arguments: c.arguments } : undefined
|
||||
}
|
||||
|
||||
export class CompletionAdapter implements languages.CompletionItemProvider {
|
||||
constructor(private _worker: WorkerAccessor) {}
|
||||
|
||||
public get triggerCharacters(): string[] {
|
||||
return [' ', ':', '"'];
|
||||
}
|
||||
|
||||
provideCompletionItems(
|
||||
model: editor.IReadOnlyModel,
|
||||
position: Position,
|
||||
context: languages.CompletionContext,
|
||||
token: CancellationToken
|
||||
): Promise<languages.CompletionList> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) => {
|
||||
return worker.doComplete(resource.toString(), fromPosition(position));
|
||||
})
|
||||
.then((info) => {
|
||||
if (!info) {
|
||||
return;
|
||||
}
|
||||
const wordInfo = model.getWordUntilPosition(position);
|
||||
const wordRange = new Range(
|
||||
position.lineNumber,
|
||||
wordInfo.startColumn,
|
||||
position.lineNumber,
|
||||
wordInfo.endColumn
|
||||
);
|
||||
|
||||
let items: languages.CompletionItem[] = info.items.map((entry) => {
|
||||
let item: languages.CompletionItem = {
|
||||
label: entry.label,
|
||||
insertText: entry.insertText || entry.label,
|
||||
sortText: entry.sortText,
|
||||
filterText: entry.filterText,
|
||||
documentation: entry.documentation,
|
||||
detail: entry.detail,
|
||||
command: toCommand(entry.command),
|
||||
range: wordRange,
|
||||
kind: toCompletionItemKind(entry.kind)
|
||||
};
|
||||
if (entry.textEdit) {
|
||||
if (isInsertReplaceEdit(entry.textEdit)) {
|
||||
item.range = {
|
||||
insert: toRange(entry.textEdit.insert),
|
||||
replace: toRange(entry.textEdit.replace)
|
||||
};
|
||||
} else {
|
||||
item.range = toRange(entry.textEdit.range);
|
||||
}
|
||||
item.insertText = entry.textEdit.newText;
|
||||
}
|
||||
if (entry.additionalTextEdits) {
|
||||
item.additionalTextEdits = entry.additionalTextEdits.map(toTextEdit);
|
||||
}
|
||||
if (entry.insertTextFormat === jsonService.InsertTextFormat.Snippet) {
|
||||
item.insertTextRules = languages.CompletionItemInsertTextRule.InsertAsSnippet;
|
||||
}
|
||||
return item;
|
||||
});
|
||||
|
||||
return {
|
||||
isIncomplete: info.isIncomplete,
|
||||
suggestions: items
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function isMarkupContent(thing: any): thing is jsonService.MarkupContent {
|
||||
return (
|
||||
thing &&
|
||||
typeof thing === 'object' &&
|
||||
typeof (<jsonService.MarkupContent>thing).kind === 'string'
|
||||
);
|
||||
}
|
||||
|
||||
function toMarkdownString(
|
||||
entry: jsonService.MarkupContent | jsonService.MarkedString
|
||||
): IMarkdownString {
|
||||
if (typeof entry === 'string') {
|
||||
return {
|
||||
value: entry
|
||||
};
|
||||
}
|
||||
if (isMarkupContent(entry)) {
|
||||
if (entry.kind === 'plaintext') {
|
||||
return {
|
||||
value: entry.value.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&')
|
||||
};
|
||||
}
|
||||
return {
|
||||
value: entry.value
|
||||
};
|
||||
}
|
||||
|
||||
return { value: '```' + entry.language + '\n' + entry.value + '\n```\n' };
|
||||
}
|
||||
|
||||
function toMarkedStringArray(
|
||||
contents: jsonService.MarkupContent | jsonService.MarkedString | jsonService.MarkedString[]
|
||||
): IMarkdownString[] {
|
||||
if (!contents) {
|
||||
return void 0;
|
||||
}
|
||||
if (Array.isArray(contents)) {
|
||||
return contents.map(toMarkdownString);
|
||||
}
|
||||
return [toMarkdownString(contents)];
|
||||
}
|
||||
|
||||
// --- hover ------
|
||||
|
||||
export class HoverAdapter implements languages.HoverProvider {
|
||||
constructor(private _worker: WorkerAccessor) {}
|
||||
|
||||
provideHover(
|
||||
model: editor.IReadOnlyModel,
|
||||
position: Position,
|
||||
token: CancellationToken
|
||||
): Promise<languages.Hover> {
|
||||
let resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) => {
|
||||
return worker.doHover(resource.toString(), fromPosition(position));
|
||||
})
|
||||
.then((info) => {
|
||||
if (!info) {
|
||||
return;
|
||||
}
|
||||
return <languages.Hover>{
|
||||
range: toRange(info.range),
|
||||
contents: toMarkedStringArray(info.contents)
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// --- definition ------
|
||||
|
||||
function toLocation(location: jsonService.Location): languages.Location {
|
||||
return {
|
||||
uri: Uri.parse(location.uri),
|
||||
range: toRange(location.range)
|
||||
};
|
||||
}
|
||||
|
||||
// --- document symbols ------
|
||||
|
||||
function toSymbolKind(kind: jsonService.SymbolKind): languages.SymbolKind {
|
||||
let mKind = languages.SymbolKind;
|
||||
|
||||
switch (kind) {
|
||||
case jsonService.SymbolKind.File:
|
||||
return mKind.Array;
|
||||
case jsonService.SymbolKind.Module:
|
||||
return mKind.Module;
|
||||
case jsonService.SymbolKind.Namespace:
|
||||
return mKind.Namespace;
|
||||
case jsonService.SymbolKind.Package:
|
||||
return mKind.Package;
|
||||
case jsonService.SymbolKind.Class:
|
||||
return mKind.Class;
|
||||
case jsonService.SymbolKind.Method:
|
||||
return mKind.Method;
|
||||
case jsonService.SymbolKind.Property:
|
||||
return mKind.Property;
|
||||
case jsonService.SymbolKind.Field:
|
||||
return mKind.Field;
|
||||
case jsonService.SymbolKind.Constructor:
|
||||
return mKind.Constructor;
|
||||
case jsonService.SymbolKind.Enum:
|
||||
return mKind.Enum;
|
||||
case jsonService.SymbolKind.Interface:
|
||||
return mKind.Interface;
|
||||
case jsonService.SymbolKind.Function:
|
||||
return mKind.Function;
|
||||
case jsonService.SymbolKind.Variable:
|
||||
return mKind.Variable;
|
||||
case jsonService.SymbolKind.Constant:
|
||||
return mKind.Constant;
|
||||
case jsonService.SymbolKind.String:
|
||||
return mKind.String;
|
||||
case jsonService.SymbolKind.Number:
|
||||
return mKind.Number;
|
||||
case jsonService.SymbolKind.Boolean:
|
||||
return mKind.Boolean;
|
||||
case jsonService.SymbolKind.Array:
|
||||
return mKind.Array;
|
||||
}
|
||||
return mKind.Function;
|
||||
}
|
||||
|
||||
export class DocumentSymbolAdapter implements languages.DocumentSymbolProvider {
|
||||
constructor(private _worker: WorkerAccessor) {}
|
||||
|
||||
public provideDocumentSymbols(
|
||||
model: editor.IReadOnlyModel,
|
||||
token: CancellationToken
|
||||
): Promise<languages.DocumentSymbol[]> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) => worker.findDocumentSymbols(resource.toString()))
|
||||
.then((items) => {
|
||||
if (!items) {
|
||||
return;
|
||||
}
|
||||
return items.map((item) => ({
|
||||
name: item.name,
|
||||
detail: '',
|
||||
containerName: item.containerName,
|
||||
kind: toSymbolKind(item.kind),
|
||||
range: toRange(item.location.range),
|
||||
selectionRange: toRange(item.location.range),
|
||||
tags: []
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function fromFormattingOptions(
|
||||
options: languages.FormattingOptions
|
||||
): jsonService.FormattingOptions {
|
||||
return {
|
||||
tabSize: options.tabSize,
|
||||
insertSpaces: options.insertSpaces
|
||||
};
|
||||
}
|
||||
|
||||
export class DocumentFormattingEditProvider implements languages.DocumentFormattingEditProvider {
|
||||
constructor(private _worker: WorkerAccessor) {}
|
||||
|
||||
public provideDocumentFormattingEdits(
|
||||
model: editor.IReadOnlyModel,
|
||||
options: languages.FormattingOptions,
|
||||
token: CancellationToken
|
||||
): Promise<editor.ISingleEditOperation[]> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource).then((worker) => {
|
||||
return worker
|
||||
.format(resource.toString(), null, fromFormattingOptions(options))
|
||||
.then((edits) => {
|
||||
if (!edits || edits.length === 0) {
|
||||
return;
|
||||
}
|
||||
return edits.map(toTextEdit);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class DocumentRangeFormattingEditProvider
|
||||
implements languages.DocumentRangeFormattingEditProvider {
|
||||
constructor(private _worker: WorkerAccessor) {}
|
||||
|
||||
public provideDocumentRangeFormattingEdits(
|
||||
model: editor.IReadOnlyModel,
|
||||
range: Range,
|
||||
options: languages.FormattingOptions,
|
||||
token: CancellationToken
|
||||
): Promise<editor.ISingleEditOperation[]> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource).then((worker) => {
|
||||
return worker
|
||||
.format(resource.toString(), fromRange(range), fromFormattingOptions(options))
|
||||
.then((edits) => {
|
||||
if (!edits || edits.length === 0) {
|
||||
return;
|
||||
}
|
||||
return edits.map(toTextEdit);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class DocumentColorAdapter implements languages.DocumentColorProvider {
|
||||
constructor(private _worker: WorkerAccessor) {}
|
||||
|
||||
public provideDocumentColors(
|
||||
model: editor.IReadOnlyModel,
|
||||
token: CancellationToken
|
||||
): Promise<languages.IColorInformation[]> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) => worker.findDocumentColors(resource.toString()))
|
||||
.then((infos) => {
|
||||
if (!infos) {
|
||||
return;
|
||||
}
|
||||
return infos.map((item) => ({
|
||||
color: item.color,
|
||||
range: toRange(item.range)
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
public provideColorPresentations(
|
||||
model: editor.IReadOnlyModel,
|
||||
info: languages.IColorInformation,
|
||||
token: CancellationToken
|
||||
): Promise<languages.IColorPresentation[]> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) =>
|
||||
worker.getColorPresentations(resource.toString(), info.color, fromRange(info.range))
|
||||
)
|
||||
.then((presentations) => {
|
||||
if (!presentations) {
|
||||
return;
|
||||
}
|
||||
return presentations.map((presentation) => {
|
||||
let item: languages.IColorPresentation = {
|
||||
label: presentation.label
|
||||
};
|
||||
if (presentation.textEdit) {
|
||||
item.textEdit = toTextEdit(presentation.textEdit);
|
||||
}
|
||||
if (presentation.additionalTextEdits) {
|
||||
item.additionalTextEdits = presentation.additionalTextEdits.map(toTextEdit);
|
||||
}
|
||||
return item;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class FoldingRangeAdapter implements languages.FoldingRangeProvider {
|
||||
constructor(private _worker: WorkerAccessor) {}
|
||||
|
||||
public provideFoldingRanges(
|
||||
model: editor.IReadOnlyModel,
|
||||
context: languages.FoldingContext,
|
||||
token: CancellationToken
|
||||
): Promise<languages.FoldingRange[]> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) => worker.getFoldingRanges(resource.toString(), context))
|
||||
.then((ranges) => {
|
||||
if (!ranges) {
|
||||
return;
|
||||
}
|
||||
return ranges.map((range) => {
|
||||
let result: languages.FoldingRange = {
|
||||
start: range.startLine + 1,
|
||||
end: range.endLine + 1
|
||||
};
|
||||
if (typeof range.kind !== 'undefined') {
|
||||
result.kind = toFoldingRangeKind(<jsonService.FoldingRangeKind>range.kind);
|
||||
}
|
||||
return result;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function toFoldingRangeKind(kind: jsonService.FoldingRangeKind): languages.FoldingRangeKind {
|
||||
switch (kind) {
|
||||
case jsonService.FoldingRangeKind.Comment:
|
||||
return languages.FoldingRangeKind.Comment;
|
||||
case jsonService.FoldingRangeKind.Imports:
|
||||
return languages.FoldingRangeKind.Imports;
|
||||
case jsonService.FoldingRangeKind.Region:
|
||||
return languages.FoldingRangeKind.Region;
|
||||
}
|
||||
return void 0;
|
||||
}
|
||||
|
||||
export class SelectionRangeAdapter implements languages.SelectionRangeProvider {
|
||||
constructor(private _worker: WorkerAccessor) {}
|
||||
|
||||
public provideSelectionRanges(
|
||||
model: editor.IReadOnlyModel,
|
||||
positions: Position[],
|
||||
token: CancellationToken
|
||||
): Promise<languages.SelectionRange[][]> {
|
||||
const resource = model.uri;
|
||||
|
||||
return this._worker(resource)
|
||||
.then((worker) => worker.getSelectionRanges(resource.toString(), positions.map(fromPosition)))
|
||||
.then((selectionRanges) => {
|
||||
if (!selectionRanges) {
|
||||
return;
|
||||
}
|
||||
return selectionRanges.map((selectionRange) => {
|
||||
const result: languages.SelectionRange[] = [];
|
||||
while (selectionRange) {
|
||||
result.push({ range: toRange(selectionRange.range) });
|
||||
selectionRange = selectionRange.parent;
|
||||
}
|
||||
return result;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue