Skip to content
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

Support using .NET 6 OmniSharp #4926

Merged
merged 7 commits into from
Dec 6, 2021
Merged
Show file tree
Hide file tree
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
163 changes: 156 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,30 @@
"win32"
],
"architectures": [
"x86",
"arm64"
"x86"
],
"installTestPath": "./.omnisharp/1.37.17/OmniSharp.exe",
"platformId": "win-x86",
"isFramework": true,
"integrity": "95ECBABF821ED45E4E6F3173E2165C5F593FC4611040475DBD6D54C16D78F4F8"
},
{
"id": "OmniSharp",
"description": "OmniSharp for Windows (.NET 6 / x86)",
"url": null,
"fallbackUrl": null,
"installPath": null,
"platforms": [
"win32"
],
"architectures": [
"x86"
],
"installTestPath": null,
"platformId": "win-x86",
"isFramework": false,
"integrity": null
},
{
"id": "OmniSharp",
"description": "OmniSharp for Windows (.NET 4.6 / x64)",
Expand All @@ -154,11 +171,63 @@
],
"installTestPath": "./.omnisharp/1.37.17/OmniSharp.exe",
"platformId": "win-x64",
"isFramework": true,
"integrity": "BD81F1284FA4A9E6D63292074D0304B65CD39C24539CB761B54E8727619070DF"
},
{
"id": "OmniSharp",
"description": "OmniSharp for Windows (.NET 6 / x64)",
"url": null,
"fallbackUrl": null,
"installPath": null,
"platforms": [
"win32"
],
"architectures": [
"x86_64"
],
"installTestPath": null,
"platformId": "win-x64",
"isFramework": false,
"integrity": null
},
{
"id": "OmniSharp",
"description": "OmniSharp for Windows (.NET 4.6 / arm64)",
"url": "https://download.visualstudio.microsoft.com/download/pr/47df6cf8-7648-4fff-9e9c-304f0202d31c/c868258dbd98f22b60154552f432edfa/omnisharp-win-x64-1.37.17.zip",
"fallbackUrl": "https://roslynomnisharp.blob.core.windows.net/releases/1.37.17/omnisharp-win-x64-1.37.17.zip",
"installPath": ".omnisharp/1.37.17",
"platforms": [
"win32"
],
"architectures": [
"arm64"
],
"installTestPath": "./.omnisharp/1.37.17/OmniSharp.exe",
"platformId": "win-arm64",
"isFramework": true,
"integrity": "BD81F1284FA4A9E6D63292074D0304B65CD39C24539CB761B54E8727619070DF"
},
{
"id": "OmniSharp",
"description": "OmniSharp for OSX",
"description": "OmniSharp for Windows (.NET 6 / arm64)",
"url": null,
"fallbackUrl": null,
"installPath": null,
"platforms": [
"win32"
],
"architectures": [
"arm64"
],
"installTestPath": null,
"platformId": "win-arm64",
"isFramework": false,
"integrity": null
},
{
"id": "OmniSharp",
"description": "OmniSharp for OSX (Mono / x64)",
"url": "https://download.visualstudio.microsoft.com/download/pr/47df6cf8-7648-4fff-9e9c-304f0202d31c/9f560aead2b823079775c00110972c04/omnisharp-osx-1.37.17.zip",
"fallbackUrl": "https://roslynomnisharp.blob.core.windows.net/releases/1.37.17/omnisharp-osx-1.37.17.zip",
"installPath": ".omnisharp/1.37.17",
Expand All @@ -171,11 +240,52 @@
],
"installTestPath": "./.omnisharp/1.37.17/run",
"platformId": "osx",
"isFramework": true,
"integrity": "43D6B18F390B8ED92231044E87413831E565E9AB5938223B19CA97B3628DDDF4"
},
{
"id": "OmniSharp",
"description": "OmniSharp for Linux (x86)",
"description": "OmniSharp for OSX (.NET 6 / x64)",
"url": null,
"fallbackUrl": null,
"installPath": null,
"platforms": [
"darwin"
],
"architectures": [
"x86_64"
],
"binaries": [
"OmniSharp"
],
"installTestPath": null,
"platformId": "osx-x64",
"isFramework": false,
"integrity": null
},
{
"id": "OmniSharp",
"description": "OmniSharp for OSX (.NET 6 / arm64)",
"url": null,
"fallbackUrl": null,
"installPath": null,
"platforms": [
"darwin"
],
"architectures": [
"arm64"
],
"binaries": [
"OmniSharp"
],
"installTestPath": null,
"platformId": "osx-arm64",
"isFramework": false,
"integrity": null
},
{
"id": "OmniSharp",
"description": "OmniSharp for Linux (Mono / x86)",
"url": "https://download.visualstudio.microsoft.com/download/pr/47df6cf8-7648-4fff-9e9c-304f0202d31c/6f3d66d4ffa4fa627225221fb00e106e/omnisharp-linux-x86-1.37.17.zip",
"fallbackUrl": "https://roslynomnisharp.blob.core.windows.net/releases/1.37.17/omnisharp-linux-x86-1.37.17.zip",
"installPath": ".omnisharp/1.37.17",
Expand All @@ -192,11 +302,12 @@
],
"installTestPath": "./.omnisharp/1.37.17/run",
"platformId": "linux-x86",
"isFramework": true,
"integrity": "75676E50D9FB62B9DC20A6A10E65420B54EFE2FFAE80AC21F59A4C483A4902BB"
},
{
"id": "OmniSharp",
"description": "OmniSharp for Linux (x64)",
"description": "OmniSharp for Linux (Mono / x64)",
"url": "https://download.visualstudio.microsoft.com/download/pr/47df6cf8-7648-4fff-9e9c-304f0202d31c/6cf1b92d91f942929922013b2139cca9/omnisharp-linux-x64-1.37.17.zip",
"fallbackUrl": "https://roslynomnisharp.blob.core.windows.net/releases/1.37.17/omnisharp-linux-x64-1.37.17.zip",
"installPath": ".omnisharp/1.37.17",
Expand All @@ -212,11 +323,32 @@
],
"installTestPath": "./.omnisharp/1.37.17/run",
"platformId": "linux-x64",
"isFramework": true,
"integrity": "34276181B4C1F9968AFA10DEC058F6A2D79DE362FA01B565A04E879CA84A74FE"
},
{
"id": "OmniSharp",
"description": "OmniSharp for Linux (arm64)",
"description": "OmniSharp for Linux (.NET 6 / x64)",
"url": null,
"fallbackUrl": null,
"installPath": null,
"platforms": [
"linux"
],
"architectures": [
"x86_64"
],
"binaries": [
"OmniSharp"
],
"installTestPath": null,
"platformId": "linux-x64",
"isFramework": false,
"integrity": null
},
{
"id": "OmniSharp",
"description": "OmniSharp for Linux (Framework / arm64)",
"url": null,
"fallbackUrl": null,
"installPath": null,
Expand All @@ -232,7 +364,8 @@
],
"installTestPath": null,
"platformId": "linux-arm64",
"integrity": null
"integrity": null,
"isFramework": true
},
{
"id": "Debugger",
Expand Down Expand Up @@ -742,6 +875,13 @@
"scope": "machine",
"description": "Specifies the path to OmniSharp. When left empty the OmniSharp version pinned to the C# Extension is used. This can be the absolute path to an OmniSharp executable, a specific version number, or \"latest\". If a version number or \"latest\" is specified, the appropriate version of OmniSharp will be downloaded on your behalf. Setting \"latest\" is an opt-in into latest beta releases of OmniSharp."
},
"omnisharp.useModernNet": {
"type": "boolean",
"default": false,
"scope": "window",
"title": "Use .NET 6 build of OmniSharp (experimental)",
"description": "Use OmniSharp build for .NET 6. This version _does not_ support non-SDK-style .NET Framework projects, including Unity. SDK-style Framework, .NET Core, and .NET 5+ projects should see significant performance improvements, but there may still be bugs. Please open issues if you find any bugs."
},
"omnisharp.useGlobalMono": {
"type": "string",
"default": "auto",
Expand All @@ -766,6 +906,15 @@
"scope": "machine",
"description": "Specifies the path to a mono installation to use when \"useGlobalMono\" is set to \"always\", instead of the default system one. Example: \"/Library/Frameworks/Mono.framework/Versions/Current\""
},
"omnisharp.dotnetPath": {
"type": [
"string",
"null"
],
"default": null,
"scope": "window",
"description": "Specified the path to a dotnet installation to use when \"useModernNet\" is set to true, instead of the default system one. Example: \"/home/username/mycustomdotnetdirectory\"."
},
"omnisharp.waitForDebugger": {
"type": "boolean",
"default": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

export interface MonoInformation {
export interface HostExecutableInformation {
version: string;
path: string;
env: NodeJS.ProcessEnv;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/

import { Options } from "../omnisharp/options";
import { MonoInformation } from "./MonoInformation";
import { HostExecutableInformation } from "./HostExecutableInformation";

export interface IMonoResolver {
getGlobalMonoInfo(options: Options): Promise<MonoInformation>;
}
export interface IHostExecutableResolver {
getHostExecutableInfo(options: Options): Promise<HostExecutableInformation>;
}
4 changes: 2 additions & 2 deletions src/features/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import { PlatformInformation } from '../platform';
import CompositeDisposable from '../CompositeDisposable';
import OptionProvider from '../observers/OptionProvider';
import reportIssue from './reportIssue';
import { IMonoResolver } from '../constants/IMonoResolver';
import { IHostExecutableResolver } from '../constants/IHostExecutableResolver';
import { getDotnetInfo } from '../utils/getDotnetInfo';
import { getDecompilationAuthorization, resetDecompilationAuthorization } from '../omnisharp/decompilationPrompt';

export default function registerCommands(context: vscode.ExtensionContext, server: OmniSharpServer, platformInfo: PlatformInformation, eventStream: EventStream, optionProvider: OptionProvider, monoResolver: IMonoResolver, packageJSON: any, extensionPath: string): CompositeDisposable {
export default function registerCommands(context: vscode.ExtensionContext, server: OmniSharpServer, platformInfo: PlatformInformation, eventStream: EventStream, optionProvider: OptionProvider, monoResolver: IHostExecutableResolver, packageJSON: any, extensionPath: string): CompositeDisposable {
let disposable = new CompositeDisposable();
disposable.add(vscode.commands.registerCommand('o.restart', async () => restartOmniSharp(context, server, optionProvider)));
disposable.add(vscode.commands.registerCommand('o.pickProjectAndStart', async () => pickProjectAndStart(server, optionProvider)));
Expand Down
10 changes: 5 additions & 5 deletions src/features/reportIssue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import { CSharpExtensionId } from "../constants/CSharpExtensionId";
import { EventStream } from "../EventStream";
import { OpenURL } from "../omnisharp/loggingEvents";
import { Options } from "../omnisharp/options";
import { IMonoResolver } from "../constants/IMonoResolver";
import { IHostExecutableResolver } from "../constants/IHostExecutableResolver";
import { IGetDotnetInfo } from "../constants/IGetDotnetInfo";

const issuesUrl = "https://github.com/OmniSharp/omnisharp-vscode/issues/new";

export default async function reportIssue(vscode: vscode, eventStream: EventStream, getDotnetInfo: IGetDotnetInfo, isValidPlatformForMono: boolean, options: Options, monoResolver: IMonoResolver) {
export default async function reportIssue(vscode: vscode, eventStream: EventStream, getDotnetInfo: IGetDotnetInfo, isValidPlatformForMono: boolean, options: Options, monoResolver: IHostExecutableResolver) {
const dotnetInfo = await getDotnetInfo();
const monoInfo = await getMonoIfPlatformValid(isValidPlatformForMono, options, monoResolver);
let extensions = getInstalledExtensions(vscode);
Expand Down Expand Up @@ -81,11 +81,11 @@ ${tableHeader}\n${table};
return extensionTable;
}

async function getMonoIfPlatformValid(isValidPlatformForMono: boolean, options: Options, monoResolver: IMonoResolver): Promise<string> {
async function getMonoIfPlatformValid(isValidPlatformForMono: boolean, options: Options, monoResolver: IHostExecutableResolver): Promise<string> {
if (isValidPlatformForMono) {
let monoVersion: string;
try {
let globalMonoInfo = await monoResolver.getGlobalMonoInfo(options);
let globalMonoInfo = await monoResolver.getHostExecutableInfo(options);
if (globalMonoInfo) {
monoVersion = `OmniSharp using global mono :${globalMonoInfo.version}`;
}
Expand Down Expand Up @@ -116,4 +116,4 @@ function getInstalledExtensions(vscode: vscode) {
function getCsharpExtensionVersion(vscode: vscode): string {
const extension = vscode.extensions.getExtension(CSharpExtensionId);
return extension.packageJSON.version;
}
}
8 changes: 4 additions & 4 deletions src/observers/OmnisharpLoggerObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ export class OmnisharpLoggerObserver extends BaseLoggerObserver {

private handleOmnisharpLaunch(event: OmnisharpLaunch) {
this.logger.append(`OmniSharp server started`);
if (event.monoVersion) {
this.logger.append(` with Mono ${event.monoVersion}`);
if (event.monoPath !== undefined) {
this.logger.append(` (${event.monoPath})`);
if (event.hostVersion) {
this.logger.append(` with ${event.hostIsMono ? 'Mono' : '.NET'} ${event.hostVersion}`);
if (event.hostPath !== undefined) {
this.logger.append(` (${event.hostPath})`);
}
}
this.logger.appendLine('.');
Expand Down
1 change: 1 addition & 0 deletions src/observers/OptionChangeObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const omniSharpOptions: ReadonlyArray<OptionsKey> = [
"enableImportCompletion",
"organizeImportsOnFormat",
"enableAsyncCompletion",
"useModernNet",
];

function OmniSharpOptionChangeObservable(optionObservable: Observable<Options>): Observable<Options> {
Expand Down
Loading