Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Extension API #104
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.
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: