From c3bb7a66e00246adbd16f071f20cf59a96bce559 Mon Sep 17 00:00:00 2001 From: Shafiq Ur Rahman Date: Fri, 20 Sep 2019 16:00:36 -0700 Subject: [PATCH] Show more of the url (closes #6348) (#7299) --- .../extensions/common/extensionUrlHandler.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/services/extensions/common/extensionUrlHandler.ts b/src/vs/workbench/services/extensions/common/extensionUrlHandler.ts index d4569143b8..f2c54678e6 100644 --- a/src/vs/workbench/services/extensions/common/extensionUrlHandler.ts +++ b/src/vs/workbench/services/extensions/common/extensionUrlHandler.ts @@ -108,9 +108,17 @@ class ExtensionUrlHandler implements IExtensionUrlHandler, IURLHandler { if (!confirmed) { let uriString = uri.toString(); - if (uriString.length > 40) { - uriString = `${uriString.substring(0, 30)}...${uriString.substring(uriString.length - 5)}`; + // {{SQL CARBON EDIT}} - Begin + // Dialog service starts truncating words longer than 80 characters and adds ellipses to it. + // To show more of the URL, we can show about 80 characters in the beginning and 80 in the end, with ellipses in between. + if (uriString.length > 80) { + // Split the URL half way in the middle or max out at 80. Add a fudge factor of 5 so that we never show the full string if we split exactly in the middle. + let truncLength = Math.min(uriString.length / 2, 80) - 5; + + // There needs to be whitespace before/after the ellipses so that the URL does not look like one long word. + uriString = `${uriString.substring(0, truncLength)} ... ${uriString.substring(uriString.length - truncLength)}`; } + // {{SQL CARBON EDIT}} - End const result = await this.dialogService.confirm({ message: localize('confirmUrl', "Allow an extension to open this URI?", extensionId),