resolver

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: Apache-2.0 Imports: 4 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) Resolve

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

Resolve resolves an include path relative to the current file. It first tries relative to currentFile's directory, then tries each configured include path in order. Returns the resolved path, or the candidate relative to currentFile's directory as a fallback if not found.

Jump to

Keyboard shortcuts

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