Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mz/disable apex ls error telemetry #5969

Merged
merged 4 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
export type LocalizationProvider = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
localize(label: string, ...args: any[]): string;
};
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
ColorInformation,
ColorPresentationRequest,
DocumentColorRequest,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
ServerCapabilities as CPServerCapabilities
} from 'vscode-languageserver-protocol';
import { ConfigurationParams, ConfigurationRequest } from 'vscode-languageserver-protocol';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv

public provideDebugConfigurations(
folder: vscode.WorkspaceFolder | undefined,
// eslint-disable-next-line @typescript-eslint/no-unused-vars

token?: vscode.CancellationToken
): vscode.ProviderResult<vscode.DebugConfiguration[]> {
return [DebugConfigurationProvider.getConfig(folder)];
Expand All @@ -35,7 +35,7 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
public resolveDebugConfiguration(
folder: vscode.WorkspaceFolder | undefined,
config: vscode.DebugConfiguration,
// eslint-disable-next-line @typescript-eslint/no-unused-vars

token?: vscode.CancellationToken
): vscode.ProviderResult<vscode.DebugConfiguration> {
return this.asyncDebugConfig(folder, config).catch(async err => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ export const registerIsvAuthWatcher = (extensionContext: vscode.ExtensionContext
if (vscode.workspace.workspaceFolders instanceof Array && vscode.workspace.workspaceFolders.length > 0) {
const configPath = projectPaths.salesforceProjectConfig();
const isvAuthWatcher = vscode.workspace.createFileSystemWatcher(configPath);
/* eslint-disable @typescript-eslint/no-unused-vars */

isvAuthWatcher.onDidChange(uri => setupGlobalDefaultUserIsvAuth());
isvAuthWatcher.onDidCreate(uri => setupGlobalDefaultUserIsvAuth());
isvAuthWatcher.onDidDelete(uri => setupGlobalDefaultUserIsvAuth());
/* eslint-enable @typescript-eslint/no-unused-vars */

extensionContext.subscriptions.push(isvAuthWatcher);
}
};
4 changes: 2 additions & 2 deletions packages/salesforcedx-vscode-apex-debugger/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,15 @@ export const getExceptionBreakpointCache = (): Map<string, ExceptionBreakpointIt

const registerFileWatchers = (): vscode.Disposable => {
const clsWatcher = vscode.workspace.createFileSystemWatcher('**/*.cls');
/* eslint-disable @typescript-eslint/no-unused-vars */

clsWatcher.onDidChange(uri => notifyDebuggerSessionFileChanged());
clsWatcher.onDidCreate(uri => notifyDebuggerSessionFileChanged());
clsWatcher.onDidDelete(uri => notifyDebuggerSessionFileChanged());
const trgWatcher = vscode.workspace.createFileSystemWatcher('**/*.trigger');
trgWatcher.onDidChange(uri => notifyDebuggerSessionFileChanged());
trgWatcher.onDidCreate(uri => notifyDebuggerSessionFileChanged());
trgWatcher.onDidDelete(uri => notifyDebuggerSessionFileChanged());
/* eslint-enable @typescript-eslint/no-unused-vars */

return vscode.Disposable.from(clsWatcher, trgWatcher);
};

Expand Down
5 changes: 5 additions & 0 deletions packages/salesforcedx-vscode-apex/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,11 @@
"type": "boolean",
"default": false,
"description": "%apex_code_disable-warnings-for-missing-coverage%"
},
"salesforcedx-vscode-apex.enable-apex-ls-error-to-telemetry": {
"type": "boolean",
"default": false,
"description": "%enable-apex-ls-error-to-telemetry%"
}
}
},
Expand Down
1 change: 1 addition & 0 deletions packages/salesforcedx-vscode-apex/package.nls.ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"apex_verbose_level_trace_description": "Output everything, including details about notifications and responses received by the client, and requests sent by the server.",
"configuration_title": "Salesforce Apex Configuration",
"collapse_tests_title": "SFDX: Apex テストを隠す",
"enable-apex-ls-error-to-telemetry": "Allow the Apex Language Server to collect telemetry of errors",
"go_to_definition_title": "定義に移動",
"java_home_description": "Specifies the folder path to the Java 11, Java 17, or Java 21 runtime used to launch the Apex Language Server. Note on Windows the backslashes must be escaped.\n\nMac Example: `/Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home`\n\nWindows Example: `C:\\\\Program Files\\\\Zulu\\\\zulu-17`\n\nLinux Example: `/usr/lib/jvm/java-21-openjdk-amd64`",
"refresh_test_title": "テストを更新",
Expand Down
1 change: 1 addition & 0 deletions packages/salesforcedx-vscode-apex/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"apex_verbose_level_trace_description": "Output everything, including details about notifications and responses received by the client, and requests sent by the server.",
"configuration_title": "Salesforce Apex Configuration",
"collapse_tests_title": "SFDX: Collapse All Apex Tests",
"enable-apex-ls-error-to-telemetry": "Allow the Apex Language Server to collect telemetry of errors",
"go_to_definition_title": "Go to Definition",
"java_home_description": "Specifies the folder path to the Java 11, Java 17, or Java 21 runtime used to launch the Apex Language Server. Note on Windows the backslashes must be escaped.\n\nMac Example: `/Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home`\n\nWindows Example: `C:\\\\Program Files\\\\Zulu\\\\zulu-17`\n\nLinux Example: `/usr/lib/jvm/java-21-openjdk-amd64`",
"java_memory_description": "Specifies the amount of memory allocation to the Apex Language Server in MB, or null to use the system default value.",
Expand Down
5 changes: 3 additions & 2 deletions packages/salesforcedx-vscode-apex/src/languageServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { LSP_ERR, UBER_JAR_NAME } from './constants';
import { soqlMiddleware } from './embeddedSoql';
import { nls } from './messages';
import * as requirements from './requirements';
import { retrieveEnableSyncInitJobs } from './settings';
import { retrieveEnableApexLSErrorToTelemetry, retrieveEnableSyncInitJobs } from './settings';
import { getTelemetryService } from './telemetry/telemetry';

