Skip to content

Commit b068ae3

Browse files
authored
fix(ls): point to parent of ref target in definition service (#5042)
1 parent 177e364 commit b068ae3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/apidom-ls/src/services/definition/definition-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export class DefaultDefinitionService implements DefinitionService {
133133
}
134134
// TODO (francesco.tumanischvili@smartbear.com): replace with fragment deref
135135
const refTarget = jsonPointerEvaluate<Element>(api, URIFragmentIdentifier.from(ref));
136-
const nodeSourceMap = getSourceMap(refTarget);
136+
const nodeSourceMap = getSourceMap(refTarget?.parent ?? refTarget);
137137
const range = Range.create(
138138
textDocument.positionAt(nodeSourceMap.offset),
139139
textDocument.positionAt(nodeSourceMap.endOffset || nodeSourceMap.offset + 1),

packages/apidom-ls/test/openapi-json.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ const defTestInput = [
428428
line: 54,
429429
},
430430
start: {
431-
character: 13,
431+
character: 6,
432432
line: 52,
433433
},
434434
},

0 commit comments

Comments
 (0)