Skip to content

Commit

Permalink
Require version of runtime extension with API fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dibarbet committed Oct 31, 2024
1 parent c9121fc commit 12f338e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/lsptoolshost/dotnetRuntimeExtensionResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { commonOptions, languageServerOptions } from '../shared/options';
import { existsSync } from 'fs';
import { CSharpExtensionId } from '../constants/csharpExtensionId';
import { readFile } from 'fs/promises';
import { IDotnetFindPathContext } from './dotnetRuntimeExtensionApi';
import { IDotnetAcquireResult, IDotnetFindPathContext } from './dotnetRuntimeExtensionApi';

export const DotNetRuntimeVersion = '8.0.10';

Expand Down Expand Up @@ -49,8 +49,15 @@ export class DotnetRuntimeExtensionResolver implements IHostExecutableResolver {
},
versionSpecRequirement: 'greater_than_or_equal',
};
const result = await vscode.commands.executeCommand<string>('dotnet.findPath', findPathRequest);
dotnetExecutablePath = result;
const result = await vscode.commands.executeCommand<IDotnetAcquireResult | undefined>(
'dotnet.findPath',
findPathRequest
);
if (result === undefined) {
throw new Error('Failed to locate .NET runtime');
}

dotnetExecutablePath = result.dotnetPath;
}

const hostInfo = {
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export async function activate(
}

const dotnetRuntimeExtensionId = 'ms-dotnettools.vscode-dotnet-runtime';
const requiredDotnetRuntimeExtensionVersion = '2.2.1';
const requiredDotnetRuntimeExtensionVersion = '2.2.2';

const dotnetRuntimeExtension = vscode.extensions.getExtension(dotnetRuntimeExtensionId);
const dotnetRuntimeExtensionVersion = dotnetRuntimeExtension?.packageJSON.version;
Expand Down

0 comments on commit 12f338e

Please sign in to comment.