@@ -20,6 +20,8 @@ const languageServerDocumentSelector = [
20
20
{ pattern : '**/{build,settings}.gradle.kts' }
21
21
] ;
22
22
23
+ const lombokJarRegex = / l o m b o k - \d + .* \. j a r / ;
24
+
23
25
let activeLombokPath : string = undefined ;
24
26
let isLombokCommandInitialized : boolean = false ;
25
27
@@ -46,8 +48,7 @@ export function cleanupLombokCache(context: ExtensionContext): boolean {
46
48
}
47
49
48
50
export 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 ] ;
51
52
return lombokVersion ;
52
53
}
53
54
@@ -75,7 +76,6 @@ export async function checkLombokDependency(context: ExtensionContext) {
75
76
if ( ! isLombokSupportEnabled ( ) ) {
76
77
return ;
77
78
}
78
- const reg = / l o m b o k - .* \. j a r / ;
79
79
let needReload = false ;
80
80
let versionChange = false ;
81
81
let currentLombokVersion = "" ;
@@ -85,11 +85,11 @@ export async function checkLombokDependency(context: ExtensionContext) {
85
85
for ( const projectUri of projectUris ) {
86
86
const classpathResult = await apiManager . getApiInstance ( ) . getClasspaths ( projectUri , { scope : 'runtime' } ) ;
87
87
for ( const classpath of classpathResult . classpaths ) {
88
- if ( reg . test ( classpath ) ) {
88
+ if ( lombokJarRegex . test ( classpath ) ) {
89
89
currentLombokClasspath = classpath ;
90
90
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 ] ;
93
93
if ( currentLombokVersion !== previousLombokVersion ) {
94
94
needReload = true ;
95
95
versionChange = true ;
0 commit comments