common

package
v0.0.0-...-0e75cad Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Project

type Project struct {
	Directory      string
	GoArchFilePath string
	GoModFilePath  string
	ModuleName     string
}

type Referable

type Referable[T any] struct {
	Value     T
	Reference Reference
}

func NewEmptyReferable

func NewEmptyReferable[T any](value T) Referable[T]

func NewReferable

func NewReferable[T any](value T, ref Reference) Referable[T]

type Reference

type Reference struct {
	Valid    bool   `json:"Valid"`
	File     string `json:"File"`
	Line     int    `json:"Line"`
	LineFrom int    `json:"-"`
	LineTo   int    `json:"-"`
	Column   int    `json:"Offset"`
}

func NewEmptyReference

func NewEmptyReference() Reference

func NewReferenceRange

func NewReferenceRange(file string, lineFrom, lineMain, lineTo int) Reference

func NewReferenceSingleLine

func NewReferenceSingleLine(file string, line int, column int) Reference

func (Reference) ClampWithRealLinesCount

func (r Reference) ClampWithRealLinesCount(linesCount int) Reference

ClampWithRealLinesCount allows to clamp lines to real file lines count (upper clamp)

func (Reference) ExtendRange

func (r Reference) ExtendRange(lower, upper int) Reference

ExtendRange will extend from-to range in both ways on growLinesCount lines for example initialRange=[2..5], after ExtendRange(1) it will be [1..6]

func (Reference) String

func (r Reference) String() string

Jump to

Keyboard shortcuts

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