Skip to content

Commit e8cb017

Browse files
committed
Register mkdtemp command
1 parent 1dd16ab commit e8cb017

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/vs/workbench/contrib/files/electron-browser/files.contribution.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileE
1010
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
1111
import { IEditorRegistry, EditorDescriptor, Extensions as EditorExtensions } from 'vs/workbench/browser/editor';
1212
import { NativeTextFileEditor } from 'vs/workbench/contrib/files/electron-browser/textFileEditor';
13+
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
14+
import * as os from 'os';
15+
import * as fs from 'fs';
16+
import * as path from 'path';
1317

1418
// Register file editor
1519
Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
@@ -22,3 +26,8 @@ Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
2226
new SyncDescriptor<EditorInput>(FileEditorInput)
2327
]
2428
);
29+
30+
// Register mkdtemp command
31+
CommandsRegistry.registerCommand('mkdtemp', function () {
32+
return fs.promises.mkdtemp(path.join(os.tmpdir(), 'vscodetmp-'));
33+
});

0 commit comments

Comments
 (0)