Skip to content

Commit da36e0e

Browse files
authored
Disable url smart paste in autolinks (microsoft#204673)
Fixes microsoft#188859
1 parent 2eb6682 commit da36e0e

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

extensions/markdown-language-features/src/languageFeatures/copyFiles/pasteUrlProvider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ const smartPasteLineRegexes = [
8989
{ regex: /\$\$[\s\S]*?\$\$/gm }, // In a fenced math block
9090
{ regex: /`[^`]*`/g }, // In inline code
9191
{ regex: /\$[^$]*\$/g }, // In inline math
92+
{ regex: /<[^<>\s]*>/g }, // Autolink
9293
{ regex: /^[ ]{0,3}\[\w+\]:\s.*$/g, isWholeLine: true }, // Block link definition (needed as tokens are not generated for these)
9394
];
9495

extensions/markdown-language-features/src/test/pasteUrl.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,5 +300,11 @@ suite('createEditAddingLinksForUriList', () => {
300300
await shouldInsertMarkdownLinkByDefault(createNewMarkdownEngine(), makeTestDoc(' \r\n\r\n'), PasteUrlAsMarkdownLink.SmartWithSelection, [new vscode.Range(0, 0, 0, 7)], noopToken),
301301
false);
302302
});
303+
304+
test('Smart should be disabled inside of autolinks', async () => {
305+
assert.strictEqual(
306+
await shouldInsertMarkdownLinkByDefault(createNewMarkdownEngine(), makeTestDoc('<>'), PasteUrlAsMarkdownLink.Smart, [new vscode.Range(0, 1, 0, 1)], noopToken),
307+
false);
308+
});
303309
});
304310
});

0 commit comments

Comments
 (0)