Skip to content

Commit

Permalink
chore: eligibility criteria for class and method annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
mingxuanzhangsfdx committed Dec 13, 2024
1 parent 90b83ba commit d84d771
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
6 changes: 4 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,8 @@ import {
retrieveAAMethodAccessModifiers,
retrieveAAPropDefModifiers,
retrieveAAPropAccessModifiers,
retrieveAAAnnotations,
retrieveAAClassAnnotations,
retrieveAAMethodAnnotations,
retrieveGeneralClassAccessModifiers,
retrieveGeneralMethodAccessModifiers,
retrieveGeneralPropAccessModifiers
Expand Down Expand Up @@ -170,7 +171,8 @@ export const buildClientOptions = (): LanguageClientOptions => {
apexActionMethodAccessModifiers: retrieveAAMethodAccessModifiers().join(','),
apexActionPropDefModifiers: retrieveAAPropDefModifiers().join(','),
apexActionPropAccessModifiers: retrieveAAPropAccessModifiers().join(','),
apexActionAnnotations: retrieveAAAnnotations().join(','),
apexActionClassAnnotations: retrieveAAClassAnnotations().join(','),
apexActionMethodAnnotations: retrieveAAMethodAnnotations().join(','),
apexOASClassAccessModifiers: retrieveGeneralClassAccessModifiers().join(','),
apexOASMethodAccessModifiers: retrieveGeneralMethodAccessModifiers().join(','),
apexOASPropAccessModifiers: retrieveGeneralPropAccessModifiers().join(',')
Expand Down
16 changes: 12 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,8 @@ 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_ANNOTATION = ['AuraEnabled', 'RestResource'];
const APEX_ACTION_METHOD_ANNOTATION = ['AuraEnabled', 'HttpDelete', 'HttpGet', 'HttpPatch', 'HttpPost', 'HttpPut'];

// 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 +79,18 @@ export const retrieveAAPropAccessModifiers = (): string[] => {
return [...new Set([...APEX_ACTION_PROP_ACCESS_MODIFIERS, ...userDefinedModifiers])];
};

export const retrieveAAAnnotations = (): string[] => {
export const retrieveAAClassAnnotations = (): 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.class.annotations', []);
return [...new Set([...APEX_ACTION_CLASS_ANNOTATION, ...userDefinedModifiers])];
};

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

export const retrieveGeneralClassAccessModifiers = (): string[] =>
Expand Down

0 comments on commit d84d771

Please sign in to comment.