File tree Expand file tree Collapse file tree 4 files changed +40
-2
lines changed Expand file tree Collapse file tree 4 files changed +40
-2
lines changed Original file line number Diff line number Diff line change 1
1
# Unreleased
2
2
3
+ ### Bug Fixes
4
+
5
+ - ` externalSymbolLinkMappings ` now uses the TypeScript reported link target if available, #2725 .
6
+
3
7
## v0.26.8 (2024-10-04)
4
8
5
9
### Features
Original file line number Diff line number Diff line change @@ -229,7 +229,21 @@ export class Converter extends ChildableComponent<
229
229
constructor ( owner : Application ) {
230
230
super ( owner ) ;
231
231
232
- this . addUnknownSymbolResolver ( ( ref ) => {
232
+ const userConfiguredSymbolResolver : ExternalSymbolResolver = (
233
+ ref ,
234
+ refl ,
235
+ _part ,
236
+ symbolId ,
237
+ ) => {
238
+ if ( symbolId ) {
239
+ return userConfiguredSymbolResolver (
240
+ symbolId . toDeclarationReference ( ) ,
241
+ refl ,
242
+ undefined ,
243
+ undefined ,
244
+ ) ;
245
+ }
246
+
233
247
// Require global links, matching local ones will likely hide mistakes where the
234
248
// user meant to link to a local type.
235
249
if ( ref . resolutionStart !== "global" || ! ref . symbolReference ) {
@@ -256,7 +270,9 @@ export class Converter extends ChildableComponent<
256
270
if ( typeof modLinks [ "*" ] === "string" ) {
257
271
return modLinks [ "*" ] ;
258
272
}
259
- } ) ;
273
+ } ;
274
+
275
+ this . addUnknownSymbolResolver ( userConfiguredSymbolResolver ) ;
260
276
}
261
277
262
278
/**
Original file line number Diff line number Diff line change
1
+ import { Node } from "typescript" ;
2
+
3
+ /**
4
+ * {@link Node }
5
+ */
6
+ export const node = true ;
Original file line number Diff line number Diff line change @@ -1786,4 +1786,16 @@ describe("Issue Tests", () => {
1786
1786
equal ( query ( project , "big" ) . defaultValue , "123n" ) ;
1787
1787
equal ( query ( project , "neg" ) . defaultValue , "-123n" ) ;
1788
1788
} ) ;
1789
+
1790
+ it ( "#2725 respects symbol IDs when resolving links with user configured resolver" , ( ) => {
1791
+ app . options . setValue ( "externalSymbolLinkMappings" , {
1792
+ typescript : {
1793
+ "ts.Node" : "https://typescriptlang.org" ,
1794
+ } ,
1795
+ } ) ;
1796
+ const project = convert ( ) ;
1797
+ equal ( getLinks ( query ( project , "node" ) ) , [
1798
+ { display : "Node" , target : "https://typescriptlang.org" } ,
1799
+ ] ) ;
1800
+ } ) ;
1789
1801
} ) ;
You can’t perform that action at this time.
0 commit comments