1

I am looking to build a VSCode Extension around a CLI tool which we have been working on. An example command would be

myCLI retrieve SourceName

This would be run from a specific directory (for example c:/workspace/myproject) which has been setup and contains a settings.json file for some config arguments.

This CLI has been designed that the methods which are called (for example 'retrieve') are exposed directly so the CLI itself is a wrapper also.

When trying to call these methods directly from a VS Code Extension, it is always checking in the C:/Program Files/Microsoft VS Code directory, which I understand is where the Extension is excuting from.

Now, the question: Is there any way for me to force that any time we call the method (for example 'retrieve') that this would look into the current workspace folder (C:/workspace/myProject) , and not the VS Code one (C:/Program Files/Microsoft VS Code)?

Notes which may change answers

  • CommonJS (not yet ESM)
  • We currently cannot pass in a full qualified path (for example C:/workspace/myProject), it is only looking for ./settings.json since it depends on where the CLI has bene run from
  • I want to avoid calling the CLI directly, as I would like to bring many of the CLI features into the VS Code Extension directly to improve user friendliness.
Doug
  • 113
  • 4

0 Answers0