From 50948cc523983471666314714914927fdbf7a281 Mon Sep 17 00:00:00 2001 From: Amrita kumari mishra Date: Fri, 3 Apr 2026 11:58:49 +0000 Subject: [PATCH 1/2] Reduce excessive whitespace in large Javadoc hover documentation --- src/extension.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index b7c221562..7bc0f7a88 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -120,11 +120,19 @@ const REPLACE_JDT_LINKS_PATTERN: RegExp = /(\[(?:[^\]])+\]\()(jdt:\/\/(?:(?:(?:\ * @returns the documentation with fixed links */ export function fixJdtLinksInDocumentation(oldDocumentation: MarkdownString): MarkdownString { - const newContent: string = oldDocumentation.value.replace(REPLACE_JDT_LINKS_PATTERN, (_substring, group1, group2) => { + let content: string = oldDocumentation.value.replace(REPLACE_JDT_LINKS_PATTERN, (_substring, group1, group2) => { const uri = `command:${Commands.OPEN_FILE}?${encodeURI(JSON.stringify([encodeURIComponent(group2)]))}`; return `${group1}${uri})`; }); - const mdString = new MarkdownString(newContent); + + // Normalize excessive whitespace in large Javadoc content to help + // large hovers render more completely within VS Code's limits. + content = content + .replace(/[ \t]{2,}/g, ' ') // Collapse multiple spaces/tabs to a single space + .replace(/\n{3,}/g, '\n\n') // Collapse 3 or more newlines to exactly 2 + .trim(); + + const mdString = new MarkdownString(content); mdString.isTrusted = true; return mdString; } From d1bc566f1680c3bf017b0bda2c31bb06b8a36a25 Mon Sep 17 00:00:00 2001 From: Amrita kumari mishra Date: Fri, 3 Apr 2026 12:06:45 +0000 Subject: [PATCH 2/2] Fix lint issue in Javadoc hover whitespace normalization --- src/extension.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 7bc0f7a88..90a0900f4 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -125,8 +125,8 @@ export function fixJdtLinksInDocumentation(oldDocumentation: MarkdownString): Ma return `${group1}${uri})`; }); - // Normalize excessive whitespace in large Javadoc content to help - // large hovers render more completely within VS Code's limits. + // Normalize excessive whitespace in large Javadoc content + // so large hover popups render more compactly. content = content .replace(/[ \t]{2,}/g, ' ') // Collapse multiple spaces/tabs to a single space .replace(/\n{3,}/g, '\n\n') // Collapse 3 or more newlines to exactly 2