workspace

package
v0.0.0-...-dfd24c6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterIssues

func FilterIssues(issues []vulnmap.Issue, supportedIssueTypes map[product.FilterableIssueType]bool) []vulnmap.Issue

func Set

func Set(w *Workspace)

Types

type Folder

type Folder struct {
	// contains filtered or unexported fields
}

Folder contains files that can be scanned, it orchestrates vulnmap scans and provides a caching layer to avoid unnecessary computing

func NewFolder

func NewFolder(path string, name string, scanner vulnmap.Scanner, hoverService hover.Service, scanNotifier vulnmap.ScanNotifier, notifier noti.Notifier) *Folder

func (*Folder) AllIssuesFor

func (f *Folder) AllIssuesFor(filePath string) (matchingIssues []vulnmap.Issue)

func (*Folder) ClearDiagnostics

func (f *Folder) ClearDiagnostics()

func (*Folder) ClearDiagnosticsByIssueType

func (f *Folder) ClearDiagnosticsByIssueType(removedType product.FilterableIssueType)

func (*Folder) ClearDiagnosticsFromFile

func (f *Folder) ClearDiagnosticsFromFile(filePath string)

ClearDiagnosticsFromFile will clear all diagnostics of a file from memory, and send a notification to the client with empty diagnostics results for the specific file

func (*Folder) ClearDiagnosticsFromPathRecursively

func (f *Folder) ClearDiagnosticsFromPathRecursively(removedPath string)

func (*Folder) ClearScannedStatus

func (f *Folder) ClearScannedStatus()

func (*Folder) Contains

func (f *Folder) Contains(path string) bool

func (*Folder) DocumentDiagnosticsFromCache

func (f *Folder) DocumentDiagnosticsFromCache(file string) []vulnmap.Issue

func (*Folder) FilterAndPublishCachedDiagnostics

func (f *Folder) FilterAndPublishCachedDiagnostics(product product.Product)

func (*Folder) IsScanned

func (f *Folder) IsScanned() bool

func (*Folder) IsTrusted

func (f *Folder) IsTrusted() bool

func (*Folder) IssuesFor

func (f *Folder) IssuesFor(filePath string, requestedRange vulnmap.Range) (matchingIssues []vulnmap.Issue)

func (*Folder) Name

func (f *Folder) Name() string

func (*Folder) Path

func (f *Folder) Path() string

func (*Folder) ScanFile

func (f *Folder) ScanFile(ctx context.Context, path string)

func (*Folder) ScanFolder

func (f *Folder) ScanFolder(ctx context.Context)

func (*Folder) SetStatus

func (f *Folder) SetStatus(status FolderStatus)

func (*Folder) Status

func (f *Folder) Status() FolderStatus

type FolderStatus

type FolderStatus int
const (
	Unscanned FolderStatus = iota
	Scanned   FolderStatus = iota
)

type Workspace

type Workspace struct {
	// contains filtered or unexported fields
}

Workspace represents the highest entity in an IDE that contains code. A workspace may contain multiple folders

func Get

func Get() *Workspace

todo can we move to di?

func New

func New(instrumentor performance.Instrumentor,
	scanner vulnmap.Scanner,
	hoverService hover.Service,
	scanNotifier vulnmap.ScanNotifier,
	notifier noti.Notifier,
) *Workspace

func (*Workspace) AddFolder

func (w *Workspace) AddFolder(f *Folder)

func (*Workspace) ChangeWorkspaceFolders

func (w *Workspace) ChangeWorkspaceFolders(ctx context.Context, params lsp.DidChangeWorkspaceFoldersParams)

ChangeWorkspaceFolders clears the "Removed" folders, adds the "New" folders, and starts an automatic scan if auto-scans are enabled.

func (*Workspace) ClearIssues

func (w *Workspace) ClearIssues(_ context.Context)

func (*Workspace) ClearIssuesByType

func (w *Workspace) ClearIssuesByType(removedType product.FilterableIssueType)

func (*Workspace) DeleteFile

func (w *Workspace) DeleteFile(filePath string)

func (*Workspace) EndRequestTrustCommunication

func (w *Workspace) EndRequestTrustCommunication()

func (*Workspace) Folders

func (w *Workspace) Folders() (folder []*Folder)

func (*Workspace) GetFolderContaining

func (w *Workspace) GetFolderContaining(path string) (folder *Folder)

func (*Workspace) GetFolderTrust

func (w *Workspace) GetFolderTrust() (trusted []*Folder, untrusted []*Folder)

func (*Workspace) IsTrustRequestOngoing

func (w *Workspace) IsTrustRequestOngoing() bool

func (*Workspace) IssuesFor

func (w *Workspace) IssuesFor(path string, r vulnmap.Range) []vulnmap.Issue

func (*Workspace) RemoveFolder

func (w *Workspace) RemoveFolder(folderPath string)

func (*Workspace) ScanWorkspace

func (w *Workspace) ScanWorkspace(ctx context.Context)

func (*Workspace) StartRequestTrustCommunication

func (w *Workspace) StartRequestTrustCommunication()

func (*Workspace) TrustFoldersAndScan

func (w *Workspace) TrustFoldersAndScan(ctx context.Context, foldersToBeTrusted []*Folder)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL