Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
execute: () => open(this.openerService, createUntitledResource().uri)
});
open(ref?: Widget): void {
const options: WidgetOpenerOptions = {
widgetOptions: ref ? { area: 'main', mode: 'split-right', ref } : { area: 'main' },
mode: 'activate'
};
open(this.opener, this.resource.uri, options);
}
previewNode(node: TreeNode): void {
if (FileNode.is(node)) {
open(this.openerService, node.uri, { mode: 'reveal', preview: true });
}
}
protected doOpenNode(node: TreeNode): void {
if (FileNode.is(node)) {
open(this.openerService, node.uri);
} else {
super.doOpenNode(node);
}
}
this.fileSystem.createFile(fileUri.toString()).then(() => {
open(this.openerService, fileUri);
});
}
if (!isOSX && this.isElectron()) {
return this.doOpenFile();
}
const [rootStat] = await this.workspaceService.roots;
const destinationUri = await this.fileDialogService.showOpenDialog({
title: WorkspaceCommands.OPEN.dialogLabel,
canSelectFolders: true,
canSelectFiles: true
}, rootStat);
if (destinationUri && this.getCurrentWorkspaceUri().toString() !== destinationUri.toString()) {
const destination = await this.fileSystem.getFileStat(destinationUri.toString());
if (destination) {
if (destination.isDirectory) {
this.workspaceService.open(destinationUri);
} else {
await open(this.openerService, destinationUri);
}
return destinationUri;
}
}
return undefined;
}
protected extensionClick = (extension: Extension) => open(this.openerService, ExtensionUri.toUri(extension.name));
protected async doOpenFile(): Promise {
const props: OpenFileDialogProps = {
title: WorkspaceCommands.OPEN_FILE.dialogLabel,
canSelectFolders: false,
canSelectFiles: true
};
const [rootStat] = await this.workspaceService.roots;
const destinationFileUri = await this.fileDialogService.showOpenDialog(props, rootStat);
if (destinationFileUri) {
const destinationFile = await this.fileSystem.getFileStat(destinationFileUri.toString());
if (destinationFile && !destinationFile.isDirectory) {
await open(this.openerService, destinationFileUri);
return destinationFileUri;
}
}
return undefined;
}
const fileStat = await this.fileSystem.getFileStat(uri);
const options: Git.Options.Diff = {
uri,
range: {
fromRevision
}
};
if (fileStat) {
if (fileStat.isDirectory) {
this.showWidget(options);
} else {
const fromURI = fileUri.withScheme(GIT_RESOURCE_SCHEME).withQuery(fromRevision);
const toURI = fileUri;
const diffUri = DiffUris.encode(fromURI, toURI);
if (diffUri) {
open(this.openerService, diffUri).catch(e => {
this.notifications.error(e.message);
});
}
}
}
}, this.repositoryProvider.findRepository(fileUri));
}