Opening recent from macOS dock creates a duplicate workspace (fix #208321) (#208372)

This commit is contained in:
Benjamin Pasero 2024-03-22 08:42:50 +01:00 committed by GitHub
parent 16997b315c
commit 1e38af3424
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -120,6 +120,7 @@ import { NODE_REMOTE_RESOURCE_CHANNEL_NAME, NODE_REMOTE_RESOURCE_IPC_METHOD_NAME
import { Lazy } from 'vs/base/common/lazy';
import { IAuxiliaryWindowsMainService } from 'vs/platform/auxiliaryWindow/electron-main/auxiliaryWindows';
import { AuxiliaryWindowsMainService } from 'vs/platform/auxiliaryWindow/electron-main/auxiliaryWindowsMainService';
import { normalizeNFC } from 'vs/base/common/normalization';
/**
* The main VS Code application. There will only ever be one instance,
@ -435,6 +436,8 @@ export class CodeApplication extends Disposable {
let macOpenFileURIs: IWindowOpenable[] = [];
let runningTimeout: NodeJS.Timeout | undefined = undefined;
app.on('open-file', (event, path) => {
path = normalizeNFC(path); // macOS only: normalize paths to NFC form
this.logService.trace('app#open-file: ', path);
event.preventDefault();
@ -1336,7 +1339,11 @@ export class CodeApplication extends Disposable {
return windowsMainService.open({
context: OpenContext.DOCK,
cli: args,
urisToOpen: macOpenFiles.map(path => (hasWorkspaceFileExtension(path) ? { workspaceUri: URI.file(path) } : { fileUri: URI.file(path) })),
urisToOpen: macOpenFiles.map(path => {
path = normalizeNFC(path); // macOS only: normalize paths to NFC form
return (hasWorkspaceFileExtension(path) ? { workspaceUri: URI.file(path) } : { fileUri: URI.file(path) });
}),
noRecentEntry,
waitMarkerFileURI,
initialStartup: true,