mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
Recent devcontainer display string corrupted on Get Started page (#183740)
This commit is contained in:
parent
26ee556939
commit
b53fb02d7f
|
@ -436,9 +436,21 @@ export function unmnemonicLabel(label: string): string {
|
|||
}
|
||||
|
||||
/**
|
||||
* Splits a path in name and parent path, supporting both '/' and '\'
|
||||
* Splits a recent label in name and parent path, supporting both '/' and '\' and workspace suffixes
|
||||
*/
|
||||
export function splitName(fullPath: string): { name: string; parentPath: string } {
|
||||
export function splitRecentLabel(recentLabel: string) {
|
||||
if (recentLabel.endsWith(']')) {
|
||||
// label with workspace suffix
|
||||
const lastIndexOfSquareBracket = recentLabel.lastIndexOf(' [', recentLabel.length - 2);
|
||||
if (lastIndexOfSquareBracket !== -1) {
|
||||
const split = splitName(recentLabel.substring(0, lastIndexOfSquareBracket));
|
||||
return { name: split.name, parentPath: split.parentPath + recentLabel.substring(lastIndexOfSquareBracket) };
|
||||
}
|
||||
}
|
||||
return splitName(recentLabel);
|
||||
}
|
||||
|
||||
function splitName(fullPath: string): { name: string; parentPath: string } {
|
||||
const p = fullPath.indexOf('/') !== -1 ? posix : win32;
|
||||
const name = p.basename(fullPath);
|
||||
const parentPath = p.dirname(fullPath);
|
||||
|
|
|
@ -7,7 +7,7 @@ import { app, JumpListCategory, JumpListItem } from 'electron';
|
|||
import { coalesce } from 'vs/base/common/arrays';
|
||||
import { ThrottledDelayer } from 'vs/base/common/async';
|
||||
import { Emitter, Event as CommonEvent } from 'vs/base/common/event';
|
||||
import { normalizeDriveLetter, splitName } from 'vs/base/common/labels';
|
||||
import { normalizeDriveLetter, splitRecentLabel } from 'vs/base/common/labels';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { isMacintosh, isWindows } from 'vs/base/common/platform';
|
||||
|
@ -390,7 +390,7 @@ export class WorkspacesHistoryMainService extends Disposable implements IWorkspa
|
|||
|
||||
// Prefer recent label
|
||||
if (recentLabel) {
|
||||
return { title: splitName(recentLabel).name, description: recentLabel };
|
||||
return { title: splitRecentLabel(recentLabel).name, description: recentLabel };
|
||||
}
|
||||
|
||||
// Single Folder
|
||||
|
|
|
@ -22,7 +22,7 @@ import { IRecent, isRecentFolder, isRecentWorkspace, IWorkspacesService } from '
|
|||
import { URI } from 'vs/base/common/uri';
|
||||
import { getIconClasses } from 'vs/editor/common/services/getIconClasses';
|
||||
import { FileKind } from 'vs/platform/files/common/files';
|
||||
import { splitName } from 'vs/base/common/labels';
|
||||
import { splitRecentLabel } from 'vs/base/common/labels';
|
||||
import { isMacintosh, isWeb, isWindows } from 'vs/base/common/platform';
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { inQuickPickContext, getQuickNavigateHandler } from 'vs/workbench/browser/quickaccess';
|
||||
|
@ -214,7 +214,7 @@ abstract class BaseOpenRecentAction extends Action2 {
|
|||
fullLabel = recent.label || labelService.getUriLabel(resource);
|
||||
}
|
||||
|
||||
const { name, parentPath } = splitName(fullLabel);
|
||||
const { name, parentPath } = splitRecentLabel(fullLabel);
|
||||
|
||||
return {
|
||||
iconClasses,
|
||||
|
|
|
@ -31,7 +31,7 @@ import { IRecentFolder, IRecentlyOpened, IRecentWorkspace, isRecentFolder, isRec
|
|||
import { IWorkspaceContextService, UNKNOWN_EMPTY_WINDOW_WORKSPACE } from 'vs/platform/workspace/common/workspace';
|
||||
import { ILabelService, Verbosity } from 'vs/platform/label/common/label';
|
||||
import { IWindowOpenable } from 'vs/platform/window/common/window';
|
||||
import { splitName } from 'vs/base/common/labels';
|
||||
import { splitRecentLabel } from 'vs/base/common/labels';
|
||||
import { IHostService } from 'vs/workbench/services/host/browser/host';
|
||||
import { isMacintosh } from 'vs/base/common/platform';
|
||||
import { Delayer, Throttler } from 'vs/base/common/async';
|
||||
|
@ -883,7 +883,7 @@ export class GettingStartedPage extends EditorPane {
|
|||
windowOpenable = { workspaceUri: recent.workspace.configPath };
|
||||
}
|
||||
|
||||
const { name, parentPath } = splitName(fullPath);
|
||||
const { name, parentPath } = splitRecentLabel(fullPath);
|
||||
|
||||
const li = $('li');
|
||||
const link = $('button.button-link');
|
||||
|
|
|
@ -34,7 +34,6 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
|
|||
import { IMarkdownString, MarkdownString } from 'vs/base/common/htmlContent';
|
||||
import { STATUS_BAR_PROMINENT_ITEM_BACKGROUND, STATUS_BAR_PROMINENT_ITEM_FOREGROUND } from 'vs/workbench/common/theme';
|
||||
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
|
||||
import { splitName } from 'vs/base/common/labels';
|
||||
import { IHostService } from 'vs/workbench/services/host/browser/host';
|
||||
import { IBannerItem, IBannerService } from 'vs/workbench/services/banner/browser/bannerService';
|
||||
import { isVirtualWorkspace } from 'vs/platform/workspace/common/virtualWorkspace';
|
||||
|
@ -48,6 +47,7 @@ import { MANAGE_TRUST_COMMAND_ID, WorkspaceTrustContext } from 'vs/workbench/con
|
|||
import { isWeb } from 'vs/base/common/platform';
|
||||
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
|
||||
import { securityConfigurationNodeBase } from 'vs/workbench/common/configuration';
|
||||
import { basename, dirname as uriDirname } from 'vs/base/common/resources';
|
||||
|
||||
const BANNER_RESTRICTED_MODE = 'workbench.banner.restrictedMode';
|
||||
const STARTUP_PROMPT_SHOWN_KEY = 'workspace.trust.startupPrompt.shown';
|
||||
|
@ -314,7 +314,7 @@ export class WorkspaceTrustUXHandler extends Disposable implements IWorkbenchCon
|
|||
const isSingleFolderWorkspace = isSingleFolderWorkspaceIdentifier(workspaceIdentifier);
|
||||
const isEmptyWindow = isEmptyWorkspaceIdentifier(workspaceIdentifier);
|
||||
if (this.workspaceTrustManagementService.canSetParentFolderTrust()) {
|
||||
const { name } = splitName(splitName((workspaceIdentifier as ISingleFolderWorkspaceIdentifier).uri.fsPath).parentPath);
|
||||
const name = basename(uriDirname((workspaceIdentifier as ISingleFolderWorkspaceIdentifier).uri));
|
||||
checkboxText = localize('checkboxString', "Trust the authors of all files in the parent folder '{0}'", name);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import { Codicon } from 'vs/base/common/codicons';
|
|||
import { debounce } from 'vs/base/common/decorators';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
|
||||
import { normalizeDriveLetter, splitName } from 'vs/base/common/labels';
|
||||
import { normalizeDriveLetter } from 'vs/base/common/labels';
|
||||
import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { parseLinkedText } from 'vs/base/common/linkedText';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
|
@ -58,6 +58,7 @@ import { defaultButtonStyles, defaultInputBoxStyles } from 'vs/platform/theme/br
|
|||
import { isMacintosh } from 'vs/base/common/platform';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { ResolvedKeybinding } from 'vs/base/common/keybindings';
|
||||
import { basename, dirname } from 'vs/base/common/resources';
|
||||
|
||||
export const shieldIcon = registerIcon('workspace-trust-banner', Codicon.shield, localize('shieldIcon', 'Icon for workspace trust ion the banner.'));
|
||||
|
||||
|
@ -1041,7 +1042,7 @@ export class WorkspaceTrustEditor extends EditorPane {
|
|||
|
||||
if (this.workspaceTrustManagementService.canSetParentFolderTrust()) {
|
||||
const workspaceIdentifier = toWorkspaceIdentifier(this.workspaceService.getWorkspace()) as ISingleFolderWorkspaceIdentifier;
|
||||
const { name } = splitName(splitName(workspaceIdentifier.uri.fsPath).parentPath);
|
||||
const name = basename(dirname(workspaceIdentifier.uri));
|
||||
|
||||
const trustMessageElement = append(parent, $('.trust-message-box'));
|
||||
trustMessageElement.innerText = localize('trustMessage', "Trust the authors of all files in the current folder or its parent '{0}'.", name);
|
||||
|
|
Loading…
Reference in a new issue