mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
add resolveLink and allow incomplete DocumentLink
This commit is contained in:
@@ -322,12 +322,12 @@ export namespace DocumentLink {
|
||||
export function from(link: types.DocumentLink): modes.ILink {
|
||||
return {
|
||||
range: fromRange(link.range),
|
||||
url: link.target.toString()
|
||||
url: link.target && link.target.toString()
|
||||
};
|
||||
}
|
||||
|
||||
export function to(link: modes.ILink):types.DocumentLink {
|
||||
return new types.DocumentLink(toRange(link.range), URI.parse(link.url));
|
||||
return new types.DocumentLink(toRange(link.range), link.url && URI.parse(link.url));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -836,7 +836,7 @@ export class DocumentLink {
|
||||
target: URI;
|
||||
|
||||
constructor(range: Range, target: URI) {
|
||||
if (!(target instanceof URI)) {
|
||||
if (target && !(target instanceof URI)) {
|
||||
throw illegalArgument('target');
|
||||
}
|
||||
if (!Range.isRange(range) || range.isEmpty) {
|
||||
|
||||
Reference in New Issue
Block a user