Skip to content

Commit

Permalink
feat: implement ossService using LS
Browse files Browse the repository at this point in the history
  • Loading branch information
j-luong committed Oct 23, 2023
1 parent 9b59e18 commit db6b4a4
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 227 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import {
ProviderResult,
Range,
Selection,
TextDocument,
TextDocument

Check failure on line 15 in src/snyk/snykOss/codeActions/vulnerabilityCodeActionProvider.ts

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu-latest)

Insert `,`
} from '../../common/vscode/types';
import { DIAGNOSTICS_OSS_COLLECTION_NAME } from '../../snykCode/constants/analysis';
import { messages } from '../messages/vulnerabilityCount';
import { isResultCliError } from '../ossResult';
import { OssService } from '../services/ossService';
import { OssService } from '../ossService';
import { ModuleVulnerabilityCountProvider } from '../services/vulnerabilityCount/vulnerabilityCountProvider';

export class VulnerabilityCodeActionProvider implements CodeActionProvider {
Expand All @@ -28,7 +28,7 @@ export class VulnerabilityCodeActionProvider implements CodeActionProvider {
private readonly vulnerabilityCountProvider: ModuleVulnerabilityCountProvider,
private readonly codeActionKindProvider: ICodeActionKindAdapter,
private readonly analytics: IAnalytics,
) {}
) { }

Check failure on line 31 in src/snyk/snykOss/codeActions/vulnerabilityCodeActionProvider.ts

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu-latest)

Delete `·`

async provideCodeActions(
document: TextDocument,
Expand Down
63 changes: 63 additions & 0 deletions src/snyk/snykOss/ossService.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

import { Subscription } from "rxjs";
import { IAnalytics } from "../common/analytics/itly";
import { IConfiguration } from "../common/configuration/configuration";
import { IWorkspaceTrust } from "../common/configuration/trustedFolders";
import { ILanguageServer } from "../common/languageServer/languageServer";
import { OssIssueData, Scan, ScanProduct } from "../common/languageServer/types";
import { ILog } from "../common/logger/interfaces";
import { ProductService } from "../common/services/productService";
import { IViewManagerService } from "../common/services/viewManagerService";
import { ICodeActionAdapter, ICodeActionKindAdapter } from "../common/vscode/codeAction";
import { ExtensionContext } from "../common/vscode/extensionContext";
import { IVSCodeLanguages } from "../common/vscode/languages";
import { IVSCodeWorkspace } from "../common/vscode/workspace";
import { IOssSuggestionWebviewProvider } from "./views/interfaces";


export class OssService extends ProductService<OssIssueData> {
constructor(
readonly codeActionAdapter: ICodeActionAdapter,
readonly codeActionKindAdapter: ICodeActionKindAdapter,
readonly analytics: IAnalytics,
extensionContext: ExtensionContext,
suggestionProvider: IOssSuggestionWebviewProvider,
viewManagerService: IViewManagerService,
workspace: IVSCodeWorkspace,
workspaceTrust: IWorkspaceTrust,
languageServer: ILanguageServer,
languages: IVSCodeLanguages,
logger: ILog,
config: IConfiguration,
) {
super(
extensionContext,
config,
suggestionProvider,
viewManagerService,
workspace,
workspaceTrust,
languageServer,
languages,
logger,
);

this.regiserCodeActionsProvider(
// TODO: implement OssCodeActionsProvider
);
}

subscribeToLsScanMessages(): Subscription {
return this.languageServer.scan$.subscribe((scan: Scan<OssIssueData>) => {
if (scan.product !== ScanProduct.OpenSource) {
return;
}

super.handleLsScanMessage(scan);
});
}

refreshTreeView() {
this.viewManagerService.refreshIacView();
}
}
224 changes: 0 additions & 224 deletions src/snyk/snykOss/services/ossService.ts

This file was deleted.

0 comments on commit db6b4a4

Please sign in to comment.