Skip to content

Commit

Permalink
Merge branch 'develop' into cristi/org-login-commands
Browse files Browse the repository at this point in the history
  • Loading branch information
CristiCanizales authored Sep 19, 2023
2 parents 93828d2 + 5f44746 commit e18da66
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/salesforcedx-vscode-apex/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"run_single_test_title": "Run Single Test",
"show_error_title": "Display Error",
"go_to_definition_title": "Go to Definition",
"java_home_description": "Specifies the folder path to the Java 8, Java 11, or Java 17 runtime used to launch the Apex Language Server (for example, /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home).",
"java_home_description": "Specifies the folder path to the Java 11, or Java 17 runtime used to launch the Apex Language Server (for example, /Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home).",
"java_memory_description": "Specifies the amount of memory allocation to the Apex Language Server in MB, or null to use the system default value.",
"apex_semantic_errors_description": "Allow Apex Language Server to surface semantic errors",
"force_anon_apex_execute_document_text": "SFDX: Execute Anonymous Apex with Editor Contents",
Expand Down
11 changes: 7 additions & 4 deletions packages/salesforcedx-vscode-apex/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
forceApexTestSuiteRun,
forceLaunchApexReplayDebuggerWithCurrentFile
} from './commands';
import { APEX_EXTENSION_NAME, LSP_ERR } from './constants';
import { APEX_EXTENSION_NAME, LSP_ERR, SET_JAVA_DOC_LINK } from './constants';
import { workspaceContext } from './context';
import {
ClientStatus,
Expand Down Expand Up @@ -326,8 +326,12 @@ async function createLanguageClient(extensionContext: vscode.ExtensionContext) {
extensionContext.subscriptions.push(handle);
} catch (e) {
languageClientUtils.setStatus(ClientStatus.Error, e);
let eMsg = typeof e === 'string' ? e : e.message ?? nls.localize('unknown_error');
if (eMsg.includes(nls.localize('wrong_java_version_text', SET_JAVA_DOC_LINK))) {
eMsg = nls.localize('wrong_java_version_short');
}
languageServerStatusBarItem.error(
`${nls.localize('apex_language_server_failed_activate')} - ${e.message}`
`${nls.localize('apex_language_server_failed_activate')} - ${eMsg}`
);
}
}
Expand Down Expand Up @@ -361,8 +365,7 @@ function addOnReadyHandlerToLanguageClient(
nls.localize('apex_language_server_failed_activate')
);
languageServerStatusBarItem.error(
`${nls.localize('apex_language_server_failed_activate')} - ${
err.message
`${nls.localize('apex_language_server_failed_activate')} - ${err.message
}`
);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/salesforcedx-vscode-apex/src/messages/i18n.ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const messages = {
source_missing_text:
'指定されたフォルダ %s は存在しません。Salesforce Apex 拡張機能の設定方法についての詳細は、[Java 設定](%s) を参照してください。',
wrong_java_version_text:
'サポートされていない Java のバージョンが検出されました。拡張機能を実行するには、[Java 8](https://java.com/en/download/)、[Java 11](https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html)、または [Java 17](https://www.oracle.com/java/technologies/downloads/#java17) をダウンロードし、インストールしてください。詳細については、[Java バージョンを設定する](%s) を参照してください。',
'サポートされていない Java のバージョンが検出されました。拡張機能を実行するには、[Java 11](https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html)、または [Java 17](https://www.oracle.com/java/technologies/downloads/#java17) をダウンロードし、インストールしてください。詳細については、[Java バージョンを設定する](%s) を参照してください。',
force_apex_test_suite_build_text: 'SFDX: Apex テストスイートを作成',
unable_to_locate_editor:
'ソースファイルに対してのみこのコマンドを実行できます。',
Expand Down
7 changes: 5 additions & 2 deletions packages/salesforcedx-vscode-apex/src/messages/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,13 @@ export const messages = {
source_missing_text:
'%s points to a missing folder. For information on how to setup the Salesforce Apex extension, see [Set Your Java Version](%s).',
wrong_java_version_text:
'An unsupported Java version was detected. Download and install [Java 8](https://java.com/en/download/), [Java 11](https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html), or [Java 17](https://www.oracle.com/java/technologies/downloads/#java17) to run the extensions. For more information, see [Set Your Java Version](%s).',
'An unsupported Java version was detected. Download and install [Java 11](https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html), or [Java 17](https://www.oracle.com/java/technologies/downloads/#java17) to run the extensions. For more information, see [Set Your Java Version](%s).',
wrong_java_version_short:
'Unsupported Java version',
force_apex_test_suite_build_text: 'SFDX: Build Apex Test Suite',
unable_to_locate_editor: 'You can run this command only on a source file.',
unable_to_locate_document: 'You can run this command only on a source file.',
launch_apex_replay_debugger_unsupported_file:
'You can only run this command with Anonymous Apex files, Apex Test files, or Apex Debug Log files.'
'You can only run this command with Anonymous Apex files, Apex Test files, or Apex Debug Log files.',
unknown_error: 'Unknown error'
};
1 change: 0 additions & 1 deletion packages/salesforcedx-vscode-apex/src/requirements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ export function checkJavaVersion(javaHome: string): Promise<boolean> {
{},
(error, stdout, stderr) => {
if (
stderr.indexOf('build 1.8') < 0 &&
stderr.indexOf('build 11.') < 0 &&
stderr.indexOf('build 17.') < 0
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,19 @@ describe('Java Requirements Test', () => {

it('Should allow valid java runtime path outside the project', async () => {
settingStub.withArgs(JAVA_HOME_KEY).returns(runtimePath);
execFileStub.yields('', '', 'build 1.8');
execFileStub.yields('', '', 'build 11.0.0');
const requirements = await resolveRequirements();
expect(requirements.java_home).contains(jdk);
});

it('Should support Java 8', async () => {
it('Should not support Java 8', async () => {
execFileStub.yields('', '', 'build 1.8.0');
try {
const result = await checkJavaVersion('~/java_home');
expect(result).to.equal(true);
await checkJavaVersion('~/java_home');
fail('Should have thrown when the Java version is not supported');
} catch (err) {
fail(
`Should not have thrown when the Java version is 17. The error was: ${err}`
expect(err).to.equal(
nls.localize('wrong_java_version_text', SET_JAVA_DOC_LINK)
);
}
});
Expand Down

0 comments on commit e18da66

Please sign in to comment.