gopls

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Rename

func Rename(sym *Symbol, newName string) error

Rename renames a given symbol to a new name. This naming will propagate throughout, including references to the type, the type name itself and any comments that contain the type name in godoc's reference format with '[typename]'.

Types

type Symbol

type Symbol struct {
	Name string
	Type SymbolType

	// Position is a start and end range for a symbol
	// ex: 36:2-36:7
	// (line 36, columns 2 - 7)
	Position string

	File string
}

func (Symbol) StartLine

func (s Symbol) StartLine() (int64, error)

StartLine returns the starting line for this symbol.

type SymbolMap

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

func NewSymbolMap

func NewSymbolMap(m map[string]*Symbol) *SymbolMap

func Symbols

func Symbols(filename string) (*SymbolMap, error)

Symbols parses the output of `gopls symbols`.

func (SymbolMap) All

func (s SymbolMap) All() []*Symbol

All gets all the symbols within our map, in no specific order.

func (SymbolMap) Get

func (s SymbolMap) Get(name string) *Symbol

Get retrieves a symbol, ignoring casing.

type SymbolType

type SymbolType string

SymbolType maps to the second field in the `gopls symbols` output.

const (
	SymbolTypeConstant SymbolType = "Constant"
	SymbolTypeClass    SymbolType = "Class" // (ex: ACSRouterJobStatus, from 'type ACSRouterJobStatus string')
	SymbolTypeStruct   SymbolType = "Struct"
	SymbolTypeField    SymbolType = "Field"
	SymbolTypeFunction SymbolType = "Function"
	SymbolTypeMethod   SymbolType = "Method" // ex: '(*WebBackupOperationCompletedEventData).UnmarshalJSON'
)

Jump to

Keyboard shortcuts

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