Skip to content

Commit 0af14d0

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 a5ba689 commit 0af14d0

File tree

5 files changed

+40
-15
lines changed

5 files changed

+40
-15
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
@@ -2038,7 +2038,7 @@
20382038
},
20392039
"dependencies": {
20402040
"@redhat-developer/vscode-extension-proposals": "0.0.23",
2041-
"@redhat-developer/vscode-redhat-telemetry": "^0.9.2",
2041+
"@redhat-developer/vscode-redhat-telemetry": "0.10.0",
20422042
"@vscode/codicons": "^0.0.32",
20432043
"@vscode/webview-ui-toolkit": "1.2.2",
20442044
"chokidar": "^3.5.3",

src/javaServerStarter.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +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-
import { log } from 'console';
16-
14+
import { deleteDirectory, ensureExists, getJavaConfiguration, getTimestamp, getVersion, getVSCodeVariablesMap, isInsiderEditor, isPrereleaseOrInsiderVersion } from './utils';
1715
// eslint-disable-next-line no-var
1816
declare var v8debug;
1917
export const DEBUG = (typeof v8debug === 'object') || startedInDebugMode();
@@ -238,12 +236,10 @@ function prepareParams(requirements: RequirementsData, workspacePath, context: E
238236
}
239237

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

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

297293
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)