mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
Error on rename in bare file links in definition
This commit is contained in:
parent
114b340f7a
commit
ca267e3f5e
|
@ -53,7 +53,10 @@ export class MdRenameProvider extends Disposable implements vscode.RenameProvide
|
|||
if (triggerRef.link.refRange.contains(position)) {
|
||||
return triggerRef.link.refRange;
|
||||
} else {
|
||||
return triggerRef.link.sourceHrefRange;
|
||||
if (triggerRef.fragmentLocation) {
|
||||
return triggerRef.fragmentLocation.range;
|
||||
}
|
||||
throw new Error(localize('renameNoFiles', "Renaming files is currently not supported"));
|
||||
}
|
||||
} else {
|
||||
if (triggerRef.fragmentLocation) {
|
||||
|
|
|
@ -302,7 +302,7 @@ suite('markdown: rename', () => {
|
|||
await assert.rejects(getRenameRange(doc, new vscode.Position(1, 2), new InMemoryWorkspaceMarkdownDocuments([doc])));
|
||||
});
|
||||
|
||||
test('Rename should not be supported on bare file references', async () => {
|
||||
test('Rename should not be supported on bare file link', async () => {
|
||||
const uri = workspacePath('doc.md');
|
||||
const doc = new InMemoryDocument(uri, joinLines(
|
||||
`[text](./doc.md)`,
|
||||
|
@ -311,4 +311,14 @@ suite('markdown: rename', () => {
|
|||
|
||||
await assert.rejects(getRenameRange(doc, new vscode.Position(0, 10), new InMemoryWorkspaceMarkdownDocuments([doc])));
|
||||
});
|
||||
|
||||
test('Rename should not be supported on bare file link in definition', async () => {
|
||||
const uri = workspacePath('doc.md');
|
||||
const doc = new InMemoryDocument(uri, joinLines(
|
||||
`[text](./doc.md)`,
|
||||
`[ref]: ./doc.md`,
|
||||
));
|
||||
|
||||
await assert.rejects(getRenameRange(doc, new vscode.Position(1, 10), new InMemoryWorkspaceMarkdownDocuments([doc])));
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue