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
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2048,7 +2048,7 @@
},
"dependencies": {
"@redhat-developer/vscode-extension-proposals": "0.0.23",
"@redhat-developer/vscode-redhat-telemetry": "^0.9.2",
"@redhat-developer/vscode-redhat-telemetry": "0.10.2",
"@vscode/codicons": "^0.0.32",
"@vscode/webview-ui-toolkit": "1.2.2",
"chokidar": "^3.5.3",
Expand Down
9 changes: 3 additions & 6 deletions src/javaServerStarter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import { logger } from './log';
import { addLombokParam, isLombokSupportEnabled } from './lombokSupport';
import { RequirementsData } from './requirements';
import { IS_WORKSPACE_VMARGS_ALLOWED, getJavaEncoding, getJavaagentFlag, getKey, isInWorkspaceFolder } from './settings';
import { deleteDirectory, ensureExists, getJavaConfiguration, getTimestamp, getVersion, getVSCodeVariablesMap } from './utils';

import { deleteDirectory, ensureExists, getJavaConfiguration, getTimestamp, getVersion, getVSCodeVariablesMap, isInsiderEditor, isPrereleaseOrInsiderVersion } from './utils';
// eslint-disable-next-line no-var
declare var v8debug;
export const DEBUG = (typeof v8debug === 'object') || startedInDebugMode();
Expand Down Expand Up @@ -237,12 +236,10 @@ function prepareParams(requirements: RequirementsData, workspacePath, context: E
}

const hasJDWP = params.find((param: string) => param.includes('jdwp')) !== undefined;
const isInsider: boolean = version.includes("insider");
const extVersion = getVersion(context.extensionPath);
const isPreReleaseVersion = /^\d+\.\d+\.\d{10}/.test(extVersion);
const globalStoragePath = path.resolve(context.globalStorageUri?.fsPath, extVersion); // .../Code/User/globalStorage/redhat.java/1.42.0/
const appCDSMode = workspace.getConfiguration().get('java.jdt.ls.appcds.enabled');
const useAppCDS = (appCDSMode === 'on') || (appCDSMode === 'auto' && (isInsider || isPreReleaseVersion));
const useAppCDS = (appCDSMode === 'on') || (appCDSMode === 'auto' && (isPrereleaseOrInsiderVersion(context)));

ensureExists(globalStoragePath);
const sharedArchiveLocation = path.join(globalStoragePath, "jdtls.jsa");
Expand Down Expand Up @@ -290,7 +287,7 @@ function prepareParams(requirements: RequirementsData, workspacePath, context: E
function resolveIndexCache(context: ExtensionContext) {
let enabled: string = getJavaConfiguration().get("sharedIndexes.enabled");
if (enabled === "auto") {
enabled = version.includes("insider") ? "on" : "off";
enabled = isInsiderEditor() ? "on" : "off";
}

if (enabled !== "on") {
Expand Down
4 changes: 2 additions & 2 deletions src/standardLanguageClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { askForProjects, projectConfigurationUpdate, upgradeGradle } from "./sta
import { TracingLanguageClient } from './TracingLanguageClient';
import { TypeHierarchyDirection, TypeHierarchyItem } from "./typeHierarchy/protocol";
import { typeHierarchyTree } from "./typeHierarchy/typeHierarchyTree";
import { getAllJavaProjects, getAllProjects, getJavaConfiguration } from "./utils";
import { getAllJavaProjects, getAllProjects, getJavaConfiguration, isPrereleaseOrInsiderVersion } from "./utils";
import { Telemetry } from "./telemetry";
import { TelemetryEvent } from "@redhat-developer/vscode-redhat-telemetry/lib";
import { registerDocumentValidationListener } from './diagnostic';
Expand Down Expand Up @@ -355,7 +355,7 @@ export class StandardLanguageClient {
}
}

if (tags.length > 0) {
if (tags.length > 0 || DEBUG || isPrereleaseOrInsiderVersion(context)) {
e.properties['tags'] = tags;
return Telemetry.sendTelemetry(Telemetry.LS_ERROR, e.properties);
}
Expand Down
31 changes: 30 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export async function getJavaConfig(javaHome: string) {
javaConfig.format.tabSize = editorConfig.get('tabSize');
const filesConfig = workspace.getConfiguration('files');
javaConfig.associations = filesConfig.get('associations');
const isInsider: boolean = version.includes("insider");
const isInsider: boolean = isInsiderEditor();
const androidSupport = javaConfig.jdt.ls.androidSupport.enabled;
switch (androidSupport) {
case "auto":
Expand Down Expand Up @@ -362,3 +362,32 @@ export function getVSCodeVariablesMap(): any {
keys.forEach(key => res[key] = vscodeVariables(`\${${key}}`));
return res;
}

/**
* Check if the extension version is a pre-release version or running an insider editor.
* @param context The extension context or extension path
* @returns true if the version is a pre-release version or running an insider editor
*/
export function isPrereleaseOrInsiderVersion(context: ExtensionContext | string): boolean {
return isInsiderEditor() || isPreReleaseVersion(context);
}

/**
* Check if the extension version is a pre-release version.
* Pre-release versions follow the pattern: major.minor.timestamp (e.g., 1.47.1234567890)
* @param context The extension context or extension path
* @returns true if the version is a pre-release version
*/
export function isPreReleaseVersion(context: ExtensionContext | string): boolean {
const extensionPath = typeof context === 'string' ? context : context.extensionPath;
const extVersion = getVersion(extensionPath);
return /^\d+\.\d+\.\d{10}/.test(extVersion);
}

/**
* Check if the editor is an insider release.
* @returns true if the editor is an insider release
*/
export function isInsiderEditor(): boolean {
return version.includes("insider");
}