Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { snippetCompletionProvider } from './snippetCompletionProvider';
import { JavaClassEditorProvider } from './javaClassEditor';
import { StandardLanguageClient } from './standardLanguageClient';
import { SyntaxLanguageClient } from './syntaxLanguageClient';
import { convertToGlob, deleteClientLog, deleteDirectory, ensureExists, getBuildFilePatterns, getExclusionGlob, getInclusionPatternsFromNegatedExclusion, getJavaConfig, getJavaConfiguration, hasBuildToolConflicts, resolveActualCause, getVersion } from './utils';
import { convertToGlob, deleteClientLog, deleteDirectory, ensureExists, getBuildFilePatterns, getExclusionGlob, getInclusionPatternsFromNegatedExclusion, getJavaConfig, getJavaConfiguration, hasBuildToolConflicts, resolveActualCause, getVersion, cleanJavaLSConfiguration } from './utils';
import glob = require('glob');
import { Telemetry } from './telemetry';
import { getMessage } from './errorUtils';
Expand Down Expand Up @@ -436,6 +436,7 @@ export async function activate(context: ExtensionContext): Promise<ExtensionAPI>
cleanupWorkspaceState(context);
deleteDirectory(workspacePath);
deleteDirectory(syntaxServerWorkspacePath);
cleanJavaLSConfiguration(context);
} catch (error) {
data['error'] = getMessage(error);
window.showErrorMessage(`Failed to delete ${workspacePath}: ${error}`);
Expand Down
7 changes: 6 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import * as fs from 'fs';
import * as path from 'path';
import { workspace, WorkspaceConfiguration, commands, Uri, version } from 'vscode';
import { workspace, WorkspaceConfiguration, commands, Uri, version, ExtensionContext } from 'vscode';
import { Commands } from './commands';
import { IJavaRuntime } from 'jdk-utils';
import { getSupportedJreNames, listJdks, sortJdksBySource, sortJdksByVersion } from './jdkUtils';
Expand All @@ -22,6 +22,11 @@ export function isPreferenceOverridden(section: string): boolean {
config.inspect(section).globalLanguageValue !== undefined;
}

export function cleanJavaLSConfiguration(context: ExtensionContext) {
const globalStoragePath = context.globalStorageUri?.fsPath; // .../Code/User/globalStorage/redhat.java
Copy link
Copy Markdown
Member

@rgrunber rgrunber Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm, this folder contains all vscode-java cached startup info for each version. If a user updates to a new pre-release, or regular release, the previous cache is here. (ie. $HOME/.config/Code/User/globalStorage/redhat.java/${version}/config_linux/org.eclipse.osgi).

Are we ok with removing these as well ? It could be beneficial in terms of keeping the size of globalStorage low.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR removes whole $HOME/.config/Code/User/globalStorage/redhat.java/

deleteDirectory(globalStoragePath);
}

export function deleteDirectory(dir) {
if (fs.existsSync(dir)) {
fs.readdirSync(dir).forEach((child) => {
Expand Down