Skip to content

feat: Prompt for dotnet restore when SDK package not resolved (#29)#78

Open
daviburg wants to merge 13 commits into
mainfrom
feature/restore-prompt
Open

feat: Prompt for dotnet restore when SDK package not resolved (#29)#78
daviburg wants to merge 13 commits into
mainfrom
feature/restore-prompt

Conversation

@daviburg
Copy link
Copy Markdown
Member

@daviburg daviburg commented May 11, 2026

Problem

When a project has a PackageReference for the Connector SDK but dotnet restore has not been run yet (no obj/project.assets.json), the extension silently fails to discover the SDK. All IntelliSense features are disabled with no user feedback.

Fix

After SDK discovery fails in startLanguageServer(), detect the 'csproj references SDK but assets missing' case and prompt the user to run dotnet restore.

Changes

  • checkForMissingRestore() - uses vscode.workspace.findFiles to locate .csproj files referencing Azure.Connectors.Sdk or Microsoft.Azure.Connectors.Sdk (via regex matching PackageReference Include/Update attributes), then checks if obj/project.assets.json is missing
  • Prompt in startLanguageServer() - after resolveSdkPath() returns undefined, if no explicit sdkPath/sdkNupkgPath is configured and a project needs restore, shows an info message with a Restore button
  • On Restore click - runs dotnet restore via vscode.tasks with ProcessExecution (safe from shell injection), returns early without starting an SDK-less server, then restarts the language server after restore completes if project.assets.json was produced
  • findSdkFromProjectAssets updated to recognize both SDK package names

Safeguards

  • One prompt per session - module-level restorePromptShown flag prevents nagging; reset if restore fails so user can retry
  • No false positives - regex matches PackageReference Include/Update attributes specifically; skips projects with custom IntermediateOutputPath (checks csproj and Directory.Build.props/targets walking up to workspace root)
  • Error handling - task execution wrapped in try/catch; async post-restore logic wrapped in try/catch with output channel logging
  • No changes to LSP server C# code, existing SDK discovery logic steps 1-4, or package.json activation events

Verification

  • npm run compile passes
  • npm run lint passes

Closes #29

Copilot AI review requested due to automatic review settings May 11, 2026 21:09
@daviburg daviburg requested a review from a team as a code owner May 11, 2026 21:09
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a VS Code prompt to help users recover IntelliSense when the Connector SDK can’t be discovered because dotnet restore hasn’t produced obj/project.assets.json yet.

Changes:

  • Detects “SDK referenced but assets missing” by scanning workspace .csproj files.
  • Prompts the user to run dotnet restore (one prompt per session) and restarts the language server on completion.
  • Introduces recursive scanning helper with depth/skip-directory constraints.

Comment thread vscode-extension/src/extension.ts Outdated
Comment thread vscode-extension/src/extension.ts Outdated
Comment thread vscode-extension/src/extension.ts Outdated
@daviburg daviburg requested a review from Copilot May 11, 2026 22:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment thread vscode-extension/src/extension.ts Outdated
Comment thread vscode-extension/src/extension.ts Outdated
Comment thread vscode-extension/src/extension.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread vscode-extension/src/extension.ts Outdated
Comment thread vscode-extension/src/extension.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment thread vscode-extension/src/extension.ts Outdated
Comment thread vscode-extension/src/extension.ts Outdated
Comment thread vscode-extension/src/extension.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment thread vscode-extension/src/extension.ts
Comment thread vscode-extension/src/extension.ts
Comment thread vscode-extension/src/extension.ts Outdated
…ckageReference check, check Directory.Build.props
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread vscode-extension/src/extension.ts Outdated
Comment thread vscode-extension/src/extension.ts
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment thread vscode-extension/src/extension.ts Outdated
Comment thread vscode-extension/src/extension.ts
Comment thread vscode-extension/src/extension.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment thread vscode-extension/src/extension.ts Outdated
Comment thread vscode-extension/src/extension.ts Outdated
Comment thread vscode-extension/src/extension.ts
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread vscode-extension/src/extension.ts
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread vscode-extension/src/extension.ts
Comment thread vscode-extension/src/extension.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread vscode-extension/src/extension.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment thread vscode-extension/src/extension.ts
Comment thread vscode-extension/src/extension.ts
Comment thread vscode-extension/src/extension.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread vscode-extension/src/extension.ts
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

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.

Prompt for dotnet restore when SDK package not resolved

2 participants