scout

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertDiagnostic

func ConvertDiagnostic(diagnostic Diagnostic, words []string, source string, rng protocol.Range, edits []Edit) protocol.Diagnostic

Types

type Description

type Description struct {
	Plaintext string `json:"plaintext"`
	Markdown  string `json:"markdown"`
}

type Diagnostic

type Diagnostic struct {
	Kind     string `json:"kind"`
	Message  string `json:"message"`
	Severity string `json:"severity"`
	Link     Link   `json:"link"`
}

type Edit

type Edit struct {
	Title      string `json:"title"`
	Edit       string `json:"edit"`
	Diagnostic string `json:"diagnostic"`
}

type Image

type Image struct {
	Short      string `json:"short"`
	Registry   string `json:"registry"`
	Repository string `json:"repository"`
	Tag        string `json:"tag"`
	Digest     string `json:"digest"`
}

type ImageRequest

type ImageRequest struct {
	Image        string `json:"image"`
	Organization string `json:"organization"`
}

type ImageResponse

type ImageResponse struct {
	Image       Image        `json:"image"`
	Diagnostics []Diagnostic `json:"diagnostics"`
	Edits       []Edit       `json:"edits"`
	Infos       []Info       `json:"infos"`
}

type Info

type Info struct {
	Kind        string      `json:"kind"`
	Description Description `json:"description"`
}

type LanguageGatewayClient

type LanguageGatewayClient interface {
	PostImage(ctx context.Context, jwt, image string) (ImageResponse, error)
	Fetch(key cache.Key) (ImageResponse, error)
}

func NewLanguageGatewayClient

func NewLanguageGatewayClient() LanguageGatewayClient

type LanguageGatewayClientImpl

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

func (LanguageGatewayClientImpl) Fetch

func (LanguageGatewayClientImpl) PostImage

func (c LanguageGatewayClientImpl) PostImage(ctx context.Context, jwt, image string) (ImageResponse, error)

PostImage sends an HTTP POST request to /v1/language-gateway/image to retrieve infromation from the Scout Language Gateway. This information can be used for providing diagnostics about the given image.

type Link struct {
	Href  string `json:"href"`
	Title string `json:"title"`
}

type ScoutImageKey

type ScoutImageKey struct {
	Image string
}

func (*ScoutImageKey) CacheKey

func (k *ScoutImageKey) CacheKey() string

type Service

type Service interface {
	textdocument.DiagnosticsCollector
	Analyze(image string) ([]Diagnostic, error)
	Hover(ctx context.Context, image string) (*protocol.Hover, error)
}

func NewService

func NewService() Service

type ServiceImpl

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

func (*ServiceImpl) Analyze

func (s *ServiceImpl) Analyze(image string) ([]Diagnostic, error)

func (*ServiceImpl) CalculateDiagnostics

func (s *ServiceImpl) CalculateDiagnostics(ctx context.Context, source string, doc document.Document) ([]protocol.Diagnostic, error)

func (*ServiceImpl) CollectDiagnostics

func (s *ServiceImpl) CollectDiagnostics(source, workspaceFolder string, doc document.Document, text string) []protocol.Diagnostic

func (*ServiceImpl) Hover

func (s *ServiceImpl) Hover(ctx context.Context, image string) (*protocol.Hover, error)

func (*ServiceImpl) SupportsLanguageIdentifier

func (c *ServiceImpl) SupportsLanguageIdentifier(languageIdentifier protocol.LanguageIdentifier) bool

Jump to

Keyboard shortcuts

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