@@ -112,7 +112,7 @@ export function patchSemantic(typescriptServices: LanguageServicePlugin[], confi
112112 // eslint-disable-next-line ts/ban-ts-comment
113113 // @ts -expect-error
114114 if ( program . isSourceFileDefaultLibrary . patched === true ) return program
115- const originalIsSourceFileDefaultLibrary = program . isSourceFileDefaultLibrary
115+ const originalIsSourceFileDefaultLibrary = program . isSourceFileDefaultLibrary . bind ( program )
116116 const patchedIsSourceFileDefaultLibrary = ( sourceFile : ets . SourceFile ) : boolean => {
117117 return sourceFile . fileName . startsWith ( config . getSdkPath ( ) ) || originalIsSourceFileDefaultLibrary ( sourceFile )
118118 }
@@ -141,10 +141,11 @@ export function patchSemantic(typescriptServices: LanguageServicePlugin[], confi
141141 )
142142 // 补丁:将@interface的高亮类型改为ts装饰器的高亮类型
143143 for ( let i = 0 ; i < encodedClassifications . spans . length ; i += 3 ) {
144- const offset = encodedClassifications . spans [ i ] // 第1个值:偏移量
145- const tsClassification = encodedClassifications . spans [ i + 2 ] // 第3个值:编码的分类
144+ const offset = encodedClassifications . spans [ i ] // 第1个值: offset
145+ const tsClassification = encodedClassifications . spans [ i + 2 ] // 第3个值: ts classification
146+ if ( tsClassification !== 256 ) continue
146147 const annotationDeclaration = findAnnotationOrDecoratorNodeInPosition ( offset , sourceFile )
147- if ( annotationDeclaration && tsClassification === 256 ) encodedClassifications . spans [ i + 2 ] = 2824
148+ if ( annotationDeclaration ) encodedClassifications . spans [ i + 2 ] = 2824
148149 }
149150 return convertClassificationsToSemanticTokens ( document , span , legend , encodedClassifications )
150151 } ,
0 commit comments