mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 18:19:12 +01:00
@@ -139,11 +139,22 @@ suite('markdown.DocumentLinkProvider', () => {
|
||||
}
|
||||
});
|
||||
|
||||
// #107471
|
||||
test('Should not consider link references starting with ^ character valid', () => {
|
||||
test('Should not consider link references starting with ^ character valid (#107471)', () => {
|
||||
const links = getLinksForFile('[^reference]: https://example.com');
|
||||
assert.strictEqual(links.length, 0);
|
||||
});
|
||||
|
||||
test('Should find definitions links with spaces in angle brackets (#136073)', () => {
|
||||
const links = getLinksForFile([
|
||||
'[a]: <b c>',
|
||||
'[b]: <cd>',
|
||||
].join('\n'));
|
||||
assert.strictEqual(links.length, 2);
|
||||
|
||||
const [link1, link2] = links;
|
||||
assertRangeEqual(link1.range, new vscode.Range(0, 6, 0, 9));
|
||||
assertRangeEqual(link2.range, new vscode.Range(1, 6, 1, 8));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ export class InMemoryDocument implements vscode.TextDocument {
|
||||
this._lines = this._contents.split(/\r\n|\n/g);
|
||||
}
|
||||
|
||||
|
||||
isUntitled: boolean = false;
|
||||
languageId: string = '';
|
||||
isDirty: boolean = false;
|
||||
@@ -49,7 +48,7 @@ export class InMemoryDocument implements vscode.TextDocument {
|
||||
const before = this._contents.slice(0, offset);
|
||||
const newLines = before.match(/\r\n|\n/g);
|
||||
const line = newLines ? newLines.length : 0;
|
||||
const preCharacters = before.match(/(\r\n|\n|^).*$/g);
|
||||
const preCharacters = before.match(/(?<=\r\n|\n|^).*$/g);
|
||||
return new vscode.Position(line, preCharacters ? preCharacters[0].length : 0);
|
||||
}
|
||||
getText(_range?: vscode.Range | undefined): string {
|
||||
|
||||
Reference in New Issue
Block a user