MCPcopy
hub / github.com/microsoft/vscode / TestCodeEditor

Class TestCodeEditor

src/vs/editor/test/browser/testCodeEditor.ts:85–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85export class TestCodeEditor extends CodeEditorWidget implements ICodeEditor {
86
87 //#region testing overrides
88 protected override _createConfiguration(isSimpleWidget: boolean, contextMenuId: MenuId, options: Readonly<TestCodeEditorCreationOptions>): EditorConfiguration {
89 return new TestConfiguration(options);
90 }
91 protected override _createView(viewModel: ViewModel): [View, boolean] {
92 // Never create a view
93 return [null! as View, false];
94 }
95 private _hasTextFocus = false;
96 public setHasTextFocus(hasTextFocus: boolean): void {
97 this._hasTextFocus = hasTextFocus;
98 }
99 public override hasTextFocus(): boolean {
100 return this._hasTextFocus;
101 }
102 //#endregion
103
104 //#region Testing utils
105 public getViewModel(): ViewModel | undefined {
106 return this._modelData ? this._modelData.viewModel : undefined;
107 }
108 public registerAndInstantiateContribution<T extends IEditorContribution>(id: string, ctor: new (editor: ICodeEditor, ...services: BrandedService[]) => T): T {
109 const r: T = this._instantiationService.createInstance(ctor, this);
110 this._contributions.set(id, r);
111 return r;
112 }
113 public registerDisposable(disposable: IDisposable): void {
114 this._register(disposable);
115 }
116 public runCommand(command: EditorCommand, args?: any): void | Promise<void> {
117 return this._instantiationService.invokeFunction((accessor) => {
118 return command.runEditorCommand(accessor, this, args);
119 });
120 }
121 public runAction(action: ITestEditorAction, args?: any): void | Promise<void> {
122 return this._instantiationService.invokeFunction((accessor) => {
123 return action.run(accessor, this, args);
124 });
125 }
126}
127
128class TestEditorDomElement {
129 parentElement: IContextKeyServiceTarget | null = null;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…