Prettier 2.0 (#393)

This commit is contained in:
Steve Faulkner
2021-01-20 09:15:01 -06:00
committed by GitHub
parent c1937ca464
commit 4be53284b5
500 changed files with 41927 additions and 41838 deletions

View File

@@ -1,63 +1,63 @@
import { JsonEditorParams, JsonEditorViewModel } from "../JsonEditor/JsonEditorComponent";
import template from "./editor-component.html";
import * as monaco from "monaco-editor";
import { SqlCompletionItemProvider, ErrorMarkProvider } from "@azure/cosmos-language-service";
/**
* Helper class for ko component registration
*/
export class EditorComponent {
constructor() {
return {
viewModel: EditorViewModel,
template
};
}
}
/**
* Parameters for this component
*/
export interface EditorParams extends JsonEditorParams {
contentType: string;
}
/**
* This is a generic editor component that builds on top of the pre-existing JsonEditorComponent.
*/
// TODO: Ideally, JsonEditorViewModel should extend EditorViewModel and not the other way around
class EditorViewModel extends JsonEditorViewModel {
public params: EditorParams;
private static providerRegistered: string[] = [];
public constructor(params: EditorParams) {
super(params);
this.params = params;
super.createEditor.bind(this);
/**
* setTimeout is needed as creating the edtior manipulates the dom directly and expects
* Knockout to have completed all of the initial bindings for the component
*/
this.params.content() != null &&
setTimeout(() => {
this.createEditor(this.params.content(), this.configureEditor.bind(this));
});
}
protected getEditorLanguage(): string {
return this.params.contentType;
}
protected registerCompletionItemProvider() {
let sqlCompletionItemProvider = new SqlCompletionItemProvider();
if (EditorViewModel.providerRegistered.indexOf("sql") < 0) {
monaco.languages.registerCompletionItemProvider("sql", sqlCompletionItemProvider);
EditorViewModel.providerRegistered.push("sql");
}
}
protected getErrorMarkers(input: string): Q.Promise<monaco.editor.IMarkerData[]> {
return ErrorMarkProvider.getErrorMark(input);
}
}
import { JsonEditorParams, JsonEditorViewModel } from "../JsonEditor/JsonEditorComponent";
import template from "./editor-component.html";
import * as monaco from "monaco-editor";
import { SqlCompletionItemProvider, ErrorMarkProvider } from "@azure/cosmos-language-service";
/**
* Helper class for ko component registration
*/
export class EditorComponent {
constructor() {
return {
viewModel: EditorViewModel,
template,
};
}
}
/**
* Parameters for this component
*/
export interface EditorParams extends JsonEditorParams {
contentType: string;
}
/**
* This is a generic editor component that builds on top of the pre-existing JsonEditorComponent.
*/
// TODO: Ideally, JsonEditorViewModel should extend EditorViewModel and not the other way around
class EditorViewModel extends JsonEditorViewModel {
public params: EditorParams;
private static providerRegistered: string[] = [];
public constructor(params: EditorParams) {
super(params);
this.params = params;
super.createEditor.bind(this);
/**
* setTimeout is needed as creating the edtior manipulates the dom directly and expects
* Knockout to have completed all of the initial bindings for the component
*/
this.params.content() != null &&
setTimeout(() => {
this.createEditor(this.params.content(), this.configureEditor.bind(this));
});
}
protected getEditorLanguage(): string {
return this.params.contentType;
}
protected registerCompletionItemProvider() {
let sqlCompletionItemProvider = new SqlCompletionItemProvider();
if (EditorViewModel.providerRegistered.indexOf("sql") < 0) {
monaco.languages.registerCompletionItemProvider("sql", sqlCompletionItemProvider);
EditorViewModel.providerRegistered.push("sql");
}
}
protected getErrorMarkers(input: string): Q.Promise<monaco.editor.IMarkerData[]> {
return ErrorMarkProvider.getErrorMark(input);
}
}

View File

@@ -70,7 +70,7 @@ export class EditorReact extends React.Component<EditorReactProps> {
fontSize: 12,
ariaLabel: this.props.ariaLabel,
theme: this.props.theme,
automaticLayout: true
automaticLayout: true,
};
this.rootNode.innerHTML = "";