Repository: microsoft/vscode (TypeScript) — Bug Fix

Issue:
Link parsing stoped where comments include a single quote 
<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- 🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions -->
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
<!-- 🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/ -->
<!-- 💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. -->
<!-- 🔧 Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: Yes

<!-- 🪓 If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. -->
<!-- 📣 Issues caused by an extension need to be reported directly to the extension publisher. The 'Help > Report Issue' dialog can assist with this. -->
- VS Code Version: 1.67.2
- OS Version:  Darwin x64 18.2.0

Steps to Reproduce:

1. Copy this link(`https://regexper.com/#%2F''%2F`).
2. Paste it in any language's comment.

It would been parsed as `https://regexper.com/#%2F`.



Discussion:
I can verify the reported behavior, but don't know what is correct to do.

Resolving patch:
diff --git a/src/vs/editor/common/languages/linkComputer.ts b/src/vs/editor/common/languages/linkComputer.ts
--- a/src/vs/editor/common/languages/linkComputer.ts
+++ b/src/vs/editor/common/languages/linkComputer.ts
@@ -258,15 +258,15 @@ export class LinkComputer {
 						case CharCode.CloseCurlyBrace:
 							chClass = (hasOpenCurlyBracket ? CharacterClass.None : CharacterClass.ForceTermination);
 							break;
-						/* The following three rules make it that ' or " or ` are allowed inside links if the link began with a different one */
+						/* The following three rules make it that ' or " or ` are allowed inside links if the link didn't begin with them */
 						case CharCode.SingleQuote:
-							chClass = (linkBeginChCode === CharCode.DoubleQuote || linkBeginChCode === CharCode.BackTick) ? CharacterClass.None : CharacterClass.ForceTermination;
+							chClass = (linkBeginChCode === CharCode.SingleQuote ? CharacterClass.ForceTermination : CharacterClass.None);
 							break;
 						case CharCode.DoubleQuote:
-							chClass = (linkBeginChCode === CharCode.SingleQuote || linkBeginChCode === CharCode.BackTick) ? CharacterClass.None : CharacterClass.ForceTermination;
+							chClass = (linkBeginChCode === CharCode.DoubleQuote ? CharacterClass.ForceTermination : CharacterClass.None);
 							break;
 						case CharCode.BackTick:
-							chClass = (linkBeginChCode === CharCode.SingleQuote || linkBeginChCode === CharCode.DoubleQuote) ? CharacterClass.None : CharacterClass.ForceTermination;
+							chClass = (linkBeginChCode === CharCode.BackTick ? CharacterClass.ForceTermination : CharacterClass.None);
 							break;
 						case CharCode.Asterisk:
 							// `*` terminates a link if the link began with `*`


Test patch:
diff --git a/src/vs/editor/test/common/modes/linkComputer.test.ts b/src/vs/editor/test/common/modes/linkComputer.test.ts
--- a/src/vs/editor/test/common/modes/linkComputer.test.ts
+++ b/src/vs/editor/test/common/modes/linkComputer.test.ts
@@ -258,4 +258,11 @@ suite('Editor Modes - Link Computer', () => {
 			'https://site.web/page.html                '
 		);
 	});
+
+	test('issue #151631: Link parsing stoped where comments include a single quote ', () => {
+		assertLink(
+			`aa https://regexper.com/#%2F''%2F aa`,
+			`   https://regexper.com/#%2F''%2F   `,
+		);
+	});
 });