@@ -327,11 +327,6 @@ const commentDirectiveRegExSingleLine = /^\/\/\/?\s*@(ts-expect-error|ts-ignore)
327
327
*/
328
328
const commentDirectiveRegExMultiLine = / ^ (?: \/ | \* ) * \s * @ ( t s - e x p e c t - e r r o r | t s - i g n o r e ) / ;
329
329
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
-
335
330
function lookupInUnicodeMap ( code : number , map : readonly number [ ] ) : boolean {
336
331
// Bail out quickly if it couldn't possibly be in the map.
337
332
if ( code < map [ 0 ] ) {
@@ -1834,6 +1829,7 @@ export function createScanner(languageVersion: ScriptTarget,
1834
1829
if ( text . charCodeAt ( pos + 1 ) === CharacterCodes . asterisk ) {
1835
1830
pos += 2 ;
1836
1831
const isJSDoc = text . charCodeAt ( pos ) === CharacterCodes . asterisk && text . charCodeAt ( pos + 1 ) !== CharacterCodes . slash ;
1832
+ let containsSeeOrLink = false ;
1837
1833
1838
1834
let commentClosed = false ;
1839
1835
let lastLineStart = tokenPos ;
@@ -1846,6 +1842,36 @@ export function createScanner(languageVersion: ScriptTarget,
1846
1842
break ;
1847
1843
}
1848
1844
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
+
1849
1875
pos ++ ;
1850
1876
1851
1877
if ( isLineBreak ( ch ) ) {
@@ -1854,7 +1880,7 @@ export function createScanner(languageVersion: ScriptTarget,
1854
1880
}
1855
1881
}
1856
1882
1857
- if ( isJSDoc && ( ! skipJSDoc || semanticJSDocTagRegEx . test ( text . slice ( tokenPos , pos ) ) ) ) {
1883
+ if ( isJSDoc && ( ! skipJSDoc || containsSeeOrLink ) ) {
1858
1884
tokenFlags |= TokenFlags . PrecedingJSDocComment ;
1859
1885
}
1860
1886
0 commit comments