Skip to content

Commit 7849f1d

Browse files
committed
Introducing the concept of neutral packages. Added the new "installed" folder to gitignore for dev workflows.
1 parent afdab75 commit 7849f1d

File tree

5 files changed

+63
-17
lines changed

5 files changed

+63
-17
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ out
1515
.razorDevKit/
1616
.razorExtension/
1717
.vscode-test/
18+
.roslynCopilot/
1819
msbuild/signing/signJs/*.log
1920
msbuild/signing/signVsix/*.log
2021
dist/

package.json

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -424,18 +424,14 @@
424424
},
425425
{
426426
"id": "RoslynCopilot",
427-
"description": "Language server for Roslyn Copilot integration (Windows)",
427+
"description": "Language server for Roslyn Copilot integration",
428428
"url": "https://roslyn.blob.core.windows.net/releases/Microsoft.VisualStudio.Copilot.Roslyn.LanguageServer-17.0.460-alpha-g8013717149",
429429
"installPath": ".roslynCopilot",
430430
"platforms": [
431-
"win32",
432-
"linux",
433-
"linux-musl",
434-
"darwin"
431+
"neutral"
435432
],
436433
"architectures": [
437-
"x86_64",
438-
"arm64"
434+
"neutral"
439435
],
440436
"installTestPath": "./.roslynCopilot/Microsoft.VisualStudio.Copilot.Roslyn.LanguageServer.dll",
441437
"integrity": "9944EBD6EE06BD595BCADD3057CD9BEF4105C3A3952DAE03E54F3114E2E6661F"

src/lsptoolshost/server/roslynLanguageServer.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import * as path from 'path';
88
import * as cp from 'child_process';
99
import * as uuid from 'uuid';
1010
import * as net from 'net';
11-
import * as fs from 'fs';
12-
import * as util from '../../common';
1311
import {
1412
LanguageClientOptions,
1513
MessageTransports,
@@ -687,7 +685,7 @@ export class RoslynLanguageServer {
687685
const csharpDevKitArgs = this.getCSharpDevKitExportArgs(additionalExtensionPaths);
688686
args = args.concat(csharpDevKitArgs);
689687

690-
await this.setupDevKitEnvironment(dotnetInfo.env, csharpDevkitExtension, additionalExtensionPaths, channel);
688+
await this.setupDevKitEnvironment(dotnetInfo.env, csharpDevkitExtension, additionalExtensionPaths);
691689
} else {
692690
// C# Dev Kit is not installed - continue C#-only activation.
693691
channel.info('Activating C# standalone...');
@@ -1066,8 +1064,7 @@ export class RoslynLanguageServer {
10661064
private static async setupDevKitEnvironment(
10671065
env: NodeJS.ProcessEnv,
10681066
csharpDevkitExtension: vscode.Extension<CSharpDevKitExports>,
1069-
additionalExtensionPaths: string[],
1070-
channel: vscode.LogOutputChannel
1067+
additionalExtensionPaths: string[]
10711068
): Promise<void> {
10721069
const exports: CSharpDevKitExports = await csharpDevkitExtension.activate();
10731070

src/packageManager/packageFilterer.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { PlatformInformation } from '../shared/platform';
77
import * as util from '../common';
88
import { AbsolutePathPackage } from './absolutePathPackage';
99

10+
const NEUTRAL = 'neutral';
11+
1012
export async function getNotInstalledPackagesForPlatform(
1113
packages: AbsolutePathPackage[],
1214
platformInfo: PlatformInformation
@@ -17,7 +19,11 @@ export async function getNotInstalledPackagesForPlatform(
1719

1820
export function filterPlatformPackages(packages: AbsolutePathPackage[], platformInfo: PlatformInformation) {
1921
return packages.filter(
20-
(pkg) => pkg.architectures.includes(platformInfo.architecture) && pkg.platforms.includes(platformInfo.platform)
22+
(pkg) =>
23+
// Match architecture, packages declared neutral are included as well.
24+
(pkg.architectures.includes(NEUTRAL) || pkg.architectures.includes(platformInfo.architecture)) &&
25+
// Match platform, packages declared neutral are included as well.
26+
(pkg.platforms.includes(NEUTRAL) || pkg.platforms.includes(platformInfo.platform))
2127
);
2228
}
2329

test/omnisharp/omnisharpUnitTests/packages/packageFilterer.test.ts

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,24 @@ describe(`${getNotInstalledPackagesForPlatform.name}`, () => {
5555
architectures: ['architecture2'],
5656
installPath: 'path3',
5757
},
58+
{
59+
description: 'neutral platform and architecture uninstalled package',
60+
platforms: ['neutral'],
61+
architectures: ['neutral'],
62+
installPath: 'path6',
63+
},
64+
{
65+
description: 'neutral platform but specific architecture package',
66+
platforms: ['neutral'],
67+
architectures: ['architecture1'],
68+
installPath: 'path7',
69+
},
70+
{
71+
description: 'specific platform but neutral architecture package',
72+
platforms: ['linux'],
73+
architectures: ['neutral'],
74+
installPath: 'path8',
75+
},
5876
];
5977

6078
beforeEach(async () => {
@@ -79,18 +97,46 @@ describe(`${getNotInstalledPackagesForPlatform.name}`, () => {
7997
test('Filters the packages based on Platform Information', async () => {
8098
const platformInfo = new PlatformInformation('win32', 'architecture2');
8199
const filteredPackages = await getNotInstalledPackagesForPlatform(absolutePathPackages, platformInfo);
82-
expect(filteredPackages.length).toEqual(1);
100+
expect(filteredPackages.length).toEqual(2);
83101
expect(filteredPackages[0].description).toEqual('win32-Architecture2 uninstalled package');
84102
expect(filteredPackages[0].platforms[0]).toEqual('win32');
85103
expect(filteredPackages[0].architectures[0]).toEqual('architecture2');
104+
105+
expect(filteredPackages[1].description).toEqual('neutral platform and architecture uninstalled package');
106+
expect(filteredPackages[1].platforms[0]).toEqual('neutral');
107+
expect(filteredPackages[1].architectures[0]).toEqual('neutral');
86108
});
87109

88110
test('Returns only the packages where install.Lock is not present', async () => {
89111
const platformInfo = new PlatformInformation('linux', 'architecture1');
90112
const filteredPackages = await getNotInstalledPackagesForPlatform(absolutePathPackages, platformInfo);
113+
// Should include linux-Architecture1 package + neutral package (both uninstalled)
114+
expect(filteredPackages.length).toEqual(4);
115+
116+
const descriptions = filteredPackages.map((pkg) => pkg.description);
117+
expect(descriptions).toContain('linux-Architecture1 uninstalled package');
118+
expect(descriptions).toContain('neutral platform and architecture uninstalled package');
119+
expect(descriptions).toContain('neutral platform but specific architecture package');
120+
expect(descriptions).toContain('specific platform but neutral architecture package');
121+
});
122+
123+
test('Returns only neutral packages when no platform-specific packages match', async () => {
124+
const platformInfo = new PlatformInformation('darwin', 'arm64'); // Non-existent platform/arch combo
125+
const filteredPackages = await getNotInstalledPackagesForPlatform(absolutePathPackages, platformInfo);
126+
127+
// Should only include neutral package (uninstalled one)
128+
expect(filteredPackages.length).toEqual(1);
129+
expect(filteredPackages[0].description).toEqual('neutral platform and architecture uninstalled package');
130+
expect(filteredPackages[0].platforms[0]).toEqual('neutral');
131+
expect(filteredPackages[0].architectures[0]).toEqual('neutral');
132+
});
133+
134+
test('Filters out installed neutral packages', async () => {
135+
const platformInfo = new PlatformInformation('darwin', 'arm64'); // Only neutral packages should match
136+
const filteredPackages = await getNotInstalledPackagesForPlatform(absolutePathPackages, platformInfo);
137+
138+
// Should only return uninstalled neutral package, not the installed one
91139
expect(filteredPackages.length).toEqual(1);
92-
expect(filteredPackages[0].description).toEqual('linux-Architecture1 uninstalled package');
93-
expect(filteredPackages[0].platforms[0]).toEqual('linux');
94-
expect(filteredPackages[0].architectures[0]).toEqual('architecture1');
140+
expect(filteredPackages[0].description).toEqual('neutral platform and architecture uninstalled package');
95141
});
96142
});

0 commit comments

Comments
 (0)