Skip to content

Document azure-dev.commands.getDotEnvFilePath for use in VS Code configurations #5218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link

@Copilot Copilot AI commented May 21, 2025

This PR adds documentation for the azure-dev.commands.getDotEnvFilePath command, which can be used in VS Code configurations to access environment variables from Azure Developer CLI environments.

Changes:

  • Added a new documentation file for VS Code extension commands at /ext/vscode/docs/commands.md
  • Documented the getDotEnvFilePath command with usage instructions and examples
  • Updated the VS Code extension README to link to the new documentation
  • Added JSDoc comments to the getDotEnvFilePath function for better code-level documentation

Example usage in launch.json:

{
  "configurations": [
    {
      // Your debug configuration
      "envFile": "${input:azdDotenv}"
    }
  ],
  "inputs": [
    {
      "id": "azdDotenv",
      "type": "command",
      "command": "azure-dev.commands.getDotEnvFilePath"
    }
  ]
}

This allows VS Code to use environment variables from an Azure Developer environment's .env file when running or debugging applications, which was previously undocumented but useful functionality.

Fixes #5135.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits May 21, 2025 18:00
Co-authored-by: spboyer <7681382+spboyer@users.noreply.github.com>
Co-authored-by: spboyer <7681382+spboyer@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Should document azure-dev.commands.getDotEnvFilePath Document azure-dev.commands.getDotEnvFilePath for use in VS Code configurations May 21, 2025
@Copilot Copilot AI requested a review from spboyer May 21, 2025 18:02
Copilot finished work on behalf of spboyer May 21, 2025 18:02
@spboyer
Copy link
Member

spboyer commented May 22, 2025

@brandom-msft can you review?

@brandom-msft
Copy link
Member

@brandom-msft can you review?

Guessing you meant @bwateratmsft?

Copy link
Contributor

@bwateratmsft bwateratmsft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spboyer I wonder if this wouldn't be better fulfilled with a page on https://code.visualstudio.com/docs/?

Comment on lines +8 to +34
/**
* Get the path to the .env file for an Azure developer environment.
*
* This can be used in launch.json to provide environment variables to VS Code tasks:
* ```json
* {
* "configurations": [
* {
* "envFile": "${input:azdDotenv}"
* }
* ],
* "inputs": [
* {
* "id": "azdDotenv",
* "type": "command",
* "command": "azure-dev.commands.getDotEnvFilePath"
* }
* ]
* }
* ```
*
* @param context - The VS Code extension action context
* @param args - Optional array containing [environmentName, workingDir]
* - environmentName: Name of the environment to use (uses default if not provided)
* - workingDir: Working directory to find environments (uses first workspace folder if not provided)
* @returns Path to the .env file for the specified environment
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's nothing particularly mistaken here, but I am not sure it's even helpful to add this JSDoc. The function cannot be called directly, rather you need to use one of the utils wrappers like callWithTelemetryAndErrorHandling, or in this particular case, registerCommand's wrapping.

@spboyer I'll leave it up to you.

@@ -5,6 +5,9 @@ This extension makes it easier to run, create Azure Resources, and deploy Azure
## What It Does
For more information about Azure Developer CLI and this VS Code extension, please [see the documentation](https://aka.ms/azure-dev/vscode).

## Extension Documentation
- [Available Commands](docs/commands.md) - Documentation for commands provided by this extension, including utility commands for use in VS Code configurations.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not know if a relative link to another doc will work on the marketplace page or in VSCode itself--it needs to be tested.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The relative link format has been kept as-is in commit 6d20ad5. If there are issues with this format in the marketplace or VS Code itself, we can address it in a follow-up PR after testing.

Co-authored-by: bwateratmsft <36966225+bwateratmsft@users.noreply.github.com>
Copilot finished work on behalf of bwateratmsft May 22, 2025 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should document azure-dev.commands.getDotEnvFilePath
4 participants