@@ -20,6 +20,8 @@ const languageServerDocumentSelector = [
2020 { pattern : '**/{build,settings}.gradle.kts' }
2121] ;
2222
23+ const lombokJarRegex = / l o m b o k - \d + .* \. j a r / ;
24+
2325let activeLombokPath : string = undefined ;
2426let isLombokCommandInitialized : boolean = false ;
2527
@@ -46,8 +48,7 @@ export function cleanupLombokCache(context: ExtensionContext): boolean {
4648}
4749
4850export function getLombokVersion ( context : ExtensionContext ) : string {
49- const reg = / l o m b o k - .* \. j a r / ;
50- const lombokVersion = reg . exec ( activeLombokPath ) [ 0 ] . split ( '.jar' ) [ 0 ] ;
51+ const lombokVersion = lombokJarRegex . exec ( activeLombokPath ) [ 0 ] . split ( '.jar' ) [ 0 ] ;
5152 return lombokVersion ;
5253}
5354
@@ -75,7 +76,6 @@ export async function checkLombokDependency(context: ExtensionContext) {
7576 if ( ! isLombokSupportEnabled ( ) ) {
7677 return ;
7778 }
78- const reg = / l o m b o k - .* \. j a r / ;
7979 let needReload = false ;
8080 let versionChange = false ;
8181 let currentLombokVersion = "" ;
@@ -85,11 +85,11 @@ export async function checkLombokDependency(context: ExtensionContext) {
8585 for ( const projectUri of projectUris ) {
8686 const classpathResult = await apiManager . getApiInstance ( ) . getClasspaths ( projectUri , { scope : 'runtime' } ) ;
8787 for ( const classpath of classpathResult . classpaths ) {
88- if ( reg . test ( classpath ) ) {
88+ if ( lombokJarRegex . test ( classpath ) ) {
8989 currentLombokClasspath = classpath ;
9090 if ( isLombokImported ( context ) ) {
91- currentLombokVersion = reg . exec ( classpath ) [ 0 ] ;
92- previousLombokVersion = reg . exec ( context . workspaceState . get ( JAVA_LOMBOK_PATH ) ) [ 0 ] ;
91+ currentLombokVersion = lombokJarRegex . exec ( classpath ) [ 0 ] ;
92+ previousLombokVersion = lombokJarRegex . exec ( context . workspaceState . get ( JAVA_LOMBOK_PATH ) ) [ 0 ] ;
9393 if ( currentLombokVersion !== previousLombokVersion ) {
9494 needReload = true ;
9595 versionChange = true ;
0 commit comments