resolver

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FS

func FS() fs.FS

FS returns an fs.FS over the real filesystem that accepts absolute paths.

Types

type Resolver

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

Resolver resolves include paths for Thrift files. It provides a centralized, pure implementation that can be used by both CLI and LSP components.

func New

func New(includePaths []string) *Resolver

New creates a Resolver over the real filesystem.

func NewWithFS

func NewWithFS(includePaths []string, fsys fs.FS) *Resolver

NewWithFS creates a Resolver that checks file existence through fsys. Absolute paths are looked up as-is; os.DirFS("/") reproduces the default filesystem behavior, and fstest.MapFS makes tests hermetic.

func (*Resolver) Candidates added in v0.1.8

func (r *Resolver) Candidates(currentFile, includePath string) []string

Candidates lists the existing locations of includePath for currentFile, nearest first: the file's directory, then include paths ordered by shared directory prefix with the file's directory, config order breaking ties. More than one location means the include path is shadowed by another include path.

func (*Resolver) Resolve

func (r *Resolver) Resolve(currentFile, includePath string) string

Resolve returns the nearest location of includePath for currentFile: the file's directory first, then include paths by proximity (see Candidates). When the include resolves nowhere, it returns the file-relative candidate.

Jump to

Keyboard shortcuts

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