Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Sniff for dotnet-sdk and don't do what OmniSharp already does #20

Merged
merged 1 commit into from
Jun 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ async function getDotnetPath(version?: string) {
version: version ?? dotnetSdkVersion,
requestingExtensionId: 'ms-dotnettools.vscode-dotnet-pack'
};
const result = await vscode.commands.executeCommand('dotnet-sdk.acquireStatus', request);
return result?.dotnetPath;
const commands = await vscode.commands.getCommands();
if (commands.includes('dotnet-sdk.acquireStatus')) {
const result = await vscode.commands.executeCommand('dotnet-sdk.acquireStatus', request);
return result?.dotnetPath;
} else {
return undefined;
}
}

async function initializeExtension(_operationId: string, context: vscode.ExtensionContext) {
Expand All @@ -58,12 +63,6 @@ async function initializeDependencies() {

// Acquire .NET Interactive
initializeDependency("ms-dotnettools.dotnet-interactive-vscode", "dotnet-interactive.acquire", sdkResult?.dotnetPath);

// Start OmniSharp
initializeDependency("ms-dotnettools.csharp", "o.restart");
Copy link
Member

Choose a reason for hiding this comment

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

It would be useful to activate the C# extension to kick off dependency acquisition. However, there is no need to execute either of the commands.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I'm thinking we should just not do that for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, confirmed that this works without issue. I will merge this and publish an update, since functionally this doesn't really change things other than no longer causing this conflict.


// Download Debugger
initializeDependency("ms-dotnettools.csharp", "csharp.downloadDebugger");
}

async function initializeDependency(extensionName: string, command: string, commandArgs?: any): Promise<any> {
Expand Down