mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 15:05:39 +01:00
Set printWidth to 100
This commit is contained in:
parent
928e5ba14e
commit
5adfc2c139
12 changed files with 117 additions and 242 deletions
|
|
@ -3,5 +3,6 @@
|
||||||
"singleQuote": true,
|
"singleQuote": true,
|
||||||
"trailingComma": "none",
|
"trailingComma": "none",
|
||||||
"semi": true,
|
"semi": true,
|
||||||
"useTabs": true
|
"useTabs": true,
|
||||||
|
"printWidth": 100
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,26 +40,17 @@ function bundleOne(moduleId, exclude) {
|
||||||
packages: [
|
packages: [
|
||||||
{
|
{
|
||||||
name: 'vscode-json-languageservice',
|
name: 'vscode-json-languageservice',
|
||||||
location: path.join(
|
location: path.join(REPO_ROOT, 'node_modules/vscode-json-languageservice/lib/umd'),
|
||||||
REPO_ROOT,
|
|
||||||
'node_modules/vscode-json-languageservice/lib/umd'
|
|
||||||
),
|
|
||||||
main: 'jsonLanguageService'
|
main: 'jsonLanguageService'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'vscode-languageserver-types',
|
name: 'vscode-languageserver-types',
|
||||||
location: path.join(
|
location: path.join(REPO_ROOT, 'node_modules/vscode-languageserver-types/lib/umd'),
|
||||||
REPO_ROOT,
|
|
||||||
'node_modules/vscode-languageserver-types/lib/umd'
|
|
||||||
),
|
|
||||||
main: 'main'
|
main: 'main'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'vscode-languageserver-textdocument',
|
name: 'vscode-languageserver-textdocument',
|
||||||
location: path.join(
|
location: path.join(REPO_ROOT, 'node_modules/vscode-languageserver-textdocument/lib/umd'),
|
||||||
REPO_ROOT,
|
|
||||||
'node_modules/vscode-languageserver-textdocument/lib/umd'
|
|
||||||
),
|
|
||||||
main: 'main'
|
main: 'main'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -80,14 +71,8 @@ function bundleOne(moduleId, exclude) {
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
async function (buildResponse) {
|
async function (buildResponse) {
|
||||||
const devFilePath = path.join(
|
const devFilePath = path.join(REPO_ROOT, 'release/dev/' + moduleId + '.js');
|
||||||
REPO_ROOT,
|
const minFilePath = path.join(REPO_ROOT, 'release/min/' + moduleId + '.js');
|
||||||
'release/dev/' + moduleId + '.js'
|
|
||||||
);
|
|
||||||
const minFilePath = path.join(
|
|
||||||
REPO_ROOT,
|
|
||||||
'release/min/' + moduleId + '.js'
|
|
||||||
);
|
|
||||||
const fileContents = fs.readFileSync(devFilePath).toString();
|
const fileContents = fs.readFileSync(devFilePath).toString();
|
||||||
console.log(`Minifying ${devFilePath}...`);
|
console.log(`Minifying ${devFilePath}...`);
|
||||||
const result = await Terser.minify(fileContents, {
|
const result = await Terser.minify(fileContents, {
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,7 @@ function format(message: string, args: any[]): string {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function localize(
|
function localize(key: string | LocalizeInfo, message: string, ...args: any[]): string {
|
||||||
key: string | LocalizeInfo,
|
|
||||||
message: string,
|
|
||||||
...args: any[]
|
|
||||||
): string {
|
|
||||||
return format(message, args);
|
return format(message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,7 @@ export function setupMode(defaults: LanguageServiceDefaults): IDisposable {
|
||||||
const client = new WorkerManager(defaults);
|
const client = new WorkerManager(defaults);
|
||||||
disposables.push(client);
|
disposables.push(client);
|
||||||
|
|
||||||
const worker: languageFeatures.WorkerAccessor = (
|
const worker: languageFeatures.WorkerAccessor = (...uris: Uri[]): Promise<JSONWorker> => {
|
||||||
...uris: Uri[]
|
|
||||||
): Promise<JSONWorker> => {
|
|
||||||
return client.getLanguageServiceWorker(...uris);
|
return client.getLanguageServiceWorker(...uris);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -54,10 +52,7 @@ export function setupMode(defaults: LanguageServiceDefaults): IDisposable {
|
||||||
}
|
}
|
||||||
if (modeConfiguration.hovers) {
|
if (modeConfiguration.hovers) {
|
||||||
providers.push(
|
providers.push(
|
||||||
languages.registerHoverProvider(
|
languages.registerHoverProvider(languageId, new languageFeatures.HoverAdapter(worker))
|
||||||
languageId,
|
|
||||||
new languageFeatures.HoverAdapter(worker)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (modeConfiguration.documentSymbols) {
|
if (modeConfiguration.documentSymbols) {
|
||||||
|
|
@ -69,9 +64,7 @@ export function setupMode(defaults: LanguageServiceDefaults): IDisposable {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (modeConfiguration.tokens) {
|
if (modeConfiguration.tokens) {
|
||||||
providers.push(
|
providers.push(languages.setTokensProvider(languageId, createTokenizationSupport(true)));
|
||||||
languages.setTokensProvider(languageId, createTokenizationSupport(true))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if (modeConfiguration.colors) {
|
if (modeConfiguration.colors) {
|
||||||
providers.push(
|
providers.push(
|
||||||
|
|
@ -90,9 +83,7 @@ export function setupMode(defaults: LanguageServiceDefaults): IDisposable {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (modeConfiguration.diagnostics) {
|
if (modeConfiguration.diagnostics) {
|
||||||
providers.push(
|
providers.push(new languageFeatures.DiagnosticsAdapter(languageId, worker, defaults));
|
||||||
new languageFeatures.DiagnosticsAdapter(languageId, worker, defaults)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if (modeConfiguration.selectionRanges) {
|
if (modeConfiguration.selectionRanges) {
|
||||||
providers.push(
|
providers.push(
|
||||||
|
|
@ -106,12 +97,7 @@ export function setupMode(defaults: LanguageServiceDefaults): IDisposable {
|
||||||
|
|
||||||
registerProviders();
|
registerProviders();
|
||||||
|
|
||||||
disposables.push(
|
disposables.push(languages.setLanguageConfiguration(defaults.languageId, richEditConfiguration));
|
||||||
languages.setLanguageConfiguration(
|
|
||||||
defaults.languageId,
|
|
||||||
richEditConfiguration
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
let modeConfiguration = defaults.modeConfiguration;
|
let modeConfiguration = defaults.modeConfiguration;
|
||||||
defaults.onDidChange((newDefaults) => {
|
defaults.onDidChange((newDefaults) => {
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,7 @@ export class JSONWorker {
|
||||||
this._languageSettings = createData.languageSettings;
|
this._languageSettings = createData.languageSettings;
|
||||||
this._languageId = createData.languageId;
|
this._languageId = createData.languageId;
|
||||||
this._languageService = jsonService.getLanguageService({
|
this._languageService = jsonService.getLanguageService({
|
||||||
schemaRequestService:
|
schemaRequestService: createData.enableSchemaRequest && defaultSchemaRequestService
|
||||||
createData.enableSchemaRequest && defaultSchemaRequestService
|
|
||||||
});
|
});
|
||||||
this._languageService.configure(this._languageSettings);
|
this._languageService.configure(this._languageSettings);
|
||||||
}
|
}
|
||||||
|
|
@ -46,15 +45,10 @@ export class JSONWorker {
|
||||||
let jsonDocument = this._languageService.parseJSONDocument(document);
|
let jsonDocument = this._languageService.parseJSONDocument(document);
|
||||||
return this._languageService.doComplete(document, position, jsonDocument);
|
return this._languageService.doComplete(document, position, jsonDocument);
|
||||||
}
|
}
|
||||||
async doResolve(
|
async doResolve(item: jsonService.CompletionItem): Promise<jsonService.CompletionItem> {
|
||||||
item: jsonService.CompletionItem
|
|
||||||
): Promise<jsonService.CompletionItem> {
|
|
||||||
return this._languageService.doResolve(item);
|
return this._languageService.doResolve(item);
|
||||||
}
|
}
|
||||||
async doHover(
|
async doHover(uri: string, position: jsonService.Position): Promise<jsonService.Hover> {
|
||||||
uri: string,
|
|
||||||
position: jsonService.Position
|
|
||||||
): Promise<jsonService.Hover> {
|
|
||||||
let document = this._getTextDocument(uri);
|
let document = this._getTextDocument(uri);
|
||||||
let jsonDocument = this._languageService.parseJSONDocument(document);
|
let jsonDocument = this._languageService.parseJSONDocument(document);
|
||||||
return this._languageService.doHover(document, position, jsonDocument);
|
return this._languageService.doHover(document, position, jsonDocument);
|
||||||
|
|
@ -71,26 +65,16 @@ export class JSONWorker {
|
||||||
async resetSchema(uri: string): Promise<boolean> {
|
async resetSchema(uri: string): Promise<boolean> {
|
||||||
return Promise.resolve(this._languageService.resetSchema(uri));
|
return Promise.resolve(this._languageService.resetSchema(uri));
|
||||||
}
|
}
|
||||||
async findDocumentSymbols(
|
async findDocumentSymbols(uri: string): Promise<jsonService.SymbolInformation[]> {
|
||||||
uri: string
|
|
||||||
): Promise<jsonService.SymbolInformation[]> {
|
|
||||||
let document = this._getTextDocument(uri);
|
let document = this._getTextDocument(uri);
|
||||||
let jsonDocument = this._languageService.parseJSONDocument(document);
|
let jsonDocument = this._languageService.parseJSONDocument(document);
|
||||||
let symbols = this._languageService.findDocumentSymbols(
|
let symbols = this._languageService.findDocumentSymbols(document, jsonDocument);
|
||||||
document,
|
|
||||||
jsonDocument
|
|
||||||
);
|
|
||||||
return Promise.resolve(symbols);
|
return Promise.resolve(symbols);
|
||||||
}
|
}
|
||||||
async findDocumentColors(
|
async findDocumentColors(uri: string): Promise<jsonService.ColorInformation[]> {
|
||||||
uri: string
|
|
||||||
): Promise<jsonService.ColorInformation[]> {
|
|
||||||
let document = this._getTextDocument(uri);
|
let document = this._getTextDocument(uri);
|
||||||
let jsonDocument = this._languageService.parseJSONDocument(document);
|
let jsonDocument = this._languageService.parseJSONDocument(document);
|
||||||
let colorSymbols = this._languageService.findDocumentColors(
|
let colorSymbols = this._languageService.findDocumentColors(document, jsonDocument);
|
||||||
document,
|
|
||||||
jsonDocument
|
|
||||||
);
|
|
||||||
return Promise.resolve(colorSymbols);
|
return Promise.resolve(colorSymbols);
|
||||||
}
|
}
|
||||||
async getColorPresentations(
|
async getColorPresentations(
|
||||||
|
|
@ -122,11 +106,7 @@ export class JSONWorker {
|
||||||
): Promise<jsonService.SelectionRange[]> {
|
): Promise<jsonService.SelectionRange[]> {
|
||||||
let document = this._getTextDocument(uri);
|
let document = this._getTextDocument(uri);
|
||||||
let jsonDocument = this._languageService.parseJSONDocument(document);
|
let jsonDocument = this._languageService.parseJSONDocument(document);
|
||||||
let ranges = this._languageService.getSelectionRanges(
|
let ranges = this._languageService.getSelectionRanges(document, positions, jsonDocument);
|
||||||
document,
|
|
||||||
positions,
|
|
||||||
jsonDocument
|
|
||||||
);
|
|
||||||
return Promise.resolve(ranges);
|
return Promise.resolve(ranges);
|
||||||
}
|
}
|
||||||
private _getTextDocument(uri: string): jsonService.TextDocument {
|
private _getTextDocument(uri: string): jsonService.TextDocument {
|
||||||
|
|
@ -151,9 +131,6 @@ export interface ICreateData {
|
||||||
enableSchemaRequest: boolean;
|
enableSchemaRequest: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function create(
|
export function create(ctx: worker.IWorkerContext, createData: ICreateData): JSONWorker {
|
||||||
ctx: worker.IWorkerContext,
|
|
||||||
createData: ICreateData
|
|
||||||
): JSONWorker {
|
|
||||||
return new JSONWorker(ctx, createData);
|
return new JSONWorker(ctx, createData);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -140,12 +140,8 @@ function toSeverity(lsSeverity: number): MarkerSeverity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toDiagnostics(
|
function toDiagnostics(resource: Uri, diag: jsonService.Diagnostic): editor.IMarkerData {
|
||||||
resource: Uri,
|
let code = typeof diag.code === 'number' ? String(diag.code) : <string>diag.code;
|
||||||
diag: jsonService.Diagnostic
|
|
||||||
): editor.IMarkerData {
|
|
||||||
let code =
|
|
||||||
typeof diag.code === 'number' ? String(diag.code) : <string>diag.code;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
severity: toSeverity(diag.severity),
|
severity: toSeverity(diag.severity),
|
||||||
|
|
@ -306,9 +302,7 @@ function fromCompletionItemKind(
|
||||||
return jsonService.CompletionItemKind.Property;
|
return jsonService.CompletionItemKind.Property;
|
||||||
}
|
}
|
||||||
|
|
||||||
function toTextEdit(
|
function toTextEdit(textEdit: jsonService.TextEdit): editor.ISingleEditOperation {
|
||||||
textEdit: jsonService.TextEdit
|
|
||||||
): editor.ISingleEditOperation {
|
|
||||||
if (!textEdit) {
|
if (!textEdit) {
|
||||||
return void 0;
|
return void 0;
|
||||||
}
|
}
|
||||||
|
|
@ -372,13 +366,10 @@ export class CompletionAdapter implements languages.CompletionItemProvider {
|
||||||
item.insertText = entry.textEdit.newText;
|
item.insertText = entry.textEdit.newText;
|
||||||
}
|
}
|
||||||
if (entry.additionalTextEdits) {
|
if (entry.additionalTextEdits) {
|
||||||
item.additionalTextEdits = entry.additionalTextEdits.map(
|
item.additionalTextEdits = entry.additionalTextEdits.map(toTextEdit);
|
||||||
toTextEdit
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if (entry.insertTextFormat === jsonService.InsertTextFormat.Snippet) {
|
if (entry.insertTextFormat === jsonService.InsertTextFormat.Snippet) {
|
||||||
item.insertTextRules =
|
item.insertTextRules = languages.CompletionItemInsertTextRule.InsertAsSnippet;
|
||||||
languages.CompletionItemInsertTextRule.InsertAsSnippet;
|
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
});
|
});
|
||||||
|
|
@ -422,10 +413,7 @@ function toMarkdownString(
|
||||||
}
|
}
|
||||||
|
|
||||||
function toMarkedStringArray(
|
function toMarkedStringArray(
|
||||||
contents:
|
contents: jsonService.MarkupContent | jsonService.MarkedString | jsonService.MarkedString[]
|
||||||
| jsonService.MarkupContent
|
|
||||||
| jsonService.MarkedString
|
|
||||||
| jsonService.MarkedString[]
|
|
||||||
): IMarkdownString[] {
|
): IMarkdownString[] {
|
||||||
if (!contents) {
|
if (!contents) {
|
||||||
return void 0;
|
return void 0;
|
||||||
|
|
@ -556,8 +544,7 @@ function fromFormattingOptions(
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DocumentFormattingEditProvider
|
export class DocumentFormattingEditProvider implements languages.DocumentFormattingEditProvider {
|
||||||
implements languages.DocumentFormattingEditProvider {
|
|
||||||
constructor(private _worker: WorkerAccessor) {}
|
constructor(private _worker: WorkerAccessor) {}
|
||||||
|
|
||||||
public provideDocumentFormattingEdits(
|
public provideDocumentFormattingEdits(
|
||||||
|
|
@ -594,11 +581,7 @@ export class DocumentRangeFormattingEditProvider
|
||||||
|
|
||||||
return this._worker(resource).then((worker) => {
|
return this._worker(resource).then((worker) => {
|
||||||
return worker
|
return worker
|
||||||
.format(
|
.format(resource.toString(), fromRange(range), fromFormattingOptions(options))
|
||||||
resource.toString(),
|
|
||||||
fromRange(range),
|
|
||||||
fromFormattingOptions(options)
|
|
||||||
)
|
|
||||||
.then((edits) => {
|
.then((edits) => {
|
||||||
if (!edits || edits.length === 0) {
|
if (!edits || edits.length === 0) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -640,11 +623,7 @@ export class DocumentColorAdapter implements languages.DocumentColorProvider {
|
||||||
|
|
||||||
return this._worker(resource)
|
return this._worker(resource)
|
||||||
.then((worker) =>
|
.then((worker) =>
|
||||||
worker.getColorPresentations(
|
worker.getColorPresentations(resource.toString(), info.color, fromRange(info.range))
|
||||||
resource.toString(),
|
|
||||||
info.color,
|
|
||||||
fromRange(info.range)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
.then((presentations) => {
|
.then((presentations) => {
|
||||||
if (!presentations) {
|
if (!presentations) {
|
||||||
|
|
@ -658,9 +637,7 @@ export class DocumentColorAdapter implements languages.DocumentColorProvider {
|
||||||
item.textEdit = toTextEdit(presentation.textEdit);
|
item.textEdit = toTextEdit(presentation.textEdit);
|
||||||
}
|
}
|
||||||
if (presentation.additionalTextEdits) {
|
if (presentation.additionalTextEdits) {
|
||||||
item.additionalTextEdits = presentation.additionalTextEdits.map(
|
item.additionalTextEdits = presentation.additionalTextEdits.map(toTextEdit);
|
||||||
toTextEdit
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
});
|
});
|
||||||
|
|
@ -690,9 +667,7 @@ export class FoldingRangeAdapter implements languages.FoldingRangeProvider {
|
||||||
end: range.endLine + 1
|
end: range.endLine + 1
|
||||||
};
|
};
|
||||||
if (typeof range.kind !== 'undefined') {
|
if (typeof range.kind !== 'undefined') {
|
||||||
result.kind = toFoldingRangeKind(
|
result.kind = toFoldingRangeKind(<jsonService.FoldingRangeKind>range.kind);
|
||||||
<jsonService.FoldingRangeKind>range.kind
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
|
|
@ -700,9 +675,7 @@ export class FoldingRangeAdapter implements languages.FoldingRangeProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toFoldingRangeKind(
|
function toFoldingRangeKind(kind: jsonService.FoldingRangeKind): languages.FoldingRangeKind {
|
||||||
kind: jsonService.FoldingRangeKind
|
|
||||||
): languages.FoldingRangeKind {
|
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case jsonService.FoldingRangeKind.Comment:
|
case jsonService.FoldingRangeKind.Comment:
|
||||||
return languages.FoldingRangeKind.Comment;
|
return languages.FoldingRangeKind.Comment;
|
||||||
|
|
@ -725,12 +698,7 @@ export class SelectionRangeAdapter implements languages.SelectionRangeProvider {
|
||||||
const resource = model.uri;
|
const resource = model.uri;
|
||||||
|
|
||||||
return this._worker(resource)
|
return this._worker(resource)
|
||||||
.then((worker) =>
|
.then((worker) => worker.getSelectionRanges(resource.toString(), positions.map(fromPosition)))
|
||||||
worker.getSelectionRanges(
|
|
||||||
resource.toString(),
|
|
||||||
positions.map(fromPosition)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.then((selectionRanges) => {
|
.then((selectionRanges) => {
|
||||||
if (!selectionRanges) {
|
if (!selectionRanges) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -181,15 +181,7 @@ function getMode(): Promise<typeof mode> {
|
||||||
|
|
||||||
languages.register({
|
languages.register({
|
||||||
id: 'json',
|
id: 'json',
|
||||||
extensions: [
|
extensions: ['.json', '.bowerrc', '.jshintrc', '.jscsrc', '.eslintrc', '.babelrc', '.har'],
|
||||||
'.json',
|
|
||||||
'.bowerrc',
|
|
||||||
'.jshintrc',
|
|
||||||
'.jscsrc',
|
|
||||||
'.eslintrc',
|
|
||||||
'.babelrc',
|
|
||||||
'.har'
|
|
||||||
],
|
|
||||||
aliases: ['JSON', 'json'],
|
aliases: ['JSON', 'json'],
|
||||||
mimetypes: ['application/json']
|
mimetypes: ['application/json']
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -6,19 +6,11 @@
|
||||||
import * as json from 'jsonc-parser';
|
import * as json from 'jsonc-parser';
|
||||||
import { languages } from './fillers/monaco-editor-core';
|
import { languages } from './fillers/monaco-editor-core';
|
||||||
|
|
||||||
export function createTokenizationSupport(
|
export function createTokenizationSupport(supportComments: boolean): languages.TokensProvider {
|
||||||
supportComments: boolean
|
|
||||||
): languages.TokensProvider {
|
|
||||||
return {
|
return {
|
||||||
getInitialState: () => new JSONState(null, null),
|
getInitialState: () => new JSONState(null, null),
|
||||||
tokenize: (line, state, offsetDelta?, stopAtOffset?) =>
|
tokenize: (line, state, offsetDelta?, stopAtOffset?) =>
|
||||||
tokenize(
|
tokenize(supportComments, line, <JSONState>state, offsetDelta, stopAtOffset)
|
||||||
supportComments,
|
|
||||||
line,
|
|
||||||
<JSONState>state,
|
|
||||||
offsetDelta,
|
|
||||||
stopAtOffset
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -108,8 +100,7 @@ function tokenize(
|
||||||
// Check that the scanner has advanced
|
// Check that the scanner has advanced
|
||||||
if (offset === offsetDelta + scanner.getPosition()) {
|
if (offset === offsetDelta + scanner.getPosition()) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'Scanner did not advance, next 3 characters are: ' +
|
'Scanner did not advance, next 3 characters are: ' + line.substr(scanner.getPosition(), 3)
|
||||||
line.substr(scanner.getPosition(), 3)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,6 @@
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"outDir": "../out/esm",
|
"outDir": "../out/esm",
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"lib": [
|
"lib": ["dom", "es5", "es2015.collection", "es2015.promise", "es2015.iterable"]
|
||||||
"dom",
|
|
||||||
"es5",
|
|
||||||
"es2015.collection",
|
|
||||||
"es2015.promise",
|
|
||||||
"es2015.iterable"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,6 @@
|
||||||
"outDir": "../out/amd",
|
"outDir": "../out/amd",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"lib": [
|
"lib": ["dom", "es5", "es2015.collection", "es2015.promise", "es2015.iterable"]
|
||||||
"dom",
|
|
||||||
"es5",
|
|
||||||
"es2015.collection",
|
|
||||||
"es2015.promise",
|
|
||||||
"es2015.iterable"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,7 @@ export class WorkerManager {
|
||||||
this._worker = null;
|
this._worker = null;
|
||||||
this._idleCheckInterval = setInterval(() => this._checkIfIdle(), 30 * 1000);
|
this._idleCheckInterval = setInterval(() => this._checkIfIdle(), 30 * 1000);
|
||||||
this._lastUsedTime = 0;
|
this._lastUsedTime = 0;
|
||||||
this._configChangeListener = this._defaults.onDidChange(() =>
|
this._configChangeListener = this._defaults.onDidChange(() => this._stopWorker());
|
||||||
this._stopWorker()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _stopWorker(): void {
|
private _stopWorker(): void {
|
||||||
|
|
@ -66,8 +64,7 @@ export class WorkerManager {
|
||||||
createData: {
|
createData: {
|
||||||
languageSettings: this._defaults.diagnosticsOptions,
|
languageSettings: this._defaults.diagnosticsOptions,
|
||||||
languageId: this._defaults.languageId,
|
languageId: this._defaults.languageId,
|
||||||
enableSchemaRequest: this._defaults.diagnosticsOptions
|
enableSchemaRequest: this._defaults.diagnosticsOptions.enableSchemaRequest
|
||||||
.enableSchemaRequest
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
154
test/index.html
154
test/index.html
|
|
@ -11,10 +11,7 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h2>Monaco Editor JSON test page</h2>
|
<h2>Monaco Editor JSON test page</h2>
|
||||||
<div
|
<div id="container" style="width: 800px; height: 600px; border: 1px solid grey"></div>
|
||||||
id="container"
|
|
||||||
style="width: 800px; height: 600px; border: 1px solid grey"
|
|
||||||
></div>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Loading basic-languages to get the json language definition
|
// Loading basic-languages to get the json language definition
|
||||||
|
|
@ -44,82 +41,79 @@
|
||||||
'vs/basic-languages/monaco.contribution',
|
'vs/basic-languages/monaco.contribution',
|
||||||
'vs/language/json/monaco.contribution'
|
'vs/language/json/monaco.contribution'
|
||||||
], function () {
|
], function () {
|
||||||
var editor = monaco.editor.create(
|
var editor = monaco.editor.create(document.getElementById('container'), {
|
||||||
document.getElementById('container'),
|
value: [
|
||||||
{
|
'{',
|
||||||
value: [
|
' "type": "team",',
|
||||||
'{',
|
' "test": {',
|
||||||
' "type": "team",',
|
' "testPage": "tools/testing/run-tests.htm",',
|
||||||
' "test": {',
|
' "enabled": true',
|
||||||
' "testPage": "tools/testing/run-tests.htm",',
|
' },',
|
||||||
' "enabled": true',
|
' "search": {',
|
||||||
' },',
|
' "excludeFolders": [',
|
||||||
' "search": {',
|
' ".git",',
|
||||||
' "excludeFolders": [',
|
' "node_modules",',
|
||||||
' ".git",',
|
' "tools/bin",',
|
||||||
' "node_modules",',
|
' "tools/counts",',
|
||||||
' "tools/bin",',
|
' "tools/policheck",',
|
||||||
' "tools/counts",',
|
' "tools/tfs_build_extensions",',
|
||||||
' "tools/policheck",',
|
' "tools/testing/jscoverage",',
|
||||||
' "tools/tfs_build_extensions",',
|
' "tools/testing/qunit",',
|
||||||
' "tools/testing/jscoverage",',
|
' "tools/testing/chutzpah",',
|
||||||
' "tools/testing/qunit",',
|
' "server.net"',
|
||||||
' "tools/testing/chutzpah",',
|
' ]',
|
||||||
' "server.net"',
|
' },',
|
||||||
' ]',
|
' "languages": {',
|
||||||
' },',
|
' "vs.languages.typescript": {',
|
||||||
' "languages": {',
|
' "validationSettings": [{',
|
||||||
' "vs.languages.typescript": {',
|
' "scope":"/",',
|
||||||
' "validationSettings": [{',
|
' "noImplicitAny":true,',
|
||||||
' "scope":"/",',
|
' "noLib":false,',
|
||||||
' "noImplicitAny":true,',
|
' "extraLibs":[],',
|
||||||
' "noLib":false,',
|
' "semanticValidation":true,',
|
||||||
' "extraLibs":[],',
|
' "syntaxValidation":true,',
|
||||||
' "semanticValidation":true,',
|
' "codeGenTarget":"ES5",',
|
||||||
' "syntaxValidation":true,',
|
' "moduleGenTarget":"",',
|
||||||
' "codeGenTarget":"ES5",',
|
' "lint": {',
|
||||||
' "moduleGenTarget":"",',
|
' "emptyBlocksWithoutComment": "warning",',
|
||||||
' "lint": {',
|
' "curlyBracketsMustNotBeOmitted": "warning",',
|
||||||
' "emptyBlocksWithoutComment": "warning",',
|
' "comparisonOperatorsNotStrict": "warning",',
|
||||||
' "curlyBracketsMustNotBeOmitted": "warning",',
|
' "missingSemicolon": "warning",',
|
||||||
' "comparisonOperatorsNotStrict": "warning",',
|
' "unknownTypeOfResults": "warning",',
|
||||||
' "missingSemicolon": "warning",',
|
' "semicolonsInsteadOfBlocks": "warning",',
|
||||||
' "unknownTypeOfResults": "warning",',
|
' "functionsInsideLoops": "warning",',
|
||||||
' "semicolonsInsteadOfBlocks": "warning",',
|
' "functionsWithoutReturnType": "warning",',
|
||||||
' "functionsInsideLoops": "warning",',
|
' "tripleSlashReferenceAlike": "warning",',
|
||||||
' "functionsWithoutReturnType": "warning",',
|
' "unusedImports": "warning",',
|
||||||
' "tripleSlashReferenceAlike": "warning",',
|
' "unusedVariables": "warning",',
|
||||||
' "unusedImports": "warning",',
|
' "unusedFunctions": "warning",',
|
||||||
' "unusedVariables": "warning",',
|
' "unusedMembers": "warning"',
|
||||||
' "unusedFunctions": "warning",',
|
' }',
|
||||||
' "unusedMembers": "warning"',
|
' },',
|
||||||
' }',
|
' {',
|
||||||
' },',
|
' "scope":"/client",',
|
||||||
' {',
|
' "baseUrl":"/client",',
|
||||||
' "scope":"/client",',
|
' "moduleGenTarget":"amd"',
|
||||||
' "baseUrl":"/client",',
|
' },',
|
||||||
' "moduleGenTarget":"amd"',
|
' {',
|
||||||
' },',
|
' "scope":"/server",',
|
||||||
' {',
|
' "moduleGenTarget":"commonjs"',
|
||||||
' "scope":"/server",',
|
' },',
|
||||||
' "moduleGenTarget":"commonjs"',
|
' {',
|
||||||
' },',
|
' "scope":"/build",',
|
||||||
' {',
|
' "moduleGenTarget":"commonjs"',
|
||||||
' "scope":"/build",',
|
' },',
|
||||||
' "moduleGenTarget":"commonjs"',
|
' {',
|
||||||
' },',
|
' "scope":"/node_modules/nake",',
|
||||||
' {',
|
' "moduleGenTarget":"commonjs"',
|
||||||
' "scope":"/node_modules/nake",',
|
' }],',
|
||||||
' "moduleGenTarget":"commonjs"',
|
' "allowMultipleWorkers": true',
|
||||||
' }],',
|
' }',
|
||||||
' "allowMultipleWorkers": true',
|
' }',
|
||||||
' }',
|
'}'
|
||||||
' }',
|
].join('\n'),
|
||||||
'}'
|
language: 'json'
|
||||||
].join('\n'),
|
});
|
||||||
language: 'json'
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue