提交 1b681fd9 编写于 作者: M Martin Aeschlimann

showItemInFolder with URI

上级 4159cb41
......@@ -155,7 +155,7 @@ export interface IWindowsService {
getWindows(): Promise<{ id: number; workspace?: IWorkspaceIdentifier; folderUri?: ISingleFolderWorkspaceIdentifier; title: string; filename?: string; }[]>;
getWindowCount(): Promise<number>;
log(severity: string, ...messages: string[]): Promise<void>;
showItemInFolder(path: string): Promise<void>;
showItemInFolder(path: URI): Promise<void>;
getActiveWindowId(): Promise<number | undefined>;
// This needs to be handled from browser process to prevent
......
......@@ -324,10 +324,12 @@ export class WindowsService implements IWindowsService, IURLHandler, IDisposable
console[severity].apply(console, ...messages);
}
async showItemInFolder(path: string): Promise<void> {
async showItemInFolder(path: URI): Promise<void> {
this.logService.trace('windowsService#showItemInFolder');
shell.showItemInFolder(path);
if (path.scheme === Schemas.file) {
shell.showItemInFolder(path.fsPath);
}
}
async getActiveWindowId(): Promise<number | undefined> {
......
......@@ -95,7 +95,7 @@ export class WindowsChannel implements IServerChannel {
case 'toggleSharedProcess': return this.service.toggleSharedProcess();
case 'quit': return this.service.quit();
case 'log': return this.service.log(arg[0], arg[1]);
case 'showItemInFolder': return this.service.showItemInFolder(arg);
case 'showItemInFolder': return this.service.showItemInFolder(URI.revive(arg));
case 'getActiveWindowId': return this.service.getActiveWindowId();
case 'openExternal': return this.service.openExternal(arg);
case 'startCrashReporter': return this.service.startCrashReporter(arg);
......@@ -309,7 +309,7 @@ export class WindowsChannelClient implements IWindowsService {
return this.channel.call('log', [severity, messages]);
}
showItemInFolder(path: string): Promise<void> {
showItemInFolder(path: URI): Promise<void> {
return this.channel.call('showItemInFolder', path);
}
......
......@@ -617,7 +617,7 @@ class ShowItemInFolderAction extends Action {
}
run(): Promise<void> {
return this.windowsService.showItemInFolder(this.path);
return this.windowsService.showItemInFolder(URI.file(this.path));
}
}
......
......@@ -2529,11 +2529,11 @@ export class OpenExtensionsFolderAction extends Action {
const extensionsHome = URI.file(this.environmentService.extensionsPath);
return Promise.resolve(this.fileService.resolveFile(extensionsHome)).then(file => {
let itemToShow: string;
let itemToShow: URI;
if (file.children && file.children.length > 0) {
itemToShow = file.children[0].resource.fsPath;
itemToShow = file.children[0].resource;
} else {
itemToShow = extensionsHome.fsPath;
itemToShow = extensionsHome;
}
return this.windowsService.showItemInFolder(itemToShow);
......
......@@ -57,7 +57,7 @@ export class BinaryFileEditor extends BaseBinaryResourceEditor {
private openExternal(resource: URI): void {
this.windowsService.openExternal(resource.toString()).then(didOpen => {
if (!didOpen) {
return this.windowsService.showItemInFolder(resource.fsPath);
return this.windowsService.showItemInFolder(resource);
}
return undefined;
......
......@@ -357,9 +357,9 @@ CommandsRegistry.registerCommand({
function revealResourcesInOS(resources: URI[], windowsService: IWindowsService, notificationService: INotificationService, workspaceContextService: IWorkspaceContextService): void {
if (resources.length) {
sequence(resources.map(r => () => windowsService.showItemInFolder(r.fsPath)));
sequence(resources.map(r => () => windowsService.showItemInFolder(r)));
} else if (workspaceContextService.getWorkspace().folders.length) {
windowsService.showItemInFolder(workspaceContextService.getWorkspace().folders[0].uri.fsPath);
windowsService.showItemInFolder(workspaceContextService.getWorkspace().folders[0].uri);
} else {
notificationService.info(nls.localize('openFileToReveal', "Open a file first to reveal"));
}
......
......@@ -10,6 +10,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
import { IWindowsService } from 'vs/platform/windows/common/windows';
import { ILogService, LogLevel, DEFAULT_LOG_LEVEL } from 'vs/platform/log/common/log';
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
import { URI } from 'vs/base/common/uri';
export class OpenLogsFolderAction extends Action {
......@@ -24,7 +25,7 @@ export class OpenLogsFolderAction extends Action {
}
run(): Promise<void> {
return this.windowsService.showItemInFolder(join(this.environmentService.logsPath, 'main.log'));
return this.windowsService.showItemInFolder(URI.file(join(this.environmentService.logsPath, 'main.log')));
}
}
......
......@@ -16,6 +16,7 @@ import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { PerfviewInput } from 'vs/workbench/contrib/performance/electron-browser/perfviewEditor';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { URI } from 'vs/base/common/uri';
export class StartupProfiler implements IWorkbenchContribution {
......@@ -78,7 +79,7 @@ export class StartupProfiler implements IWorkbenchContribution {
}).then(res => {
if (res.confirmed) {
Promise.all<any>([
this._windowsService.showItemInFolder(join(dir, files[0])),
this._windowsService.showItemInFolder(URI.file(join(dir, files[0]))),
this._createPerfIssue(files)
]).then(() => {
// keep window stable until restart is selected
......
......@@ -1332,7 +1332,7 @@ export class TestWindowsService implements IWindowsService {
return Promise.resolve();
}
showItemInFolder(_path: string): Promise<void> {
showItemInFolder(_path: URI): Promise<void> {
return Promise.resolve();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册