Skip to content

Commit 89bc8d2

Browse files
committed
Open a separate window with the log
1 parent 7077968 commit 89bc8d2

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

src/vs/workbench/contrib/codeEditor/electron-browser/startDebugTextMate.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { generateUuid } from 'vs/base/common/uuid';
2121
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
2222
import { ITextModel } from 'vs/editor/common/model';
2323
import { Constants } from 'vs/base/common/uint';
24+
import { IHostService } from 'vs/workbench/services/host/browser/host';
2425

2526
class StartDebugTextMate extends Action {
2627

@@ -35,7 +36,8 @@ class StartDebugTextMate extends Action {
3536
@ITextMateService private readonly _textMateService: ITextMateService,
3637
@IModelService private readonly _modelService: IModelService,
3738
@IEditorService private readonly _editorService: IEditorService,
38-
@ICodeEditorService private readonly _codeEditorService: ICodeEditorService
39+
@ICodeEditorService private readonly _codeEditorService: ICodeEditorService,
40+
@IHostService private readonly _hostService: IHostService
3941
) {
4042
super(id, label);
4143
}
@@ -60,10 +62,13 @@ class StartDebugTextMate extends Action {
6062
const pathInTemp = path.join(os.tmpdir(), `vcode-tm-log-${generateUuid()}.txt`);
6163
const logger = createRotatingLogger(`tm-log`, pathInTemp, 1024 * 1024 * 30, 1);
6264
const model = this._getOrCreateModel();
63-
this._append(model, [
64-
`// Open the file you want to test to the side and watch here`,
65-
`// Output mirrored at ${pathInTemp}`
66-
].join('\n'));
65+
const append = (str: string) => {
66+
this._append(model, str + '\n');
67+
scrollEditor();
68+
logger.info(str);
69+
logger.flush();
70+
};
71+
await this._hostService.openWindow([{ fileUri: URI.file(pathInTemp) }], { forceNewWindow: true });
6772
const textEditorPane = await this._editorService.openEditor({
6873
resource: model.uri
6974
});
@@ -80,6 +85,10 @@ class StartDebugTextMate extends Action {
8085
}
8186
}
8287
};
88+
89+
append(`// Open the file you want to test to the side and watch here`);
90+
append(`// Output mirrored at ${pathInTemp}`);
91+
8392
this._textMateService.startDebugMode(
8493
(str) => {
8594
this._append(model, str + '\n');

0 commit comments

Comments
 (0)