Provide an idea you would like to see in the tool?
To be able to implement SQL 4 CDS I would need to be able to communicate between the Typescript tool and a separate dotnet process that handles the actual query execution using the MarkMpn.Sql4Cds.Engine package. The general structure of this could be:
- Install a SQL 4 CDS tool using the standard npm feed. This tool would include all the UI logic
- Running the tool would download a separate background worker app which would be a .NET console app (unless this app could also be included in the npm package).
- The tool would then start this background worker app but instead of it running to completion and returning the output as the existing
toolboxAPI.terminal.execute API does, it would stay running and listen for input on the stdio stream
- When the user runs a query in the tool, the details of that query would be sent to the background process by writing to its input stream. If the worker process needs to execute a Dataverse request like run a FetchXML query, it would send a request back to the tool via the its output stream which the tool could listen to and use the normal
dataverseAPI functions to execute before passing the results back via the same streams.
This approach mirrors the LSP structure commonly used by VS Code to allow language providers to expose features such as autocomplete to the main host - https://code.visualstudio.com/api/language-extensions/language-server-extension-guide.
This approach would allow the same core SQL 4 CDS engine to be used within PPTB as XTB and other platforms, while keeping access to Dataverse within the same sandbox as is already being used by other tools.
One possible implementation would be to extend the existing toolboxAPI.terminal.execute function to allow returning the details of the process after it has started but without waiting for it to complete, and include access to the standard input and output streams of that process so that the tool can implement the LSP protocol using a package such as vscode-languageclient.
Alternatively the toolbox could expose a specific LSP API so that this pattern is more encoded into the platform, so the tool would define the app to run as the background process and the API returns the LSP client object directly.
Relevant log output
Provide an idea you would like to see in the tool?
To be able to implement SQL 4 CDS I would need to be able to communicate between the Typescript tool and a separate dotnet process that handles the actual query execution using the MarkMpn.Sql4Cds.Engine package. The general structure of this could be:
toolboxAPI.terminal.executeAPI does, it would stay running and listen for input on the stdio streamdataverseAPIfunctions to execute before passing the results back via the same streams.This approach mirrors the LSP structure commonly used by VS Code to allow language providers to expose features such as autocomplete to the main host - https://code.visualstudio.com/api/language-extensions/language-server-extension-guide.
This approach would allow the same core SQL 4 CDS engine to be used within PPTB as XTB and other platforms, while keeping access to Dataverse within the same sandbox as is already being used by other tools.
One possible implementation would be to extend the existing
toolboxAPI.terminal.executefunction to allow returning the details of the process after it has started but without waiting for it to complete, and include access to the standard input and output streams of that process so that the tool can implement the LSP protocol using a package such asvscode-languageclient.Alternatively the toolbox could expose a specific LSP API so that this pattern is more encoded into the platform, so the tool would define the app to run as the background process and the API returns the LSP client object directly.
Relevant log output