Skip to content

Commit 25370d7

Browse files
committed
chore: report all errors for pre-releases or when running in Insiders
Signed-off-by: Fred Bricon <fbricon@gmail.com>
1 parent 0ec72fb commit 25370d7

File tree

5 files changed

+40
-14
lines changed

5 files changed

+40
-14
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2048,7 +2048,7 @@
20482048
},
20492049
"dependencies": {
20502050
"@redhat-developer/vscode-extension-proposals": "0.0.23",
2051-
"@redhat-developer/vscode-redhat-telemetry": "^0.9.2",
2051+
"@redhat-developer/vscode-redhat-telemetry": "0.10.2",
20522052
"@vscode/codicons": "^0.0.32",
20532053
"@vscode/webview-ui-toolkit": "1.2.2",
20542054
"chokidar": "^3.5.3",

src/javaServerStarter.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ import { logger } from './log';
1111
import { addLombokParam, isLombokSupportEnabled } from './lombokSupport';
1212
import { RequirementsData } from './requirements';
1313
import { IS_WORKSPACE_VMARGS_ALLOWED, getJavaEncoding, getJavaagentFlag, getKey, isInWorkspaceFolder } from './settings';
14-
import { deleteDirectory, ensureExists, getJavaConfiguration, getTimestamp, getVersion, getVSCodeVariablesMap } from './utils';
15-
14+
import { deleteDirectory, ensureExists, getJavaConfiguration, getTimestamp, getVersion, getVSCodeVariablesMap, isInsiderEditor, isPrereleaseOrInsiderVersion } from './utils';
1615
// eslint-disable-next-line no-var
1716
declare var v8debug;
1817
export const DEBUG = (typeof v8debug === 'object') || startedInDebugMode();
@@ -237,12 +236,10 @@ function prepareParams(requirements: RequirementsData, workspacePath, context: E
237236
}
238237

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

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

296293
if (enabled !== "on") {

src/standardLanguageClient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import { askForProjects, projectConfigurationUpdate, upgradeGradle } from "./sta
3434
import { TracingLanguageClient } from './TracingLanguageClient';
3535
import { TypeHierarchyDirection, TypeHierarchyItem } from "./typeHierarchy/protocol";
3636
import { typeHierarchyTree } from "./typeHierarchy/typeHierarchyTree";
37-
import { getAllJavaProjects, getAllProjects, getJavaConfiguration } from "./utils";
37+
import { getAllJavaProjects, getAllProjects, getJavaConfiguration, isPrereleaseOrInsiderVersion } from "./utils";
3838
import { Telemetry } from "./telemetry";
3939
import { TelemetryEvent } from "@redhat-developer/vscode-redhat-telemetry/lib";
4040
import { registerDocumentValidationListener } from './diagnostic';
@@ -355,7 +355,7 @@ export class StandardLanguageClient {
355355
}
356356
}
357357

358-
if (tags.length > 0) {
358+
if (tags.length > 0 || DEBUG || isPrereleaseOrInsiderVersion(context)) {
359359
e.properties['tags'] = tags;
360360
return Telemetry.sendTelemetry(Telemetry.LS_ERROR, e.properties);
361361
}

src/utils.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ export async function getJavaConfig(javaHome: string) {
234234
javaConfig.format.tabSize = editorConfig.get('tabSize');
235235
const filesConfig = workspace.getConfiguration('files');
236236
javaConfig.associations = filesConfig.get('associations');
237-
const isInsider: boolean = version.includes("insider");
237+
const isInsider: boolean = isInsiderEditor();
238238
const androidSupport = javaConfig.jdt.ls.androidSupport.enabled;
239239
switch (androidSupport) {
240240
case "auto":
@@ -362,3 +362,32 @@ export function getVSCodeVariablesMap(): any {
362362
keys.forEach(key => res[key] = vscodeVariables(`\${${key}}`));
363363
return res;
364364
}
365+
366+
/**
367+
* Check if the extension version is a pre-release version or running an insider editor.
368+
* @param context The extension context or extension path
369+
* @returns true if the version is a pre-release version or running an insider editor
370+
*/
371+
export function isPrereleaseOrInsiderVersion(context: ExtensionContext | string): boolean {
372+
return isInsiderEditor() || isPreReleaseVersion(context);
373+
}
374+
375+
/**
376+
* Check if the extension version is a pre-release version.
377+
* Pre-release versions follow the pattern: major.minor.timestamp (e.g., 1.47.1234567890)
378+
* @param context The extension context or extension path
379+
* @returns true if the version is a pre-release version
380+
*/
381+
export function isPreReleaseVersion(context: ExtensionContext | string): boolean {
382+
const extensionPath = typeof context === 'string' ? context : context.extensionPath;
383+
const extVersion = getVersion(extensionPath);
384+
return /^\d+\.\d+\.\d{10}/.test(extVersion);
385+
}
386+
387+
/**
388+
* Check if the editor is an insider release.
389+
* @returns true if the editor is an insider release
390+
*/
391+
export function isInsiderEditor(): boolean {
392+
return version.includes("insider");
393+
}

0 commit comments

Comments
 (0)