Documentation ¶
Index ¶
- Constants
- Variables
- func AddOffsetToRange(rng protocol.Range, offset protocol.Position) protocol.Range
- func AllLineContentRange(lineIndexes []int, content []byte) []protocol.Range
- func ArePositionEqual(a protocol.Position, b protocol.Position) bool
- func AreRangeEqual(a protocol.Range, b protocol.Range) bool
- func CheckIfMatrixParamIsPartiallyReferenced(content string) bool
- func CheckIfOnlyParamUsed(content string) bool
- func CheckIfParamIsPartiallyReferenced(content string) (bool, bool)
- func ComparePosition(a protocol.Position, b protocol.Position) int
- func CreateCodeActionTextEdit(title string, textDocumentUri uri.URI, textEdits []protocol.TextEdit, ...) protocol.CodeAction
- func CreateDiagnosticFromRange(rng protocol.Range, severity protocol.DiagnosticSeverity, msg string, ...) protocol.Diagnostic
- func CreateEmptyAssignationWarning(rng protocol.Range) protocol.Diagnostic
- func CreateErrorDiagnosticFromNode(node *sitter.Node, msg string) protocol.Diagnostic
- func CreateErrorDiagnosticFromRange(rng protocol.Range, msg string) protocol.Diagnostic
- func CreateHintDiagnosticFromRange(rng protocol.Range, msg string) protocol.Diagnostic
- func CreateInformationDiagnosticFromRange(rng protocol.Range, msg string) protocol.Diagnostic
- func CreateWarningDiagnosticFromNode(node *sitter.Node, msg string) protocol.Diagnostic
- func CreateWarningDiagnosticFromRange(rng protocol.Range, msg string) protocol.Diagnostic
- func ExtractParameterName(parameter string) (string, string)
- func FindInArray[T comparable](array []T, elem T) int
- func GetAllContext(lsContext *LsContext, organization string, vcs string, cache *Cache) error
- func GetAllProjectEnvVariables(lsContext *LsContext, cache *Cache, cachedFile *CachedFile)
- func GetClient() *http.Client
- func GetLatestUbuntu2204Image() string
- func GetMachineTrueMessage(img string) string
- func GetOrbCacheFSPath(orbYaml string) string
- func GetParamNameDefinedAtPos(parameters map[string]ast.Parameter, pos protocol.Position) string
- func GetParamNameUsedAtPos(content []byte, position protocol.Position) (string, bool)
- func GetParamsInString(content string) ([]struct{ ... }, error)
- func GetProjectOrg(projectSlug string) string
- func GetProjectSlug(configPath string) string
- func GetReferencesOfParamInRange(content []byte, paramName string, rng protocol.Range) ([][]int, error)
- func GetYAMLBooleanValue(str string) bool
- func HasStoreTestResultStep(step []ast.Step) bool
- func IndexToPos(index int, content []byte) protocol.Position
- func IsDefaultRange(rng protocol.Range) bool
- func IsValidYAMLBooleanValue(str string) bool
- func LineContentRange(lineIndex int, content []byte) protocol.Range
- func NodeAtPos(rootNode *sitter.Node, pos protocol.Position) (*sitter.Node, []*sitter.Node, error)
- func PackageManager() string
- func PosInRange(rng protocol.Range, pos protocol.Position) bool
- func PosToIndex(pos protocol.Position, content []byte) int
- func ToDiagnosticMessage(message string) string
- type ApiContext
- type Cache
- type CachedDockerImage
- type CachedDockerTags
- type CachedFile
- type Client
- type Context
- type ContextCache
- func (c *ContextCache) AddEnvVariableToOrganizationContext(organizationId string, name string, envVariable string)
- func (c *ContextCache) GetAllContextOfOrganization(organizationId string) map[string]*Context
- func (c *ContextCache) GetOrganizationContext(organizationId string, name string) *Context
- func (c *ContextCache) RemoveOrganizationContext(organizationId string, name string)
- func (c *ContextCache) SetOrganizationContext(organizationId string, ctx *Context) *Context
- type ContextEnvVariable
- type DockerCache
- type DockerTagsCache
- type FileCache
- func (c *FileCache) AddEnvVariableToProjectLinkedToFile(uri protocol.URI, envVariable string)
- func (c *FileCache) AddProjectSlugToFile(uri protocol.URI, project Project)
- func (c *FileCache) GetFile(uri protocol.URI) *CachedFile
- func (c *FileCache) GetFiles() map[protocol.URI]*CachedFile
- func (c *FileCache) RemoveFile(uri protocol.URI)
- func (c *FileCache) SetFile(cachedFile CachedFile) CachedFile
- func (c *FileCache) UpdateTextDocument(uri protocol.URI, textDocument protocol.TextDocumentItem)
- type GetAllContextRes
- type LsContext
- type MeRes
- type OrbCache
- func (c *OrbCache) GetOrb(orbID string) *ast.OrbInfo
- func (c *OrbCache) HasOrb(orbID string) bool
- func (c *OrbCache) RemoveOrb(orbID string)
- func (c *OrbCache) RemoveOrbs()
- func (c *OrbCache) SetOrb(orb *ast.OrbInfo, orbID string) ast.OrbInfo
- func (c *OrbCache) UpdateOrbParsedAttributes(orbID string, parsedOrbAttributes ast.OrbParsedAttributes) ast.OrbParsedAttributes
- type Project
- type ProjectEnvVariableRes
- type Request
- type ResourceClassCache
- type Response
- type ResponseError
- type ResponseErrorsCollection
Constants ¶
const CIRCLE_CI_APP_HOST_URL = "https://circleci.com"
Variables ¶
var ( // Version is the current Git tag (the v prefix is stripped) or the name of // the snapshot, if you’re using the --snapshot flag Version = "0.0.0-dev" // Commit is the current git commit SHA Commit = "dirty-local-tree" )
These vars set by `goreleaser`:
var ValidARMOrMachineImages = append(ValidARMOrMachineImagesUbuntu2004, ValidARMOrMachineImagesUbuntu2204...)
var ValidARMOrMachineImagesUbuntu2004 = []string{
"ubuntu-2004:current",
"ubuntu-2004:edge",
"ubuntu-2004:2023.04.2",
"ubuntu-2004:2023.04.1",
"ubuntu-2004:2023.02.1",
"ubuntu-2004:2022.10.1",
"ubuntu-2004:2022.07.1",
"ubuntu-2004:2022.04.2",
"ubuntu-2004:2022.04.1",
"ubuntu-2004:202201-02",
"ubuntu-2004:202201-01",
"ubuntu-2004:202111-02",
"ubuntu-2004:202111-01",
"ubuntu-2004:202107-02",
"ubuntu-2004:202104-01",
"ubuntu-2004:202101-01",
"ubuntu-2004:202010-01",
}
var ValidARMOrMachineImagesUbuntu2204 = []string{
"ubuntu-2204:current",
"ubuntu-2204:edge",
"ubuntu-2204:2023.04.2",
"ubuntu-2204:2023.04.1",
"ubuntu-2204:2023.02.1",
"ubuntu-2204:2022.10.2",
"ubuntu-2204:2022.10.1",
"ubuntu-2204:2022.07.2",
"ubuntu-2204:2022.07.1",
"ubuntu-2204:2022.04.2",
"ubuntu-2204:2022.04.1",
}
Functions ¶
func AddOffsetToRange ¶
func AllLineContentRange ¶
Return the exact range of the text on a all given lines. See LineContentRange for more information
func ArePositionEqual ¶
Return true if two positions are identical Two positions are identical if they ave the same line and character.
func AreRangeEqual ¶
Return true if two ranges are identical Two ranges are identical if they have the same start and end position
func CheckIfOnlyParamUsed ¶
Returns true if the string is *only* a parameter Example:
param: << parameters.paramName >> -> true param: << pipeline.parameters.paramName >> -> true param: `/home/<< parameters.paramName >>/Downloads` -> false
func ComparePosition ¶
Compare two positions. Return 0 if the two position are the same Return 1 if a is before b Return -1 if a is after b
func CreateDiagnosticFromRange ¶
func CreateDiagnosticFromRange( rng protocol.Range, severity protocol.DiagnosticSeverity, msg string, codeAction []protocol.CodeAction, ) protocol.Diagnostic
func CreateEmptyAssignationWarning ¶
func CreateEmptyAssignationWarning(rng protocol.Range) protocol.Diagnostic
func CreateErrorDiagnosticFromNode ¶
func CreateErrorDiagnosticFromNode(node *sitter.Node, msg string) protocol.Diagnostic
func CreateErrorDiagnosticFromRange ¶
func CreateErrorDiagnosticFromRange(rng protocol.Range, msg string) protocol.Diagnostic
func CreateHintDiagnosticFromRange ¶
func CreateHintDiagnosticFromRange(rng protocol.Range, msg string) protocol.Diagnostic
func CreateInformationDiagnosticFromRange ¶
func CreateInformationDiagnosticFromRange(rng protocol.Range, msg string) protocol.Diagnostic
func CreateWarningDiagnosticFromNode ¶
func CreateWarningDiagnosticFromNode(node *sitter.Node, msg string) protocol.Diagnostic
func CreateWarningDiagnosticFromRange ¶
func CreateWarningDiagnosticFromRange(rng protocol.Range, msg string) protocol.Diagnostic
func ExtractParameterName ¶
Given a correct parameter string (example: << parameters.something >>) will return a pair of strings
The first returned value is the full path to the parameter (in example above: parameters.something) The second returned value is the parameter name
func FindInArray ¶
func FindInArray[T comparable](array []T, elem T) int
func GetAllContext ¶
func GetAllProjectEnvVariables ¶
func GetAllProjectEnvVariables(lsContext *LsContext, cache *Cache, cachedFile *CachedFile)
func GetLatestUbuntu2204Image ¶
func GetLatestUbuntu2204Image() string
func GetMachineTrueMessage ¶
func GetOrbCacheFSPath ¶
func GetParamNameDefinedAtPos ¶
Search the right parameters that is defined in the given position and return its name
func GetParamNameUsedAtPos ¶
Return the name of the parameter used at the given position
func GetParamsInString ¶
func GetProjectOrg ¶
func GetProjectSlug ¶
func GetYAMLBooleanValue ¶
func HasStoreTestResultStep ¶
func IsDefaultRange ¶
func IsValidYAMLBooleanValue ¶
func LineContentRange ¶
Return the exact range of the text on a line
For example, with a yaml:
content := `
some-key: property: 5
`
LineContentRange(2, []byte(content)) ==> { Start: { Line: 2 Character: 2 }, End: { Line: 2, Character: 12 } }
func PackageManager ¶
func PackageManager() string
func ToDiagnosticMessage ¶
Diagnostic messages should start with a uppercase letter
Types ¶
type ApiContext ¶
func (ApiContext) GetUserId ¶
func (apiContext ApiContext) GetUserId() string
func (ApiContext) IsLoggedIn ¶
func (apiContext ApiContext) IsLoggedIn() bool
func (ApiContext) UseDefaultInstance ¶
func (apiContext ApiContext) UseDefaultInstance() bool
type Cache ¶
type Cache struct { FileCache FileCache OrbCache OrbCache DockerCache DockerCache DockerTagsCache DockerTagsCache ResourceClassCache ResourceClassCache ContextCache ContextCache }
func CreateCache ¶
func CreateCache() *Cache
func (*Cache) ClearHostData ¶
func (cache *Cache) ClearHostData()
func (*Cache) RemoveOrbFiles ¶
func (c *Cache) RemoveOrbFiles()
type CachedDockerImage ¶
type CachedDockerTags ¶
type CachedFile ¶
type CachedFile struct { TextDocument protocol.TextDocumentItem Project Project EnvVariables []string }
type Client ¶
type Client struct { Debug bool Endpoint string Host string Token string // contains filtered or unexported fields }
A Client is an HTTP client for our GraphQL endpoint.
type ContextCache ¶
type ContextCache struct {
// contains filtered or unexported fields
}
func (*ContextCache) AddEnvVariableToOrganizationContext ¶
func (c *ContextCache) AddEnvVariableToOrganizationContext(organizationId string, name string, envVariable string)
func (*ContextCache) GetAllContextOfOrganization ¶
func (c *ContextCache) GetAllContextOfOrganization(organizationId string) map[string]*Context
func (*ContextCache) GetOrganizationContext ¶
func (c *ContextCache) GetOrganizationContext(organizationId string, name string) *Context
func (*ContextCache) RemoveOrganizationContext ¶
func (c *ContextCache) RemoveOrganizationContext(organizationId string, name string)
func (*ContextCache) SetOrganizationContext ¶
func (c *ContextCache) SetOrganizationContext(organizationId string, ctx *Context) *Context
type ContextEnvVariable ¶
func GetAllContextEnvVariables ¶
func GetAllContextEnvVariables(lsContext *LsContext, cache *Cache, organizationId string, contexts []string) []ContextEnvVariable
type DockerCache ¶
type DockerCache struct {
// contains filtered or unexported fields
}
func (*DockerCache) Add ¶
func (c *DockerCache) Add(name string, exists bool) *CachedDockerImage
func (*DockerCache) Get ¶
func (c *DockerCache) Get(name string) *CachedDockerImage
func (*DockerCache) Remove ¶
func (c *DockerCache) Remove(name string)
type DockerTagsCache ¶
type DockerTagsCache struct {
// contains filtered or unexported fields
}
func (*DockerTagsCache) Add ¶
func (c *DockerTagsCache) Add(namespace, image string, value CachedDockerTags)
func (*DockerTagsCache) Get ¶
func (c *DockerTagsCache) Get(namespace, image string) *CachedDockerTags
type FileCache ¶
type FileCache struct {
// contains filtered or unexported fields
}
func (*FileCache) AddEnvVariableToProjectLinkedToFile ¶
func (*FileCache) AddProjectSlugToFile ¶
func (*FileCache) RemoveFile ¶
func (*FileCache) SetFile ¶
func (c *FileCache) SetFile(cachedFile CachedFile) CachedFile
func (*FileCache) UpdateTextDocument ¶
func (c *FileCache) UpdateTextDocument(uri protocol.URI, textDocument protocol.TextDocumentItem)
type GetAllContextRes ¶
type GetAllContextRes struct { Organization struct { Id string Contexts struct { Edges []struct { Node struct { Groups struct { Edges []struct { Node struct { Name string } } } Id string Name string Resources []struct { Variable string } } } PageInfo struct { HasPreviousPage bool HasNextPage bool } TotalCount int } } }
type LsContext ¶
type LsContext struct { Api ApiContext UserIdForTelemetry string IsCciExtension bool }
type OrbCache ¶
type OrbCache struct {
// contains filtered or unexported fields
}
func (*OrbCache) RemoveOrbs ¶
func (c *OrbCache) RemoveOrbs()
func (*OrbCache) UpdateOrbParsedAttributes ¶
func (c *OrbCache) UpdateOrbParsedAttributes(orbID string, parsedOrbAttributes ast.OrbParsedAttributes) ast.OrbParsedAttributes
type Project ¶
type Project struct { Slug string Name string Id string OrganizationName string `json:"organization_name"` OrganizationSlug string `json:"organization_slug"` OrganizationId string `json:"organization_id"` VcsInfo struct { VcsUrl string `json:"vcs_url"` Provider string Default_branch string `json:"default_branch"` } `json:"vcs_info"` }
type ProjectEnvVariableRes ¶
type Request ¶
type Request struct { Query string `json:"query"` Variables map[string]interface{} `json:"variables"` // Header represent any request headers that will be set // when the request is made. Header http.Header `json:"-"` }
Request is a GraphQL request.
func (*Request) SetToken ¶
SetToken sets the Authorization header for the request with the given token.
type ResourceClassCache ¶
type ResourceClassCache struct {
// contains filtered or unexported fields
}
func (*ResourceClassCache) GetResourceClassOfFile ¶
func (c *ResourceClassCache) GetResourceClassOfFile(uri protocol.URI) []string
func (*ResourceClassCache) SetResourceClassForFile ¶
func (c *ResourceClassCache) SetResourceClassForFile(uri protocol.URI, resourceClass *[]string) *[]string
type Response ¶
type Response struct { Data interface{} Errors ResponseErrorsCollection }
Response wraps the result from our GraphQL server response including out-of-band errors and the data itself.
type ResponseError ¶
type ResponseError struct { Message string Locations []struct { Line int Column int } Extensions struct { Field string Argument string Value string AllowedValues []string `json:"allowed-values"` EnumType string `json:"enum-type"` } }
ResponseError represents the key-value pair of data returned by the GraphQL server to represent errors.
type ResponseErrorsCollection ¶
type ResponseErrorsCollection []ResponseError
ResponseErrorsCollection represents a slice of errors returned by the GraphQL server out-of-band from the actual data.
func (ResponseErrorsCollection) Error ¶
func (errs ResponseErrorsCollection) Error() string
Error turns a ResponseErrorsCollection into an acceptable error string that can be printed to the user.