@@ -327,11 +327,6 @@ const commentDirectiveRegExSingleLine = /^\/\/\/?\s*@(ts-expect-error|ts-ignore)
327327 */
328328const commentDirectiveRegExMultiLine = / ^ (?: \/ | \* ) * \s * @ ( t s - e x p e c t - e r r o r | t s - i g n o r e ) / ;
329329
330- /**
331- * Test for whether a comment contains a JSDoc tag needed by the checker when run in tsc.
332- */
333- const semanticJSDocTagRegEx = / @ (?: s e e | l i n k ) / i;
334-
335330function lookupInUnicodeMap ( code : number , map : readonly number [ ] ) : boolean {
336331 // Bail out quickly if it couldn't possibly be in the map.
337332 if ( code < map [ 0 ] ) {
@@ -1834,6 +1829,7 @@ export function createScanner(languageVersion: ScriptTarget,
18341829 if ( text . charCodeAt ( pos + 1 ) === CharacterCodes . asterisk ) {
18351830 pos += 2 ;
18361831 const isJSDoc = text . charCodeAt ( pos ) === CharacterCodes . asterisk && text . charCodeAt ( pos + 1 ) !== CharacterCodes . slash ;
1832+ let containsSeeOrLink = false ;
18371833
18381834 let commentClosed = false ;
18391835 let lastLineStart = tokenPos ;
@@ -1846,6 +1842,36 @@ export function createScanner(languageVersion: ScriptTarget,
18461842 break ;
18471843 }
18481844
1845+ if ( skipJSDoc && isJSDoc && ! containsSeeOrLink ) {
1846+ if ( ch === CharacterCodes . at ) {
1847+ const ch1 = text . charCodeAt ( pos + 1 ) ;
1848+ const ch2 = text . charCodeAt ( pos + 2 ) ;
1849+ const ch3 = text . charCodeAt ( pos + 3 ) ;
1850+ if ( ch1 === CharacterCodes . s || ch1 === CharacterCodes . S ) {
1851+ if (
1852+ ( ch2 === CharacterCodes . e || ch2 === CharacterCodes . E )
1853+ && ( ch3 === CharacterCodes . e || ch3 === CharacterCodes . E )
1854+ ) {
1855+ containsSeeOrLink = true ;
1856+ pos += 3 ;
1857+ continue ;
1858+ }
1859+ }
1860+ else if ( ch1 === CharacterCodes . l || ch1 === CharacterCodes . L ) {
1861+ const ch4 = text . charCodeAt ( pos + 4 ) ;
1862+ if (
1863+ ( ch2 === CharacterCodes . i || ch2 === CharacterCodes . I )
1864+ && ( ch3 === CharacterCodes . n || ch3 === CharacterCodes . N )
1865+ && ( ch4 === CharacterCodes . k || ch4 === CharacterCodes . K )
1866+ ) {
1867+ containsSeeOrLink = true ;
1868+ pos += 4 ;
1869+ continue ;
1870+ }
1871+ }
1872+ }
1873+ }
1874+
18491875 pos ++ ;
18501876
18511877 if ( isLineBreak ( ch ) ) {
@@ -1854,7 +1880,7 @@ export function createScanner(languageVersion: ScriptTarget,
18541880 }
18551881 }
18561882
1857- if ( isJSDoc && ( ! skipJSDoc || semanticJSDocTagRegEx . test ( text . slice ( tokenPos , pos ) ) ) ) {
1883+ if ( isJSDoc && ( ! skipJSDoc || containsSeeOrLink ) ) {
18581884 tokenFlags |= TokenFlags . PrecedingJSDocComment ;
18591885 }
18601886
0 commit comments