Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request allows other vs code extensions to access object running and object files renaming functionality by exporting it as na api. It is done by returning new ObjectNamesApi object from extension activation function. This object has 2 public members: RunObjectApi and ObjectNamesApi.
Exported API
RunObjectApi is just a proxy that calls methods from existing DynamicsNAV class and exposes these 4 functions:
ObjectNamesApi is also a proxy that uses existing NAVObject class and allows other vs code extensions to use crs-al-language-extension patterns to generate object names and object file names. These 4 functions are exposed:
How to use it
To use these new APIs in dependent extensions, you have to call vscode.extensions.getExtension function to get the extension object. The next step is to check if extension is active. If it is active, then public api can be found in 'exports' member of the extension object. If it is not active then call to async activate() method will activate it and return public api object. This example gets crs-al-language-extension api and calls GetObjectFileName function.
Example above is not the best one as it uses 'any' type so it is not helping developer to choose the right functions using intellisense. To solve this problem, ObjectNamesApi, RunObjectApi and ObjectNamesApi classes implement interfaces defined in 'src/api/CRSExtensionPublicApiInterfaces.ts' file. You can copy this file to your extension and then import it to be able to see all available members and functions. Modified sample code can look like this one: