Skip to content

Commit

Permalink
feat(ls): fix wrong docs links version in hover
Browse files Browse the repository at this point in the history
  • Loading branch information
frantuma committed Jul 22, 2023
1 parent 3f5f3b5 commit 78ce094
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules/
*.iml
.vscode/settings.json
isolate-*.log
.log*
17 changes: 14 additions & 3 deletions packages/apidom-ls/src/services/hover/hover-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,11 +390,22 @@ export class DefaultHoverService implements HoverService {
if (map[key]?.documentation) {
const keyDocsMeta: DocumentationMeta[] = map[key]?.documentation as DocumentationMeta[];
if (keyDocsMeta) {
const rootDoc = keyDocsMeta.find((e) => !e.target);
if (rootDoc) return rootDoc.docs;
const rootDocs = keyDocsMeta.filter((e) => !e.target);
if (rootDocs) {
for (const rootDoc of rootDocs) {
if (
!rootDoc.targetSpecs ||
(rootDoc.targetSpecs &&
rootDoc.targetSpecs.some(
(nsv) => nsv.namespace === ns && nsv.version === specVersion,
))
) {
return rootDoc.docs;
}
}
}
}
}

return undefined;
}
}

0 comments on commit 78ce094

Please sign in to comment.