mirror of
https://github.com/Microsoft/vscode
synced 2024-10-06 03:17:00 +00:00
Update coffee grammar tests
This commit is contained in:
parent
0d0d32f33e
commit
c1906c79af
|
@ -399,33 +399,33 @@
|
|||
"c": "#{",
|
||||
"t": "source.coffee string.regexp.coffee source.coffee.embedded.source punctuation.section.embedded.coffee",
|
||||
"r": {
|
||||
"dark_plus": "string.regexp: #D16969",
|
||||
"light_plus": "string.regexp: #811F3F",
|
||||
"dark_vs": "string.regexp: #D16969",
|
||||
"light_vs": "string.regexp: #811F3F",
|
||||
"hc_black": "string.regexp: #D16969"
|
||||
"dark_plus": "punctuation.section.embedded.coffee: #569CD6",
|
||||
"light_plus": "punctuation.section.embedded.coffee: #0000FF",
|
||||
"dark_vs": "punctuation.section.embedded.coffee: #569CD6",
|
||||
"light_vs": "punctuation.section.embedded.coffee: #0000FF",
|
||||
"hc_black": "punctuation.section.embedded.coffee: #569CD6"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "name",
|
||||
"t": "source.coffee string.regexp.coffee source.coffee.embedded.source",
|
||||
"r": {
|
||||
"dark_plus": "string.regexp: #D16969",
|
||||
"light_plus": "string.regexp: #811F3F",
|
||||
"dark_vs": "string.regexp: #D16969",
|
||||
"light_vs": "string.regexp: #811F3F",
|
||||
"hc_black": "string.regexp: #D16969"
|
||||
"dark_plus": "source.coffee.embedded: #9CDCFE",
|
||||
"light_plus": "source.coffee.embedded: #FF0000",
|
||||
"dark_vs": "source.coffee.embedded: #9CDCFE",
|
||||
"light_vs": "source.coffee.embedded: #FF0000",
|
||||
"hc_black": "source.coffee.embedded: #D4D4D4"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "}",
|
||||
"t": "source.coffee string.regexp.coffee source.coffee.embedded.source punctuation.section.embedded.coffee",
|
||||
"r": {
|
||||
"dark_plus": "string.regexp: #D16969",
|
||||
"light_plus": "string.regexp: #811F3F",
|
||||
"dark_vs": "string.regexp: #D16969",
|
||||
"light_vs": "string.regexp: #811F3F",
|
||||
"hc_black": "string.regexp: #D16969"
|
||||
"dark_plus": "punctuation.section.embedded.coffee: #569CD6",
|
||||
"light_plus": "punctuation.section.embedded.coffee: #0000FF",
|
||||
"dark_vs": "punctuation.section.embedded.coffee: #569CD6",
|
||||
"light_vs": "punctuation.section.embedded.coffee: #0000FF",
|
||||
"hc_black": "punctuation.section.embedded.coffee: #569CD6"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -278,11 +278,11 @@
|
|||
"c": "#{",
|
||||
"t": "source.coffee string.quoted.double.coffee source.coffee.embedded.source punctuation.section.embedded.coffee",
|
||||
"r": {
|
||||
"dark_plus": "string: #CE9178",
|
||||
"light_plus": "string: #A31515",
|
||||
"dark_vs": "string: #CE9178",
|
||||
"light_vs": "string: #A31515",
|
||||
"hc_black": "string: #CE9178"
|
||||
"dark_plus": "punctuation.section.embedded.coffee: #569CD6",
|
||||
"light_plus": "punctuation.section.embedded.coffee: #0000FF",
|
||||
"dark_vs": "punctuation.section.embedded.coffee: #569CD6",
|
||||
"light_vs": "punctuation.section.embedded.coffee: #0000FF",
|
||||
"hc_black": "punctuation.section.embedded.coffee: #569CD6"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -291,8 +291,8 @@
|
|||
"r": {
|
||||
"dark_plus": "variable: #9CDCFE",
|
||||
"light_plus": "variable: #001080",
|
||||
"dark_vs": "string: #CE9178",
|
||||
"light_vs": "string: #A31515",
|
||||
"dark_vs": "source.coffee.embedded: #9CDCFE",
|
||||
"light_vs": "source.coffee.embedded: #FF0000",
|
||||
"hc_black": "variable: #9CDCFE"
|
||||
}
|
||||
},
|
||||
|
@ -300,11 +300,11 @@
|
|||
"c": "}",
|
||||
"t": "source.coffee string.quoted.double.coffee source.coffee.embedded.source punctuation.section.embedded.coffee",
|
||||
"r": {
|
||||
"dark_plus": "string: #CE9178",
|
||||
"light_plus": "string: #A31515",
|
||||
"dark_vs": "string: #CE9178",
|
||||
"light_vs": "string: #A31515",
|
||||
"hc_black": "string: #CE9178"
|
||||
"dark_plus": "punctuation.section.embedded.coffee: #569CD6",
|
||||
"light_plus": "punctuation.section.embedded.coffee: #0000FF",
|
||||
"dark_vs": "punctuation.section.embedded.coffee: #569CD6",
|
||||
"light_vs": "punctuation.section.embedded.coffee: #0000FF",
|
||||
"hc_black": "punctuation.section.embedded.coffee: #569CD6"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -531,11 +531,11 @@
|
|||
"c": "#{",
|
||||
"t": "source.coffee string.quoted.double.coffee source.coffee.embedded.source punctuation.section.embedded.coffee",
|
||||
"r": {
|
||||
"dark_plus": "string: #CE9178",
|
||||
"light_plus": "string: #A31515",
|
||||
"dark_vs": "string: #CE9178",
|
||||
"light_vs": "string: #A31515",
|
||||
"hc_black": "string: #CE9178"
|
||||
"dark_plus": "punctuation.section.embedded.coffee: #569CD6",
|
||||
"light_plus": "punctuation.section.embedded.coffee: #0000FF",
|
||||
"dark_vs": "punctuation.section.embedded.coffee: #569CD6",
|
||||
"light_vs": "punctuation.section.embedded.coffee: #0000FF",
|
||||
"hc_black": "punctuation.section.embedded.coffee: #569CD6"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -544,8 +544,8 @@
|
|||
"r": {
|
||||
"dark_plus": "variable: #9CDCFE",
|
||||
"light_plus": "variable: #001080",
|
||||
"dark_vs": "string: #CE9178",
|
||||
"light_vs": "string: #A31515",
|
||||
"dark_vs": "source.coffee.embedded: #9CDCFE",
|
||||
"light_vs": "source.coffee.embedded: #FF0000",
|
||||
"hc_black": "variable: #9CDCFE"
|
||||
}
|
||||
},
|
||||
|
@ -553,11 +553,11 @@
|
|||
"c": "}",
|
||||
"t": "source.coffee string.quoted.double.coffee source.coffee.embedded.source punctuation.section.embedded.coffee",
|
||||
"r": {
|
||||
"dark_plus": "string: #CE9178",
|
||||
"light_plus": "string: #A31515",
|
||||
"dark_vs": "string: #CE9178",
|
||||
"light_vs": "string: #A31515",
|
||||
"hc_black": "string: #CE9178"
|
||||
"dark_plus": "punctuation.section.embedded.coffee: #569CD6",
|
||||
"light_plus": "punctuation.section.embedded.coffee: #0000FF",
|
||||
"dark_vs": "punctuation.section.embedded.coffee: #569CD6",
|
||||
"light_vs": "punctuation.section.embedded.coffee: #0000FF",
|
||||
"hc_black": "punctuation.section.embedded.coffee: #569CD6"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -10,7 +10,7 @@ import { CommandsRegistry } from 'vs/platform/commands/common/commands';
|
|||
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { Position as EditorPosition } from 'vs/platform/editor/common/editor';
|
||||
import { HtmlInput } from '../common/htmlInput';
|
||||
import { HtmlInput, HtmlInputOptions } from '../common/htmlInput';
|
||||
import { HtmlPreviewPart } from 'vs/workbench/parts/html/browser/htmlPreviewPart';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { EditorDescriptor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
|
@ -38,7 +38,7 @@ interface HtmlZoneParams {
|
|||
|
||||
let warn = true;
|
||||
|
||||
CommandsRegistry.registerCommand('_workbench.htmlZone', function (accessor: ServicesAccessor, params: HtmlZoneParams) {
|
||||
CommandsRegistry.registerCommand('_workbench.htmlZone', (accessor: ServicesAccessor, params: HtmlZoneParams) => {
|
||||
|
||||
if (warn) {
|
||||
console.warn(`'_workbench.htmlZone' is an EXPERIMENTAL feature and therefore subject to CHANGE and REMOVAL without notice.`);
|
||||
|
@ -69,10 +69,13 @@ CommandsRegistry.registerCommand('_workbench.htmlZone', function (accessor: Serv
|
|||
|
||||
HtmlZoneController.getInstance(codeEditor).addZone(params.lineNumber, contents);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
CommandsRegistry.registerCommand('_workbench.previewHtml', function (accessor: ServicesAccessor, resource: URI | string, position?: EditorPosition, label?: string) {
|
||||
const defaultOptions: HtmlInputOptions = {
|
||||
enableJavaScript: true
|
||||
};
|
||||
|
||||
CommandsRegistry.registerCommand('_workbench.previewHtml', (accessor: ServicesAccessor, resource: URI | string, position?: EditorPosition, label?: string, options: HtmlInputOptions = defaultOptions) => {
|
||||
|
||||
const uri = resource instanceof URI ? resource : URI.parse(resource);
|
||||
label = label || uri.fsPath;
|
||||
|
@ -91,7 +94,7 @@ CommandsRegistry.registerCommand('_workbench.previewHtml', function (accessor: S
|
|||
|
||||
// Otherwise, create new input and open it
|
||||
if (!input) {
|
||||
input = accessor.get(IInstantiationService).createInstance(HtmlInput, label, '', uri);
|
||||
input = accessor.get(IInstantiationService).createInstance(HtmlInput, label, '', uri, options);
|
||||
} else {
|
||||
input.setName(label); // make sure to use passed in label
|
||||
}
|
||||
|
|
|
@ -208,8 +208,11 @@ export class HtmlPreviewPart extends WebviewEditor {
|
|||
}
|
||||
|
||||
this._modelChangeSubscription = this.model.onDidChangeContent(() => {
|
||||
if (this.model) {
|
||||
if (this.model && input instanceof HtmlInput) {
|
||||
this.scrollYPercentage = 0;
|
||||
this.webview.options = {
|
||||
enableJavascript: input.options.enableJavaScript
|
||||
};
|
||||
this.webview.contents = this.model.getLinesContent();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -60,7 +60,7 @@ export default class Webview {
|
|||
constructor(
|
||||
private parent: HTMLElement,
|
||||
private _styleElement: Element,
|
||||
private options: WebviewOptions = {}
|
||||
private _options: WebviewOptions = {}
|
||||
) {
|
||||
this._webview = <any>document.createElement('webview');
|
||||
|
||||
|
@ -162,10 +162,14 @@ export default class Webview {
|
|||
this._send('initial-scroll-position', value);
|
||||
}
|
||||
|
||||
set options(options: WebviewOptions) {
|
||||
this._options = options;
|
||||
}
|
||||
|
||||
set contents(value: string[]) {
|
||||
this._send('content', {
|
||||
contents: value,
|
||||
options: this.options
|
||||
options: this._options
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,22 @@
|
|||
'use strict';
|
||||
|
||||
import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { ITextModelService } from 'vs/editor/common/services/resolverService';
|
||||
|
||||
|
||||
export interface HtmlInputOptions {
|
||||
enableJavaScript?: boolean;
|
||||
}
|
||||
|
||||
export class HtmlInput extends ResourceEditorInput {
|
||||
// marker class
|
||||
constructor(
|
||||
name: string,
|
||||
description: string,
|
||||
resource: URI,
|
||||
public readonly options: HtmlInputOptions,
|
||||
@ITextModelService textModelResolverService: ITextModelService
|
||||
) {
|
||||
super(name, description, resource, textModelResolverService);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue