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

Download razor telemetry nupkg and include in vsix #7236

Merged
merged 10 commits into from
Jun 18, 2024
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ out
.razor/
.razoromnisharp/
.razortelemetry/
.razorDevKit/
.vscode-test/
dist/
*.razor.json
Expand Down
2 changes: 1 addition & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
!.roslynDevKit/**
!.omnisharp/**
!.razor/**
!.razorDevKit/**
!.razoromnisharp/**
!.razortelemetry/**
.rpt2_cache/**
.github/**
.vscode/**
Expand Down
120 changes: 1 addition & 119 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@
"defaults": {
"roslyn": "4.11.0-3.24313.9",
"omniSharp": "1.39.11",
"razor": "9.0.0-preview.24311.4",
"razor": "9.0.0-preview.24316.1",
"razorOmnisharp": "7.0.0-preview.23363.1",
"razorTelemetry": "7.0.0-preview.24178.4",
"xamlTools": "17.11.35013.26"
},
"main": "./dist/extension",
Expand Down Expand Up @@ -687,123 +686,6 @@
"binaries": [
"./rzls"
]
},
{
"id": "RazorTelemetry",
"description": "Razor Language Server Telemetry (Windows / x64)",
"url": "https://download.visualstudio.microsoft.com/download/pr/534f8426-a4f4-4b2d-b3ba-c4e16a38c48c/5a98d8f4e481dbb7ae3cdb3695b75c46/devkittelemetry-win-x64-7.0.0-preview.24178.4.zip",
"installPath": ".razortelemetry",
"platforms": [
"win32"
],
"architectures": [
"x86_64"
],
"integrity": "2C575C90AFFD159CD3A0F96AB3C74C939F6E774E409816C802763383782137EC"
},
{
"id": "RazorTelemetry",
"description": "Razor Language Server Telemetry (Windows / ARM64)",
"url": "https://download.visualstudio.microsoft.com/download/pr/534f8426-a4f4-4b2d-b3ba-c4e16a38c48c/4f16ff826fedd33ad80d265c5409588b/devkittelemetry-win-arm64-7.0.0-preview.24178.4.zip",
"installPath": ".razortelemetry",
"platforms": [
"win32"
],
"architectures": [
"arm64"
],
"integrity": "9B0787738031C6FA1F0CF50C888926949ED08ECE17EDA006F31422E0BE8EAAD1"
},
{
"id": "RazorTelemetry",
"description": "Razor Language Server Telemetry (Linux / x64)",
"url": "https://download.visualstudio.microsoft.com/download/pr/534f8426-a4f4-4b2d-b3ba-c4e16a38c48c/f58cf629939f0df77d142be881f9e233/devkittelemetry-linux-x64-7.0.0-preview.24178.4.zip",
"installPath": ".razortelemetry",
"platforms": [
"linux"
],
"architectures": [
"x86_64"
],
"integrity": "E7607984AB18D29CF3BA71D22D70A8952896657FD29D7892926EA9A73CCC87F3"
},
{
"id": "RazorTelemetry",
"description": "Razor Language Server Telemetry (Linux ARM64)",
"url": "https://download.visualstudio.microsoft.com/download/pr/534f8426-a4f4-4b2d-b3ba-c4e16a38c48c/704e369c5905f9ece819ebce77fb78d8/devkittelemetry-linux-arm64-7.0.0-preview.24178.4.zip",
"installPath": ".razortelemetry",
"platforms": [
"linux"
],
"architectures": [
"arm64"
],
"integrity": "42E2263FAA4A13307899DA520C488082E241FFDE6A61A5639828A171C8423BF5"
},
{
"id": "RazorTelemetry",
"description": "Razor Language Server Telemetry (Linux musl / x64)",
"url": "https://download.visualstudio.microsoft.com/download/pr/534f8426-a4f4-4b2d-b3ba-c4e16a38c48c/c75e84ff813be5c9833d96dc2066a364/devkittelemetry-linux-musl-x64-7.0.0-preview.24178.4.zip",
"installPath": ".razortelemetry",
"platforms": [
"linux-musl"
],
"architectures": [
"x86_64"
],
"integrity": "C6C737B0707415C8EE9DB185C8A776FAB50BF1F8250C9EF8D756283ADA5FE518"
},
{
"id": "RazorTelemetry",
"description": "Razor Language Server Telemetry (Linux musl ARM64)",
"url": "https://download.visualstudio.microsoft.com/download/pr/534f8426-a4f4-4b2d-b3ba-c4e16a38c48c/4049a66147717a53860bbc969bf32faa/devkittelemetry-linux-musl-arm64-7.0.0-preview.24178.4.zip",
"installPath": ".razortelemetry",
"platforms": [
"linux-musl"
],
"architectures": [
"arm64"
],
"integrity": "14421ED81E82094CA13498B6B338950EDA605189A3FD91211EDCE554AB330070"
},
{
"id": "RazorTelemetry",
"description": "Razor Language Server Telemetry (macOS / x64)",
"url": "https://download.visualstudio.microsoft.com/download/pr/534f8426-a4f4-4b2d-b3ba-c4e16a38c48c/36545ba0998f1fc380e877e38b2f35f1/devkittelemetry-osx-x64-7.0.0-preview.24178.4.zip",
"installPath": ".razortelemetry",
"platforms": [
"darwin"
],
"architectures": [
"x86_64"
],
"integrity": "D081FA25B5B0DF99175690E6F903720F10ADF9AD0CAC684C29715B841C6D6BB3"
},
{
"id": "RazorTelemetry",
"description": "Razor Language Server Telemetry (macOS ARM64)",
"url": "https://download.visualstudio.microsoft.com/download/pr/534f8426-a4f4-4b2d-b3ba-c4e16a38c48c/1c912419ea45c8d95cfa28a8a04640dc/devkittelemetry-osx-arm64-7.0.0-preview.24178.4.zip",
"installPath": ".razortelemetry",
"platforms": [
"darwin"
],
"architectures": [
"arm64"
],
"integrity": "28D9F1E00151773078A26BDB9917CE6823E9D5D76799788238FE4AE7644A1493"
},
{
"id": "RazorTelemetry",
"description": "Razor Language Server Telemetry (Platform Agnostic)",
"url": "https://download.visualstudio.microsoft.com/download/pr/534f8426-a4f4-4b2d-b3ba-c4e16a38c48c/0a32698e8ba1ab93489d79f34f8ae8d0/devkittelemetry-platformagnostic-7.0.0-preview.24178.4.zip",
"installPath": ".razortelemetry",
"platforms": [
"netural"
],
"architectures": [
"neutral"
],
"integrity": "3FDF8F19E66C85F06692BE2AA5803437C387EB65C6262030CD301388C3EB6261"
}
],
"engines": {
Expand Down
13 changes: 9 additions & 4 deletions src/lsptoolshost/builtInComponents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ export const componentInfo: { [key: string]: ComponentInfo } = {
'Microsoft.VisualStudio.DesignTools.CodeAnalysis.Diagnostics.dll',
],
},
razorDevKit: {
defaultFolderName: '.razorDevKit',
optionName: 'razorDevKit',
componentDllPaths: ['Microsoft.VisualStudio.DevKit.Razor.dll'],
},
};

export function getComponentPaths(componentName: string, options: LanguageServerOptions): string[] {
export function getComponentPaths(componentName: string, options: LanguageServerOptions | undefined): string[] {
Copy link
Member

Choose a reason for hiding this comment

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

instead of having this undefined you could consider adding the razorDevkit folder as a component path option. Then you would be able to override it for local development.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the only issue I have with that is the structure LanguageServerOptions has a lot of concepts that don't apply to razor. Could we move the options to a lighter interface?

Copy link
Member

Choose a reason for hiding this comment

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

I guess technically the other options aren't relevant to you, but you can just import languageServerOptions and pass it to the function (without caring what else is on it). Actually, frankly builtInComponents.ts should probably just call languageServerOptions.componentPaths and not even have options be a parameter.

Copy link
Member

Choose a reason for hiding this comment

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

We could move it to CommonOptions as well, but not sure if its necessary to do that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, frankly builtInComponents.ts should probably just call languageServerOptions.componentPaths and not even have options be a parameter

I'll look into that. Seems cleaner

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually let me see about that in a follow up. Would like to get this in for now since I'll likely have another razor change coming in that will require dual insertion

const component = componentInfo[componentName];
const baseFolder = getComponentFolderPath(component, options);
const paths = component.componentDllPaths.map((dllPath) => path.join(baseFolder, dllPath));
Expand All @@ -42,13 +47,13 @@ export function getComponentPaths(componentName: string, options: LanguageServer
return paths;
}

export function getComponentFolder(componentName: string, options: LanguageServerOptions): string {
export function getComponentFolder(componentName: string, options: LanguageServerOptions | undefined): string {
const component = componentInfo[componentName];
return getComponentFolderPath(component, options);
}

function getComponentFolderPath(component: ComponentInfo, options: LanguageServerOptions): string {
if (options.componentPaths) {
function getComponentFolderPath(component: ComponentInfo, options: LanguageServerOptions | undefined): string {
if (options?.componentPaths) {
const optionValue = options.componentPaths[component.optionName];
if (optionValue) {
return optionValue;
Expand Down
16 changes: 0 additions & 16 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ import { registerOmnisharpOptionChanges } from './omnisharp/omnisharpOptionChang
import { RoslynLanguageServerEvents } from './lsptoolshost/languageServerEvents';
import { ServerStateChange } from './lsptoolshost/serverStateChange';
import { SolutionSnapshotProvider } from './lsptoolshost/services/solutionSnapshotProvider';
import { RazorTelemetryDownloader } from './razor/razorTelemetryDownloader';
import { commonOptions, languageServerOptions, omnisharpOptions, razorOptions } from './shared/options';
import { BuildResultDiagnostics } from './lsptoolshost/services/buildResultReporterService';
import { debugSessionTracker } from './coreclrDebug/provisionalDebugSessionTracker';
Expand Down Expand Up @@ -130,21 +129,6 @@ export async function activate(
let projectInitializationCompletePromise: Promise<void> | undefined = undefined;

if (!useOmnisharpServer) {
// Download Razor server telemetry bits if DevKit is installed.
if (csharpDevkitExtension && vscode.env.isTelemetryEnabled) {
const razorTelemetryDownloader = new RazorTelemetryDownloader(
networkSettingsProvider,
eventStream,
context.extension.packageJSON,
platformInfo,
context.extension.extensionPath
);

await razorTelemetryDownloader.DownloadAndInstallRazorTelemetry(
context.extension.packageJSON.defaults.razorTelemetry
);
}

// Activate Razor. Needs to be activated before Roslyn so commands are registered in the correct order.
// Otherwise, if Roslyn starts up first, they could execute commands that don't yet exist on Razor's end.
//
Expand Down
71 changes: 0 additions & 71 deletions src/razor/razorTelemetryDownloader.ts

This file was deleted.

15 changes: 6 additions & 9 deletions src/razor/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import * as path from 'path';
import * as vscode from 'vscode';
import * as vscodeapi from 'vscode';
import * as util from '../../common';
import { ExtensionContext } from 'vscode';
import { BlazorDebugConfigurationProvider } from './blazorDebug/blazorDebugConfigurationProvider';
import { CodeActionsHandler } from './codeActions/codeActionsHandler';
Expand Down Expand Up @@ -55,6 +53,7 @@ import { resolveRazorLanguageServerOptions } from './razorLanguageServerOptionsR
import { RazorFormatNewFileHandler } from './formatNewFile/razorFormatNewFileHandler';
import { InlayHintHandler } from './inlayHint/inlayHintHandler';
import { InlayHintResolveHandler } from './inlayHint/inlayHintResolveHandler';
import { getComponentPaths } from '../../lsptoolshost/builtInComponents';

// We specifically need to take a reference to a particular instance of the vscode namespace,
// otherwise providers attempt to operate on the null extension.
Expand Down Expand Up @@ -99,13 +98,11 @@ export async function activate(
await setupDevKitEnvironment(dotnetInfo.env, csharpDevkitExtension, logger);

if (vscode.env.isTelemetryEnabled) {
const telemetryExtensionPath = path.join(
util.getExtensionPath(),
'.razortelemetry',
'Microsoft.VisualStudio.DevKit.Razor.dll'
);
if (await util.fileExists(telemetryExtensionPath)) {
telemetryExtensionDllPath = telemetryExtensionPath;
const razorComponentPaths = getComponentPaths('razorDevKit', undefined);
if (razorComponentPaths.length !== 1) {
logger.logError('Failed to find Razor DevKit telemetry extension path.', undefined);
} else {
telemetryExtensionDllPath = razorComponentPaths[0];
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions tasks/offlinePackagingTasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
devKitDependenciesDirectory,
xamlToolsDirectory,
razorLanguageServerDirectory,
razorDevKitDirectory,
} from '../tasks/projectPaths';
import { getPackageJSON } from '../tasks/packageJson';
import { createPackageAsync } from '../tasks/vsceTasks';
Expand Down Expand Up @@ -91,6 +92,12 @@ export const allNugetPackages: { [key: string]: NugetPackageInfo } = {
getPackageContentPath: (platformInfo) => path.join('content', 'LanguageServer', platformInfo?.rid ?? 'neutral'),
vsixOutputPath: razorLanguageServerDirectory,
},
razorDevKit: {
getPackageName: (_platformInfo) => 'Microsoft.VisualStudio.DevKit.Razor',
packageJsonName: 'razor',
getPackageContentPath: (_platformInfo) => 'content',
vsixOutputPath: razorDevKitDirectory,
},
};

const vsixTasks: string[] = [];
Expand Down Expand Up @@ -175,6 +182,9 @@ gulp.task(
// Run the fetch of all packages, and then also installDependencies after
gulp.series(async () => {
await updateNugetPackageVersion(allNugetPackages.razor);

// Also pull in the Razor DevKit dependencies nuget package.
await acquireNugetPackage(allNugetPackages.razorDevKit, undefined, getPackageJSON(), true);
}, 'installDependencies')
);

Expand Down
1 change: 1 addition & 0 deletions tasks/projectPaths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const languageServerDirectory = path.join(rootPath, '.roslyn');
export const devKitDependenciesDirectory = path.join(rootPath, componentInfo.roslynDevKit.defaultFolderName);
export const xamlToolsDirectory = path.join(rootPath, componentInfo.xamlTools.defaultFolderName);
export const razorLanguageServerDirectory = path.join(rootPath, '.razor');
export const razorDevKitDirectory = path.join(rootPath, componentInfo.razorDevKit.defaultFolderName);

export const codeExtensionPath = commandLineOptions.codeExtensionPath || rootPath;

Expand Down