Skip to content

Commit 86c572d

Browse files
Fixed lombok dependency regex (#2542)
Signed-off-by: Mathieu Fortin <[email protected]>
1 parent 43bb914 commit 86c572d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/lombokSupport.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ const languageServerDocumentSelector = [
2020
{ pattern: '**/{build,settings}.gradle.kts'}
2121
];
2222

23+
const lombokJarRegex = /lombok-\d+.*\.jar/;
24+
2325
let activeLombokPath: string = undefined;
2426
let isLombokCommandInitialized: boolean = false;
2527

@@ -46,8 +48,7 @@ export function cleanupLombokCache(context: ExtensionContext): boolean {
4648
}
4749

4850
export function getLombokVersion(context: ExtensionContext): string {
49-
const reg = /lombok-.*\.jar/;
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 = /lombok-.*\.jar/;
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

Comments
 (0)