scip

package
v0.1.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2025 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLocalSymbolInformation

func GetLocalSymbolInformation(symbols []*model.SymbolInformation, symbol string) *model.SymbolInformation

GetLocalSymbolInformation returns the symbol information for a given symbol

func GetOccurrenceForPosition

func GetOccurrenceForPosition(occurrences []*model.Occurrence, pos protocol.Position) *model.Occurrence

GetOccurrenceForPosition returns the occurrence for a given position

func GetOccurrencesForSymbol

func GetOccurrencesForSymbol(occurrences []*model.Occurrence, symbol string, role scip.SymbolRole) []*model.Occurrence

GetOccurrencesForSymbol returns the occurrences for a given symbol and role If role is -1, it will return all occurrences for the symbol

func IsMatchingPosition

func IsMatchingPosition(occ *model.Occurrence, pos protocol.Position) bool

IsMatchingPosition returns true if the occurrence matches the position

func IsRangeBefore

func IsRangeBefore(r []int32, pos protocol.Position) bool

IsRangeBefore returns true if the range is before the position

Types

type Controller

type Controller interface {
	StartupInfo(ctx context.Context) (ulspplugin.PluginInfo, error)
	GetDocumentSymbols(ctx context.Context, workspaceRoot string, uri string) ([]*model.SymbolOccurrence, error)
	GetSymbolDefinitionOccurrence(ctx context.Context, workspaceRoot string, descriptors []model.Descriptor, version string) (*model.SymbolOccurrence, error)
}

Controller defines the interface for a scip controller.

func New

func New(p Params) (Controller, error)

New creates a new controller for lint.

type FileInfo

type FileInfo struct {
	URI          uri.URI
	Document     *model.Document
	Package      *PackageMeta
	Locals       map[string]*SymbolData
	Definitions  map[string]*SymbolData
	ExternalRefs []*FileOccurences
}

FileInfo stores information about a document, including its package

func NewFileInfo

func NewFileInfo(uri uri.URI, doc *model.Document, pkg *PackageMeta, definitions map[string]*SymbolData, externalRefs []*FileOccurences) *FileInfo

NewFileInfo instantiates a new FileInfo

type FileOccurences

type FileOccurences struct {
	Occurrences []*model.Occurrence
	// contains filtered or unexported fields
}

FileOccurences containes all the occurences of a particular symbol in a file

type IndexLoadStatus

type IndexLoadStatus string

IndexLoadStatus is the status of a SCIP index load

const (
	// IndexLoadSuccess is the status of a successful SCIP index load
	IndexLoadSuccess IndexLoadStatus = "done"
	// IndexLoadError is the status of a failed SCIP index load
	IndexLoadError IndexLoadStatus = "error"
)

type IndexNotifier

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

IndexNotifier provides a simple way to show SCIP index loading notifications

func NewIndexNotifier

func NewIndexNotifier(notifiers notifier.NotificationManager) *IndexNotifier

NewIndexNotifier creates a minimal SCIP index load notifier

func (*IndexNotifier) NotifyComplete

func (n *IndexNotifier) NotifyComplete(ctx context.Context, workspaceRoot, filePath string, status IndexLoadStatus) error

NotifyComplete shows a notification when a SCIP index file has been loaded

func (*IndexNotifier) NotifyStart

func (n *IndexNotifier) NotifyStart(ctx context.Context, workspaceRoot, filePath string) error

NotifyStart shows a notification when starting to load a SCIP index file

func (*IndexNotifier) TrackFile

func (n *IndexNotifier) TrackFile(ctx context.Context, workspaceRoot, filePath string) error

TrackFile adds a file to be tracked for a workspace

type PackageID

type PackageID string

PackageID is a unique identifier for a package

type PackageMeta

type PackageMeta struct {
	Pkg *model.ScipPackage
	// SymbolData maps from symbol moniker to a data provider
	SymbolData map[string]*SymbolData
	// contains filtered or unexported fields
}

