@@ -1071,7 +1071,13 @@ describe("Raw Lexer", () => {
10711071
10721072describe ( "Comment Parser" , ( ) => {
10731073 const config : CommentParserConfig = {
1074- blockTags : new Set ( [ "@param" , "@remarks" , "@module" , "@inheritDoc" ] ) ,
1074+ blockTags : new Set ( [
1075+ "@param" ,
1076+ "@remarks" ,
1077+ "@module" ,
1078+ "@inheritDoc" ,
1079+ "@defaultValue" ,
1080+ ] ) ,
10751081 inlineTags : new Set ( [ "@link" ] ) ,
10761082 modifierTags : new Set ( [
10771083 "@public" ,
@@ -1090,6 +1096,89 @@ describe("Comment Parser", () => {
10901096 } ,
10911097 } ;
10921098
1099+ it ( "Should recognize @defaultValue as code" , ( ) => {
1100+ const files = new FileRegistry ( ) ;
1101+ const logger = new TestLogger ( ) ;
1102+ const file = "/** @defaultValue code */" ;
1103+ const content = lexBlockComment ( file ) ;
1104+ const comment = parseComment (
1105+ content ,
1106+ config ,
1107+ new MinimalSourceFile ( file , "<memory>" ) ,
1108+ logger ,
1109+ files ,
1110+ ) ;
1111+
1112+ equal (
1113+ comment ,
1114+ new Comment (
1115+ [ ] ,
1116+ [
1117+ new CommentTag ( "@defaultValue" , [
1118+ { kind : "code" , text : "```ts\ncode\n```" } ,
1119+ ] ) ,
1120+ ] ,
1121+ ) ,
1122+ ) ;
1123+ logger . expectNoOtherMessages ( ) ;
1124+ } ) ;
1125+
1126+ it ( "Should recognize @defaultValue as not code if it contains an inline tag" , ( ) => {
1127+ const files = new FileRegistry ( ) ;
1128+ const logger = new TestLogger ( ) ;
1129+ const file = "/** @defaultValue text {@link foo} */" ;
1130+ const content = lexBlockComment ( file ) ;
1131+ const comment = parseComment (
1132+ content ,
1133+ config ,
1134+ new MinimalSourceFile ( file , "<memory>" ) ,
1135+ logger ,
1136+ files ,
1137+ ) ;
1138+
1139+ equal (
1140+ comment ,
1141+ new Comment (
1142+ [ ] ,
1143+ [
1144+ new CommentTag ( "@defaultValue" , [
1145+ { kind : "text" , text : "text " } ,
1146+ { kind : "inline-tag" , tag : "@link" , text : "foo" } ,
1147+ ] ) ,
1148+ ] ,
1149+ ) ,
1150+ ) ;
1151+ logger . expectNoOtherMessages ( ) ;
1152+ } ) ;
1153+
1154+ it ( "Should recognize @defaultValue as not code if it contains code" , ( ) => {
1155+ const files = new FileRegistry ( ) ;
1156+ const logger = new TestLogger ( ) ;
1157+ const file = "/** @defaultValue text `code` */" ;
1158+ const content = lexBlockComment ( file ) ;
1159+ const comment = parseComment (
1160+ content ,
1161+ config ,
1162+ new MinimalSourceFile ( file , "<memory>" ) ,
1163+ logger ,
1164+ files ,
1165+ ) ;
1166+
1167+ equal (
1168+ comment ,
1169+ new Comment (
1170+ [ ] ,
1171+ [
1172+ new CommentTag ( "@defaultValue" , [
1173+ { kind : "text" , text : "text " } ,
1174+ { kind : "code" , text : "`code`" } ,
1175+ ] ) ,
1176+ ] ,
1177+ ) ,
1178+ ) ;
1179+ logger . expectNoOtherMessages ( ) ;
1180+ } ) ;
1181+
10931182 it ( "Should rewrite @inheritdoc to @inheritDoc" , ( ) => {
10941183 const files = new FileRegistry ( ) ;
10951184 const logger = new TestLogger ( ) ;
0 commit comments