From 075dcabe58ec4e21228568c34780cb1e3e50dc71 Mon Sep 17 00:00:00 2001 From: Roland Grunberg Date: Mon, 7 Oct 2024 11:09:49 -0400 Subject: [PATCH] Remove Dependency Analytics extension from being recommended. - redhat.fabric8-analytics Signed-off-by: Roland Grunberg --- src/extension.ts | 6 ---- src/recommendation/dependencyAnalytics.ts | 43 ----------------------- src/recommendation/index.ts | 17 --------- 3 files changed, 66 deletions(-) delete mode 100644 src/recommendation/dependencyAnalytics.ts delete mode 100644 src/recommendation/index.ts diff --git a/src/extension.ts b/src/extension.ts index a7488b73d..03d177da8 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -21,7 +21,6 @@ import { markdownPreviewProvider } from "./markdownPreviewProvider"; import { OutputInfoCollector } from './outputInfoCollector'; import { collectJavaExtensions, getBundlesToReload, getShortcuts, IJavaShortcut, isContributedPartUpdated } from './plugin'; import { fixJdtSchemeHoverLinks, registerClientProviders } from './providerDispatcher'; -import { initialize as initializeRecommendation } from './recommendation'; import * as requirements from './requirements'; import { languageStatusBarProvider } from './runtimeStatusBarProvider'; import { serverStatusBarProvider, ShortcutQuickPickItem } from './serverStatusBarProvider'; @@ -34,7 +33,6 @@ import { convertToGlob, deleteClientLog, deleteDirectory, ensureExists, getBuild import glob = require('glob'); import { Telemetry } from './telemetry'; import { getMessage } from './errorUtils'; -import { TelemetryService } from '@redhat-developer/vscode-redhat-telemetry/lib'; import { activationProgressNotification } from "./serverTaskPresenter"; import { loadSupportedJreNames } from './jdkUtils'; import { BuildFileSelector, PICKED_BUILD_FILES, cleanupWorkspaceState } from './buildFilesSelector'; @@ -149,12 +147,8 @@ export async function activate(context: ExtensionContext): Promise } initializeLogFile(clientLogFile); - const telemetryService: Promise = Telemetry.startTelemetry(context); - enableJavadocSymbols(); - initializeRecommendation(context, telemetryService); - registerOutOfMemoryDetection(storagePath); cleanJavaWorkspaceStorage(); diff --git a/src/recommendation/dependencyAnalytics.ts b/src/recommendation/dependencyAnalytics.ts deleted file mode 100644 index b1470c44a..000000000 --- a/src/recommendation/dependencyAnalytics.ts +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. - -'use strict'; - -import { IRecommendationService, Recommendation } from "@redhat-developer/vscode-extension-proposals/lib"; -import * as vscode from "vscode"; - -const EXTENSION_NAME = "redhat.fabric8-analytics"; -const GH_ORG_URL = `https://github.com/fabric8-analytics`; -let alreadyShown = false; -export function initialize (context: vscode.ExtensionContext, recommendService: IRecommendationService): Recommendation[] { - const ret: Recommendation = createDependencyRecommendation(recommendService); - delayedShowDependencyRecommendation(context, recommendService); - return [ret]; -} - -function createDependencyRecommendation(recommendService: IRecommendationService): Recommendation { - const r1 = recommendService.create(EXTENSION_NAME, "Dependency Analytics", - `The [Dependency Analytics](${GH_ORG_URL}) extension helps you to stay informed about vulnerable dependencies in pom.xml files.`, false); - return r1; -} - -async function delayedShowDependencyRecommendation (context: vscode.ExtensionContext, recommendService: IRecommendationService): Promise { - await new Promise(f => setTimeout(f, 6000)); - const isPomDotXmlOpened = vscode.workspace.textDocuments.findIndex(doc => isPomDotXml(doc.uri)) !== -1; - if (isPomDotXmlOpened) { - recommendService.show(EXTENSION_NAME); - } else { - context.subscriptions.push(vscode.workspace.onDidOpenTextDocument(e => { - // I would prefer to delete this listener after showing once, but i can't figure out how ;) - if( !alreadyShown ) { - if (isPomDotXml(e.uri)) { - recommendService.show(EXTENSION_NAME); - alreadyShown = true; - } - } - })); - } -} - -function isPomDotXml(uri: vscode.Uri) { - return !!uri.path && uri.path.toLowerCase().endsWith("pom.xml"); -} \ No newline at end of file diff --git a/src/recommendation/index.ts b/src/recommendation/index.ts deleted file mode 100644 index 8162e097a..000000000 --- a/src/recommendation/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. - -'use strict'; - -import * as vscode from "vscode"; -import { initialize as initDependencyAnalytics } from "./dependencyAnalytics"; -import { TelemetryService } from "@redhat-developer/vscode-redhat-telemetry/lib"; -import { IRecommendationService, Recommendation, RecommendationCore } from "@redhat-developer/vscode-extension-proposals/lib"; - -export async function initialize (context: vscode.ExtensionContext, telemetry: Promise): Promise { - const telem: TelemetryService = await telemetry; - const recommendService: IRecommendationService | undefined = RecommendationCore.getService(context, telem); - if( recommendService ) { - const fromDependencyAnalytics: Recommendation[] = initDependencyAnalytics(context, recommendService); - recommendService.register(fromDependencyAnalytics); - } -}