Skip to content

Commit

Permalink
chore: eligibility criteria for class and method annotations (#5981)
Browse files Browse the repository at this point in the history
* chore: eligibility criteria for class and method annotations

* chore: update rest-related annotations

* feat: latest jorje jar

* chore: pin vsp version
  • Loading branch information
mingxuanzhangsfdx authored Dec 20, 2024
1 parent 24c366b commit 420f306
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 12 deletions.
6 changes: 3 additions & 3 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 packages/salesforcedx-utils-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@salesforce/core-bundle": "8.6.1",
"@salesforce/source-deploy-retrieve-bundle": "12.7.4",
"@salesforce/source-tracking-bundle": "7.1.17",
"@salesforce/vscode-service-provider": "^1.3.0-rc.1",
"@salesforce/vscode-service-provider": "1.3.0-rc.3",
"applicationinsights": "1.0.7",
"cross-spawn": "7.0.6",
"rxjs": "^5.4.1",
Expand Down
Binary file modified packages/salesforcedx-vscode-apex/out/apex-jorje-lsp.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/salesforcedx-vscode-apex/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@salesforce/apex-tmlanguage": "1.8.0",
"@salesforce/core-bundle": "8.6.1",
"@salesforce/salesforcedx-utils-vscode": "62.8.0",
"@salesforce/vscode-service-provider": "^1.3.0-rc.1",
"@salesforce/vscode-service-provider": "1.3.0-rc.3",
"expand-home-dir": "0.0.3",
"find-java-home": "0.2.0",
"shelljs": "0.8.5",
Expand Down
8 changes: 6 additions & 2 deletions packages/salesforcedx-vscode-apex/src/languageServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ import {
retrieveAAMethodAccessModifiers,
retrieveAAPropDefModifiers,
retrieveAAPropAccessModifiers,
retrieveAAAnnotations,
retrieveAAClassRestAnnotations,
retrieveAAMethodRestAnnotations,
retrieveAAMethodAnnotations,
retrieveGeneralClassAccessModifiers,
retrieveGeneralMethodAccessModifiers,
retrieveGeneralPropAccessModifiers
Expand Down Expand Up @@ -170,7 +172,9 @@ export const buildClientOptions = (): LanguageClientOptions => {
apexActionMethodAccessModifiers: retrieveAAMethodAccessModifiers().join(','),
apexActionPropDefModifiers: retrieveAAPropDefModifiers().join(','),
apexActionPropAccessModifiers: retrieveAAPropAccessModifiers().join(','),
apexActionAnnotations: retrieveAAAnnotations().join(','),
apexActionClassRestAnnotations: retrieveAAClassRestAnnotations().join(','),
apexActionMethodRestAnnotations: retrieveAAMethodRestAnnotations().join(','),
apexActionMethodAnnotations: retrieveAAMethodAnnotations().join(','),
apexOASClassAccessModifiers: retrieveGeneralClassAccessModifiers().join(','),
apexOASMethodAccessModifiers: retrieveGeneralMethodAccessModifiers().join(','),
apexOASPropAccessModifiers: retrieveGeneralPropAccessModifiers().join(',')
Expand Down
19 changes: 15 additions & 4 deletions packages/salesforcedx-vscode-apex/src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ const APEX_ACTION_METHOD_DEF_MODIFIERS = ['static'];
const APEX_ACTION_METHOD_ACCESS_MODIFIERS = ['global', 'public'];
const APEX_ACTION_PROP_DEF_MODIFIERS = ['static'];
const APEX_ACTION_PROP_ACCESS_MODIFIERS = ['global', 'public'];
const APEX_ACTION_ANNOTATIONS = ['AuraEnabled', 'RestResource'];
const APEX_ACTION_CLASS_REST_ANNOTATION = ['RestResource'];
const APEX_ACTION_METHOD_REST_ANNOTATION = ['HttpDelete', 'HttpGet', 'HttpPatch', 'HttpPost', 'HttpPut'];
const APEX_ACTION_METHOD_ANNOTATION = ['AuraEnabled'];

// Default eligibility for general OAS generation. Users can changed the setting through VSCode configurations
const DEFAULT_CLASS_ACCESS_MODIFIERS = ['global', 'public'];
Expand Down Expand Up @@ -78,11 +80,20 @@ export const retrieveAAPropAccessModifiers = (): string[] => {
return [...new Set([...APEX_ACTION_PROP_ACCESS_MODIFIERS, ...userDefinedModifiers])];
};

export const retrieveAAAnnotations = (): string[] => {
export const retrieveAAMethodAnnotations = (): string[] => {
const userDefinedModifiers = vscode.workspace
.getConfiguration()
.get<string[]>('salesforcedx-vscode-apex.apexoas.aa.annotations', []);
return [...new Set([...APEX_ACTION_ANNOTATIONS, ...userDefinedModifiers])];
.get<string[]>('salesforcedx-vscode-apex.apexoas.aa.method.annotations', []);
return [...new Set([...APEX_ACTION_METHOD_ANNOTATION, ...userDefinedModifiers])];
};

// The REST-related annotations should not be edited by users
export const retrieveAAClassRestAnnotations = (): string[] => {
return [...new Set([...APEX_ACTION_CLASS_REST_ANNOTATION])];
};

export const retrieveAAMethodRestAnnotations = (): string[] => {
return [...new Set([...APEX_ACTION_METHOD_REST_ANNOTATION])];
};

export const retrieveGeneralClassAccessModifiers = (): string[] =>
Expand Down
2 changes: 1 addition & 1 deletion packages/salesforcedx-vscode-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@salesforce/source-deploy-retrieve-bundle": "12.7.4",
"@salesforce/templates": "62.0.1",
"@salesforce/ts-types": "2.0.12",
"@salesforce/vscode-service-provider": "^1.3.0-rc.1",
"@salesforce/vscode-service-provider": "1.3.0-rc.3",
"adm-zip": "0.5.10",
"applicationinsights": "1.0.7",
"glob": "^7.1.2",
Expand Down

0 comments on commit 420f306

Please sign in to comment.