PackageMeta stores symbol information across an entire package

func NewScipPackage

func NewScipPackage(pkg *model.ScipPackage) *PackageMeta

NewScipPackage instantiates a new ScipPackage

type Params

type Params struct {
	fx.In

	Sessions   session.Repository
	IdeGateway ideclient.Gateway
	Logger     *zap.SugaredLogger
	Config     config.Provider
	Stats      tally.Scope
	FS         fs.UlspFS

	PluginDocSync     docsync.Controller
	PluginDiagnostics diagnostics.Controller
}

Params are inbound parameters to initialize a new plugin.

type Registry

type Registry interface {
	LoadConcurrency() int
	SetDocumentLoadedCallback(func(*model.Document))
	LoadIndex(indexReader io.ReadSeeker) error
	LoadIndexFile(indexPath string) error
	DidOpen(uri uri.URI, text string) error
	DidClose(uri uri.URI) error
	// GetSymbolInformation returns the symbol information for a given position (does not require a full loaded index)
	GetSymbolOccurrence(uri uri.URI, loc protocol.Position) (*model.SymbolOccurrence, error)
	// GetSymbolDefinitionOccurrence returns the definition occurrence for a given symbol
	GetSymbolDefinitionOccurrence(descriptors []model.Descriptor, version string) (*model.SymbolOccurrence, error)
	// Definition returns the source occurence and the definition occurence for a given position
	Definition(uri uri.URI, loc protocol.Position) (*model.SymbolOccurrence, *model.SymbolOccurrence, error)
	// References returns the locations a symbol is referenced at in the entire index
	References(uri uri.URI, loc protocol.Position) ([]protocol.Location, error)
	// Hover returns the hover information for a given position, as well as it's occurrence
	Hover(uri uri.URI, loc protocol.Position) (string, *model.Occurrence, error)
	// DocumentSymbols returns the document symbols for a given document
	DocumentSymbols(uri uri.URI) ([]*model.SymbolOccurrence, error)
	// Diagnostics returns the diagnostics for a given document
	Diagnostics(uri uri.URI) ([]*model.Diagnostic, error)
	GetSymbolForPosition(uri uri.URI, loc protocol.Position) (*model.Occurrence, *SymbolData, error)
	GetDocumentSymbolForFile(uri uri.URI) (*[]*SymbolData, error)
	GetFileInfo(uri uri.URI) *FileInfo
	GetPackageInfo(pkgID PackageID) *PackageMeta
	// GetURI gets the full path to a document as an LSP uri.
	GetURI(relPath string) uri.URI
}

Registry is an interface that abstracts SCIP data access

func NewPartialScipRegistry

func NewPartialScipRegistry(workspaceRoot string, indexFolder string, logger *zap.SugaredLogger) Registry

NewPartialScipRegistry creates a new partial SCIP registry

type SymbolData

type SymbolData struct {
	Info       *model.SymbolInformation
	Definition *model.Occurrence
	Location   *protocol.LocationLink
	// References stores all the locations this symbol is referenced.
	// This is indexed by package that References it for easy updating when a package gets a new index.
	// This is further aligned as an array of files so we can return an organized result of References when requested.
	References map[PackageID][]*FileOccurences
	// contains filtered or unexported fields
}

SymbolData stores references to the definition, location, and any references to this symbol

func NewSymbolData

func NewSymbolData(info *model.SymbolInformation, definition *model.Occurrence, location *protocol.LocationLink) *SymbolData

NewSymbolData initializes a SymbolData struct

func (*SymbolData) AddReference

func (sd *SymbolData) AddReference(docURI uri.URI, pkgID PackageID, occ *model.Occurrence) *FileOccurences

AddReference adds an occurence that's defined in a package+file into the symboldata of the package that defines the symbol.

func (*SymbolData) GetSymbolInformation

func (sd *SymbolData) GetSymbolInformation() *model.SymbolInformation

GetSymbolInformation returns the symbol information for a symbol

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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