-
Notifications
You must be signed in to change notification settings - Fork 268
AZD VS Code Extension Updates & Improvements #6425
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
Merged
Merged
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
1d19f93
Add side panel view with My Project and Help and Feedback sections
spboyer 9e0c355
Implement My Project section with project structure
spboyer 30769cf
Add Environments section with details and variables
spboyer bec9154
Remove Environments from My Project view
spboyer 89d2924
feat(vscode): Add extensions view and enhanced environment management
spboyer ab57695
feat(vscode): Update Help and Feedback link from Resources to AZD Blo…
spboyer 15197c3
feat(vscode): Add 'Show in Azure Portal' command for services
spboyer a9f3d19
feat(vscode): Integrate environment commands with standalone Environm…
spboyer 98e0248
test(vscode): Add comprehensive unit tests for new features
spboyer 6d06b05
feat(vscode): add test dependencies and improve command handling
spboyer ef86d25
Update ext/vscode/src/views/environments/EnvironmentsTreeDataProvider.ts
spboyer 1cf4ebb
Remove debug consol logs, update for proper logging
spboyer d11000b
Update ext/vscode/src/views/environments/EnvironmentsTreeDataProvider.ts
spboyer e65e759
Update ext/vscode/src/commands/env.ts
spboyer 4324bc9
Update ext/vscode/ext/vscode/package-lock.json
spboyer 3ba2757
Update ext/vscode/src/commands/azureWorkspace/wizard/PickResourceStep.ts
spboyer e80abf2
fix build/test ts error
spboyer d316dde
fix build/tests failing
spboyer 8d0f581
fix linting errors
spboyer edfa16e
feat: Add enhanced azure.yaml editing support with IntelliSense
spboyer 56476f0
feat: Add enhanced azure.yaml editing support with IntelliSense
spboyer fe57c74
fix build error/linting
spboyer b5b058c
add copilot instructions specific to the extension
spboyer c8fb0e9
feat: Implement 'Add Service' command for azure.yaml file with user p…
spboyer 14d6ac6
fix: Remove unnecessary blank lines in addService command and tests
spboyer 13de535
feat(views): Add Template Tools section with Azure template discovery…
spboyer 4917a35
feat: Add comprehensive azure.yaml validation to prevent error pop-ups
spboyer 9470608
Address PR review feedback from @bwateratmsft
spboyer 201314b
Address PR feedback: Remove duplicate YAML functionality
spboyer c9d60c0
Add missing words to cspell dictionary
spboyer 1386cbb
Address PR feedback: cleanup and improvements
spboyer 8aaaba1
update icon to svg
spboyer 1f46371
revert icon to png due to build issue : Error: SVGs can't be used as …
spboyer 243e468
update activity icon to svg
spboyer 3b9e2f3
Address PR feedback for VS Code extension views
spboyer 52ed9e8
Merge branch 'Azure:main' into feature/side-panel-view
spboyer b7ecc73
Address Brandon's PR feedback: reduce logging, use context.ui, add l10n
spboyer b59342b
Address high-priority PR feedback items
spboyer 317ca7b
Address PR feedback from Brandon
spboyer 8919300
Address additional PR feedback
spboyer 0f10f8c
Consolidate repeated code in env.ts
spboyer 813b514
Simplify AzureDevExtensionProvider
spboyer a4faabe
Address PR feedback: use constants, clarify watcher code, add AGENTS.md
spboyer adb6504
Fix failing tests and update pre-commit instructions
spboyer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,8 @@ | ||
| { | ||
| "cSpell.import": ["cspell.yaml"], | ||
| "go.testFlags": ["-timeout", "30m"] | ||
| "go.testFlags": [ | ||
| "-timeout", | ||
| "30m" | ||
| ], | ||
| "aspire.enableSettingsFileCreationPromptOnStartup": false | ||
| } | ||
spboyer marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,196 @@ | ||
| # Azure Developer CLI VS Code Extension - Copilot Instructions | ||
|
|
||
| ## Project Overview | ||
| This is the official Visual Studio Code extension for the Azure Developer CLI (azd). It provides an integrated development experience for building, deploying, and managing Azure applications. | ||
|
|
||
| ## Core Development Principles | ||
|
|
||
| ### Documentation | ||
| - **Always keep the [README.md](../README.md) up to date** with any changes to: | ||
| - Features and functionality | ||
| - Commands and usage | ||
| - Configuration options | ||
| - Installation instructions | ||
| - Prerequisites | ||
| - Known issues or limitations | ||
|
|
||
| ### Code Quality & Testing | ||
| Before submitting any changes or pushing code, **always run the following checks** to avoid pipeline failures: | ||
|
|
||
| 1. **Linting**: `npm run lint` | ||
| - Ensures code follows TypeScript and ESLint standards | ||
| - Fix any linting errors before committing | ||
|
|
||
| 2. **Spell Check**: `npx cspell "src/**/*.ts" --config .vscode/cspell.yaml` | ||
| - Checks for spelling errors in source code | ||
| - Add technical terms to `.vscode/cspell-dictionary.txt` if needed | ||
|
|
||
| 3. **Unit Tests**: `npm run unit-test` | ||
| - Runs fast unit tests without full VS Code integration | ||
| - All tests must pass before committing | ||
| - **IMPORTANT**: If you modify existing code, ensure related tests still pass | ||
| - **IMPORTANT**: If you add new functionality, add corresponding unit tests | ||
|
|
||
| ### Pre-Commit Checklist | ||
| ✅ Run `npm run lint` and fix all issues | ||
| ✅ Run `npx cspell "src/**/*.ts" --config .vscode/cspell.yaml` and fix spelling errors | ||
| ✅ Run `npm run unit-test` and ensure all tests pass | ||
| ✅ Update [README.md](../README.md) if functionality changed | ||
| ✅ Verify merge conflicts are resolved (no `<<<<<<<`, `=======`, `>>>>>>>` markers) | ||
|
|
||
| ## Code Style & Conventions | ||
|
|
||
| ### File Organization | ||
| - Extension entry point: `src/extension.ts` | ||
| - Commands: `src/commands/` | ||
| - Language features: `src/language/` (IntelliSense, diagnostics, etc.) | ||
| - Views & tree providers: `src/views/` | ||
| - Utilities: `src/utils/` | ||
| - Tests: `src/test/` | ||
|
|
||
| ### Naming Conventions | ||
| - Use PascalCase for classes and interfaces | ||
| - Use camelCase for functions, methods, and variables | ||
| - Use descriptive names that clearly indicate purpose | ||
| - Prefix private members with underscore if needed for clarity | ||
|
|
||
| ### Copyright Headers | ||
| All TypeScript source files MUST include the Microsoft copyright header at the very top of the file: | ||
| ```typescript | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
| ``` | ||
|
|
||
| ### TypeScript Guidelines | ||
| - Use explicit types where possible, avoid `any` | ||
| - Leverage VS Code API types from `vscode` module | ||
| - Use `async/await` for asynchronous operations | ||
| - Handle errors gracefully with try/catch blocks | ||
|
|
||
| ### Azure YAML Language Features | ||
| When working on `azure.yaml` language support in `src/language/`: | ||
| - Use YAML parser from `yaml` package | ||
| - Provide helpful diagnostics with clear error messages | ||
| - Use `vscode.l10n.t()` for all user-facing strings | ||
| - Test with various `azure.yaml` configurations | ||
|
|
||
| ### Testing | ||
| - Write unit tests for new features in `src/test/suite/unit/` | ||
| - Use Mocha for test framework | ||
| - Use Chai for assertions | ||
| - Mock VS Code APIs when necessary using Sinon | ||
| - Keep tests focused and isolated | ||
|
|
||
| ## Common Tasks | ||
|
|
||
| ### Adding a New Command | ||
| 1. Create command handler in `src/commands/` | ||
| 2. Register in `src/commands/registerCommands.ts` | ||
| 3. Add to `package.json` contributions | ||
| 4. Add localized strings to `package.nls.json` | ||
| 5. Update README.md with new command documentation | ||
| 6. Add tests for the command | ||
|
|
||
| ### Adding Language Features | ||
| 1. Create provider in `src/language/` | ||
| 2. Register in `src/language/languageFeatures.ts` | ||
| 3. Test with various `azure.yaml` files | ||
| 4. Add diagnostics tests in `src/test/suite/unit/` | ||
|
|
||
| ### Debugging the Extension | ||
| - Press F5 to launch Extension Development Host | ||
| - Set breakpoints in TypeScript source | ||
| - Use Debug Console for logging | ||
| - Check Output > Azure Developer CLI for extension logs | ||
|
|
||
| ## VS Code Extension APIs | ||
| - Follow [VS Code Extension API](https://code.visualstudio.com/api) best practices | ||
| - Use `@microsoft/vscode-azext-utils` for Azure extension utilities | ||
| - Integrate with Azure Resources API via `@microsoft/vscode-azureresources-api` | ||
| - Use localization with `vscode.l10n.t()` for all user-facing text | ||
|
|
||
| ## Performance Best Practices | ||
|
|
||
| ### Activation & Startup | ||
| - **Minimize activation time**: Keep `activate()` function lightweight | ||
| - Use **lazy activation events** - be specific with `activationEvents` in package.json | ||
| - Avoid synchronous file I/O during activation | ||
| - Defer expensive operations until they're actually needed | ||
| - Use `ExtensionContext.subscriptions` for proper cleanup | ||
|
|
||
| ### Memory Management | ||
| - **Dispose resources properly**: Always dispose of subscriptions, watchers, and providers | ||
| - Use `vscode.Disposable` pattern for all resources that need cleanup | ||
| - Avoid memory leaks by unsubscribing from events when no longer needed | ||
| - Clear caches and collections when they grow too large | ||
| - Use weak references where appropriate | ||
|
|
||
| ### Asynchronous Operations | ||
| - **Never block the main thread**: Use async/await for all I/O operations | ||
| - Use `Promise.all()` for parallel operations when possible | ||
| - Implement proper cancellation using `CancellationToken` | ||
| - Debounce frequent operations (e.g., text document changes) | ||
| - Use background workers for CPU-intensive tasks | ||
|
|
||
| ### Tree Views & Data Providers | ||
| - Implement efficient `getChildren()` - return only visible items | ||
| - Cache tree data when appropriate to avoid redundant queries | ||
| - Use `vscode.EventEmitter` efficiently - only fire events when data actually changes | ||
| - Implement `getTreeItem()` to be synchronous and fast | ||
| - Use `collapsibleState` wisely to control initial expansion | ||
|
|
||
| ### Language Features | ||
| - **Debounce document change events** (see `documentDebounce.ts`) | ||
| - Use incremental parsing when possible | ||
| - Cache parsed ASTs or syntax trees | ||
| - Limit diagnostic computation to visible range when feasible | ||
| - Return early from providers when results aren't needed | ||
|
|
||
| ### File System Operations | ||
| - Use `vscode.workspace.fs` API for better performance | ||
| - Batch file operations when possible | ||
| - Use `FileSystemWatcher` instead of polling | ||
| - Avoid recursive directory scans in large workspaces | ||
| - Cache file system queries with appropriate invalidation | ||
|
|
||
| ### Commands & UI | ||
| - Keep command handlers fast and responsive | ||
| - Show progress indicators for long-running operations | ||
| - Use `withProgress()` for operations that take >1 second | ||
| - Provide cancellation support for long operations | ||
| - Avoid multiple sequential `showQuickPick` or `showInputBox` calls | ||
|
|
||
| ### Extension Size & Bundle | ||
| - Minimize extension bundle size - exclude unnecessary dependencies | ||
| - Use webpack to bundle and tree-shake code | ||
| - Lazy load large dependencies only when needed | ||
| - Consider code splitting for rarely-used features | ||
| - Optimize images and assets | ||
|
|
||
| ### Best Practices from This Codebase | ||
spboyer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - Use `documentDebounce()` utility for text change events (1000ms delay) | ||
| - Leverage `Lazy<T>` and `AsyncLazy<T>` for deferred initialization | ||
| - Implement proper `vscode.Disposable` cleanup in all providers | ||
| - Use telemetry to measure and track performance metrics | ||
| - Follow the patterns in `src/views/` for efficient tree providers | ||
|
|
||
| ### User Interface Best Practices | ||
| - All user-facing strings shown in the UI, error messages, etc. must use `vscode.l10n.t()` | ||
| - All user-facing strings in package.json must be extracted into package.nls.json | ||
| - Instead of `vscode.window.showQuickPick`, use `IActionContext.ui.showQuickPick` | ||
| - Instead of `vscode.window.showInputBox`, use `IActionContext.ui.showInputBox` | ||
| - The same applies for `showWarningMessage`, `showOpenDialog`, and `showWorkspaceFolderPick` | ||
| - FileSystemWatchers are a scarce resource on some systems - consolidate into shared watchers when possible | ||
|
|
||
| ## Build & Package | ||
| - Development build: `npm run dev-build` | ||
| - Production build: `npm run build` | ||
| - Watch mode: `npm run watch` | ||
| - Package extension: `npm run package` | ||
| - CI build: `npm run ci-build` | ||
| - CI package: `npm run ci-package` | ||
|
|
||
| ## Additional Resources | ||
| - [Azure Developer CLI Documentation](https://learn.microsoft.com/azure/developer/azure-developer-cli/) | ||
| - [VS Code Extension API](https://code.visualstudio.com/api) | ||
| - [Contributing Guide](../CONTRIBUTING.md) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -110,3 +110,6 @@ node_modules | |
| package.nls.*.json | ||
| *.vsix | ||
| *.zip | ||
|
|
||
| # Source maps | ||
| *.js.map | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| # Agent Development Guide | ||
|
|
||
| A file for [guiding coding agents](https://agents.md/). | ||
|
|
||
| ## Commands | ||
|
|
||
| - **Install dependencies:** `npm install` | ||
| - **Build:** `npm run build` | ||
| - **Lint:** `npm run lint` | ||
| - **Spell Check:** `npx cspell "src/**/*.ts" --config .vscode/cspell.yaml` | ||
| - **Unit Tests:** `npm run unit-test` | ||
| - **Watch mode:** `npm run watch` | ||
| - **Package extension:** `npm run package` | ||
|
|
||
| ## Directory Structure | ||
|
|
||
| - Extension entry point: `src/extension.ts` | ||
| - Commands: `src/commands/` | ||
| - Language features: `src/language/` (IntelliSense, diagnostics, etc.) | ||
| - Views & tree providers: `src/views/` | ||
| - Utilities: `src/utils/` | ||
| - Tests: `src/test/` | ||
| - Constants: `src/constants/` | ||
| - Services: `src/services/` | ||
|
|
||
| ## Pre-Commit Checklist | ||
|
|
||
| **IMPORTANT**: Always run these checks before committing to avoid pipeline failures: | ||
|
|
||
| 1. Run `npm run lint` and fix all issues | ||
| 2. Run `npx cspell "src/**/*.ts" --config .vscode/cspell.yaml` and fix spelling errors | ||
| 3. Run `npm run unit-test` and ensure all tests pass | ||
| 4. Update README.md if functionality changed | ||
| 5. Verify no merge conflict markers in code | ||
|
|
||
| **Testing Requirements**: | ||
| - If you modify existing code, ensure related tests still pass | ||
| - If you add new functionality, add corresponding unit tests | ||
| - Add new words to `.vscode/cspell-dictionary.txt` if cspell flags valid technical terms | ||
|
|
||
| ## Code Conventions | ||
|
|
||
| ### Copyright Headers | ||
| All TypeScript source files MUST include the Microsoft copyright header: | ||
| ```typescript | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
| ``` | ||
|
|
||
| ### Localization | ||
| - All user-facing strings shown in the UI, error messages, etc. must use `vscode.l10n.t()` | ||
| - All user-facing strings in package.json must be extracted into package.nls.json | ||
|
|
||
| ### UI Best Practices | ||
| - Instead of `vscode.window.showQuickPick`, use `IActionContext.ui.showQuickPick` | ||
| - Instead of `vscode.window.showInputBox`, use `IActionContext.ui.showInputBox` | ||
| - Same for `showWarningMessage`, `showOpenDialog`, and `showWorkspaceFolderPick` | ||
|
|
||
| ### Resource Management | ||
| - FileSystemWatchers are a scarce resource on some systems - use the shared `FileSystemWatcherService` | ||
| - Dispose resources properly using `vscode.Disposable` pattern | ||
| - Use `ExtensionContext.subscriptions` for cleanup | ||
|
|
||
| ### Testing | ||
| - Use Mocha for test framework | ||
| - Use Chai for assertions | ||
| - Mock VS Code APIs using Sinon | ||
| - Keep tests focused and isolated | ||
| - Use `UserCancelledError` from `@microsoft/vscode-azext-utils` for testing user cancellation scenarios |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.