Disable url smart paste in autolinks (#204673)

Fixes #188859
This commit is contained in:
Matt Bierner 2024-02-07 18:01:32 -08:00 committed by GitHub
parent 2eb66826bd
commit da36e0eba1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View file

@ -89,6 +89,7 @@ const smartPasteLineRegexes = [
{ regex: /\$\$[\s\S]*?\$\$/gm }, // In a fenced math block
{ regex: /`[^`]*`/g }, // In inline code
{ regex: /\$[^$]*\$/g }, // In inline math
{ regex: /<[^<>\s]*>/g }, // Autolink
{ regex: /^[ ]{0,3}\[\w+\]:\s.*$/g, isWholeLine: true }, // Block link definition (needed as tokens are not generated for these)
];

View file

@ -300,5 +300,11 @@ suite('createEditAddingLinksForUriList', () => {
await shouldInsertMarkdownLinkByDefault(createNewMarkdownEngine(), makeTestDoc(' \r\n\r\n'), PasteUrlAsMarkdownLink.SmartWithSelection, [new vscode.Range(0, 0, 0, 7)], noopToken),
false);
});
test('Smart should be disabled inside of autolinks', async () => {
assert.strictEqual(
await shouldInsertMarkdownLinkByDefault(createNewMarkdownEngine(), makeTestDoc('<>'), PasteUrlAsMarkdownLink.Smart, [new vscode.Range(0, 1, 0, 1)], noopToken),
false);
});
});
});