const JDWP_DEBUG_PORT = 2739;
Expand Down Expand Up @@ -153,7 +153,8 @@ export const buildClientOptions = (): LanguageClientOptions => {
},
initializationOptions: {
enableEmbeddedSoqlCompletion: soqlExtensionInstalled,
enableSynchronizedInitJobs: retrieveEnableSyncInitJobs()
enableSynchronizedInitJobs: retrieveEnableSyncInitJobs(),
enableErrorToTelemetry: retrieveEnableApexLSErrorToTelemetry()
},
...(soqlExtensionInstalled ? { middleware: soqlMiddleware } : {}),
errorHandler: new ApexErrorHandler()
Expand Down
6 changes: 6 additions & 0 deletions packages/salesforcedx-vscode-apex/src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,9 @@ export const retrieveTestCodeCoverage = (): boolean => {
export const retrieveEnableSyncInitJobs = (): boolean => {
return vscode.workspace.getConfiguration().get<boolean>('salesforcedx-vscode-apex.wait-init-jobs', true);
};

export const retrieveEnableApexLSErrorToTelemetry = (): boolean => {
return vscode.workspace
.getConfiguration()
.get<boolean>('salesforcedx-vscode-apex.enable-apex-ls-error-to-telemetry', false);
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { nls } from '../messages';
import { IconsEnum, iconHelpers } from './icons';
import { ApexTestMethod } from './lspConverter';

// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
const safeLocalize = (val: string) => nls.localize(val);

// Message
Expand Down Expand Up @@ -161,7 +160,7 @@ export class ApexTestOutlineProvider implements vscode.TreeDataProvider<TestNode
this.apexTestMap.set(test.definingType, apexGroup);
}
const apexTest = new ApexTestNode(test.methodName, test.location);
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands

apexTest.name = apexGroup.label + '.' + apexTest.label;
this.apexTestMap.set(apexTest.name, apexTest);
apexGroup.children.push(apexTest);
Expand Down Expand Up @@ -240,7 +239,7 @@ export abstract class TestNode extends vscode.TreeItem {
};

// TODO: create a ticket to address this particular issue.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment

// @ts-ignore
get tooltip(): string {
return this.description;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,33 +375,30 @@ describe('Apex Test Run - Code Action', () => {
testLevel: TestLevel.RunSpecifiedTests
});
const apexLibExecutor = new ApexLibraryTestRunExecutor(['testClass', 'secondTestClass'], 'path/to/dir', false);
runTestStub.callsFake(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
(payload, codecoverage, exitEarly, progressReporter, token) => {
progressReporter.report({
type: 'StreamingClientProgress',
value: 'streamingTransportUp',
message: 'Listening for streaming state changes...'
});
progressReporter.report({
type: 'StreamingClientProgress',
value: 'streamingProcessingTestRun',
message: 'Processing test run 707500000000000001',
testRunId: '707500000000000001'
});
progressReporter.report({
type: 'FormatTestResultProgress',
value: 'retrievingTestRunSummary',
message: 'Retrieving test run summary record'
});
progressReporter.report({
type: 'FormatTestResultProgress',
value: 'queryingForAggregateCodeCoverage',
message: 'Querying for aggregate code coverage results'
});
return passingResult;
}
);
runTestStub.callsFake((payload, codecoverage, exitEarly, progressReporter, token) => {
progressReporter.report({
type: 'StreamingClientProgress',
value: 'streamingTransportUp',
message: 'Listening for streaming state changes...'
});
progressReporter.report({
type: 'StreamingClientProgress',
value: 'streamingProcessingTestRun',
message: 'Processing test run 707500000000000001',
testRunId: '707500000000000001'
});
progressReporter.report({
type: 'FormatTestResultProgress',
value: 'retrievingTestRunSummary',
message: 'Retrieving test run summary record'
});
progressReporter.report({
type: 'FormatTestResultProgress',
value: 'queryingForAggregateCodeCoverage',
message: 'Querying for aggregate code coverage results'
});
return passingResult;
});

await apexLibExecutor.run(undefined, progress, cancellationToken);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { nls } from '../messages';
import { EmptyParametersGatherer, SfCommandlet, SfCommandletExecutor, SfWorkspaceChecker } from './util';

export class AliasList extends SfCommandletExecutor<{}> {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public build(data: {}): Command {
return new SfCommandBuilder()
.withDescription(nls.localize('alias_list_text'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ export class OrgLoginAccessTokenExecutor extends LibraryCommandletExecutor<Acces
super(nls.localize('org_login_access_token_text'), 'org_login_access_token', OUTPUT_CHANNEL);
}

/* eslint-disable @typescript-eslint/no-unused-vars */
public async run(
response: ContinueResponse<AccessTokenParams>,
progress?: vscode.Progress<{
message?: string | undefined;
increment?: number | undefined;
}>,
token?: vscode.CancellationToken
/* eslint-enable @typescript-eslint/no-unused-vars */
): Promise<boolean> {
const { instanceUrl, accessToken, alias } = response.data;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export class OrgLogoutAll extends SfCommandletExecutor<{}> {
return instance;
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
public build(data: {}): Command {
return new SfCommandBuilder()
.withDescription(nls.localize('org_logout_all_text'))
Expand All @@ -61,15 +60,13 @@ export class OrgLogoutDefault extends LibraryCommandletExecutor<string> {
super(nls.localize('org_logout_default_text'), 'org_logout_default', OUTPUT_CHANNEL);
}

/* eslint-disable @typescript-eslint/no-unused-vars */
public async run(
response: ContinueResponse<string>,
progress?: Progress<{
message?: string | undefined;
increment?: number | undefined;
}>,
token?: CancellationToken
/* eslint-enable @typescript-eslint/no-unused-vars */
): Promise<boolean> {
try {
await removeUsername(response.data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { nls } from '../messages';
import { EmptyParametersGatherer, SfCommandlet, SfCommandletExecutor, SfWorkspaceChecker } from './util';

export class ConfigList extends SfCommandletExecutor<{}> {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public build(data: {}): Command {
return new SfCommandBuilder()
.withDescription(nls.localize('config_list_text'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export class ConfigSetExecutor extends LibraryCommandletExecutor<{}> {
this.usernameOrAlias = `${usernameOrAlias}`.split(',')[0];
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
public async run(response: ContinueResponse<string>): Promise<boolean> {
let result: boolean;
let message: string | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ export enum ApiType {

const workspaceChecker = new SfWorkspaceChecker();

// eslint-disable-next-line @typescript-eslint/no-unused-vars
export const dataQuery = (explorerDir?: any): void => {
const parameterGatherer = new GetQueryAndApiInputs();
const commandlet = new SfCommandlet(workspaceChecker, parameterGatherer, new DataQueryExecutor());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export class DebuggerSessionDetachExecutor extends SfCommandletExecutor<IdSelect
}

export class StopActiveDebuggerSessionExecutor extends SfCommandletExecutor<{}> {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public build(data: {}): Command {
return new SfCommandBuilder()
.withArg('data:query')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export class DescribeMetadataExecutor extends SfCommandletExecutor<string> {
super();
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
public build(data: {}): Command {
return new SfCommandBuilder()
.withArg('org:list:metadata-types')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
} from '../projectGenerate';
import { CompositeParametersGatherer, EmptyPreChecker, SfCommandlet, SfCommandletExecutor } from '../util';
// below uses require due to bundling restrictions
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unused-vars
// eslint-disable-next-line @typescript-eslint/no-var-requires
const AdmZip = require('adm-zip');

export type InstalledPackageInfo = {
Expand All @@ -56,7 +56,6 @@ export class IsvDebugBootstrapExecutor extends SfCommandletExecutor<{}> {
public readonly relativeApexPackageXmlPath = path.join(this.relativeMetadataTempPath, PACKAGE_XML);
public readonly relativeInstalledPackagesPath = path.join(projectPaths.relativeToolsFolder(), INSTALLED_PACKAGES);

// eslint-disable-next-line @typescript-eslint/no-unused-vars
public build(data: {}): Command {
throw new Error('not in use');
}
Expand Down Expand Up @@ -349,12 +348,10 @@ export class IsvDebugBootstrapExecutor extends SfCommandletExecutor<{}> {
return result;
}

/* eslint-disable @typescript-eslint/no-unused-vars */
protected attachExecution(
execution: CommandExecution,
cancellationTokenSource: vscode.CancellationTokenSource,
cancellationToken: vscode.CancellationToken
/* eslint-enable @typescript-eslint/no-unused-vars */
) {
channelService.streamCommandOutput(execution);
channelService.showChannelOutput();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export class ListMetadataExecutor extends SfCommandletExecutor<string> {
this.folder = folder;
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
public build(data: {}): Command {
const builder = new SfCommandBuilder()
.withArg('org:list:metadata')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ export class OrgCreateExecutor extends SfCommandletExecutor<AliasAndFileSelectio
stdOut += realData.toString();
});

// eslint-disable-next-line @typescript-eslint/no-unused-vars
execution.processExitSubject.subscribe(async exitCode => {
this.logMetric(execution.command.logName, startTime);
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { nls } from '../messages';
import { PromptConfirmGatherer, SfCommandlet, SfCommandletExecutor, SfWorkspaceChecker } from './util';

export class OrgListExecutor extends SfCommandletExecutor<{}> {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public build(data: { choice?: string }): Command {
return new SfCommandBuilder()
.withDescription(nls.localize('org_list_clean_text'))
Expand Down
3 changes: 1 addition & 2 deletions packages/salesforcedx-vscode-core/src/commands/orgOpen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { workspaceUtils } from '../util';
import { EmptyParametersGatherer, SfCommandlet, SfCommandletExecutor, SfWorkspaceChecker } from './util';

export class OrgOpenContainerExecutor extends SfCommandletExecutor<{}> {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public build(data: {}): Command {
return new SfCommandBuilder()
.withDescription(nls.localize('org_open_default_scratch_org_text'))
Expand Down Expand Up @@ -94,7 +93,7 @@ export class OrgOpenContainerExecutor extends SfCommandletExecutor<{}> {

export class OrgOpenExecutor extends SfCommandletExecutor<{}> {
protected showChannelOutput = false;
// eslint-disable-next-line @typescript-eslint/no-unused-vars

public build(data: {}): Command {
return new SfCommandBuilder()
.withDescription(nls.localize('org_open_default_scratch_org_text'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,14 @@ export class GenerateManifestExecutor extends LibraryCommandletExecutor<string>
this.sourcePaths = sourcePaths;
this.responseText = responseText;
}
/* eslint-disable @typescript-eslint/no-unused-vars */

public async run(
response: ContinueResponse<string>,
progress?: vscode.Progress<{
message?: string | undefined;
increment?: number | undefined;
}>,
token?: vscode.CancellationToken
/* eslint-enable @typescript-eslint/no-unused-vars */
): Promise<boolean> {
if (this.sourcePaths) {
const packageXML = await ComponentSet.fromSource(this.sourcePaths).getPackageXml();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export class ProjectRetrieveStartExecutor extends SfCommandletExecutor<{}> {
this.flag = flag;
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
public build(data: {}): Command {
const builder = new SfCommandBuilder()
.withDescription(nls.localize(this.params.description.default))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class RefreshSObjectsExecutor extends SfCommandletExecutor<{}> {
public static readonly onRefreshSObjectsCommandCompletion =
RefreshSObjectsExecutor.refreshSObjectsCommandCompletionEventEmitter.event;
private static isActive = false;
// eslint-disable-next-line @typescript-eslint/no-unused-vars

public build(data: {}): Command {
return new SfCommandBuilder()
.withDescription(nls.localize('sobjects_refresh'))
Expand Down
Loading
Loading