Skip to content

Commit 2650568

Browse files
committed
remove another nested conditional
1 parent 1547deb commit 2650568

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/services/jsonLinks.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,20 @@ export function findLinks(document: TextDocument, doc: JSONDocument, schemaServi
4848
}
4949
doc.getMatchingSchemas(schema.schema, pathNode.offset).forEach((s) => {
5050
if (s.node !== pathNode || s.inverted || !s.schema) {
51-
return;
51+
return; // Not an _exact_ schema match.
5252
}
5353
if (s.schema.format !== 'uri-reference') {
54-
return;
54+
return; // Not a uri-ref.
5555
}
5656
const pathURI = resolveURIRef(pathNode.value, document);
57-
if (pathURI) {
58-
if (fileExistsSync(pathURI.fsPath)) {
59-
pathLinks.push({
60-
target: pathURI.toString(),
61-
range: createRange(document, pathNode)
62-
});
63-
}
57+
if (!pathURI) {
58+
return; // Unable to resolve ref.
59+
}
60+
if (fileExistsSync(pathURI.fsPath)) {
61+
pathLinks.push({
62+
target: pathURI.toString(),
63+
range: createRange(document, pathNode)
64+
});
6465
}
6566
});
6667
return pathLinks;

0 commit comments

Comments
 (0)