Register mkdtemp command

This commit is contained in:
Joao Moreno 2020-02-04 12:22:20 +01:00
parent 1dd16ab728
commit e8cb017371
No known key found for this signature in database
GPG key ID: 9494F5E6167A8E6B

View file

@ -10,6 +10,10 @@ import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileE
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { IEditorRegistry, EditorDescriptor, Extensions as EditorExtensions } from 'vs/workbench/browser/editor';
import { NativeTextFileEditor } from 'vs/workbench/contrib/files/electron-browser/textFileEditor';
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import * as os from 'os';
import * as fs from 'fs';
import * as path from 'path';
// Register file editor
Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
@ -22,3 +26,8 @@ Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
new SyncDescriptor<EditorInput>(FileEditorInput)
]
);
// Register mkdtemp command
CommandsRegistry.registerCommand('mkdtemp', function () {
return fs.promises.mkdtemp(path.join(os.tmpdir(), 'vscodetmp-'));
});