anzwdev / al-code-outline

AL Code Outline for Visual Studio Code
MIT License
51 stars 13 forks source link

Apply Default API settings when creating an api query #521

Closed jorispoppe closed 6 months ago

jorispoppe commented 8 months ago

I have set default API settings in my json file.

 "alOutline.defaultApiGroup": "MyGroup",
 "alOutline.defaultApiPublisher": "MyPublisher",
 "alOutline.defaultApiVersion": "v2.0",

When i create a page of type API with the wizard, the defaults are set as expected. But they are not set when I create a query of type API with the wizard.

Can the defaults also be applied when creating queries of type API??

PS: I'm not an expert on Typescript but i think you can just add the following code in the alQueryWizard.ts:

wizardData.apiPublisher = StringHelper.defaultIfEmpty(config.get<string>('defaultApiPublisher'), wizardData.apiPublisher);
wizardData.apiGroup = StringHelper.defaultIfEmpty(config.get<string>('defaultApiGroup'), wizardData.apiGroup);
wizardData.apiVersion = StringHelper.defaultIfEmpty(config.get<string>('defaultApiVersion'), wizardData.apiVersion);

after the line:

wizardData.objectName = '';

similar to the alPageWizard.ts code.

anzwdev commented 6 months ago

Thank you for reporting this missing functionality. It has been implemented in the latest release.

jorispoppe commented 6 months ago

Works as expected.