fileref

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package fileref 复刻官方 context/file-reference 的 @文件引用语法:提取光标处 正在输入的 @token,并把选中的路径格式化为 @path / @"path" 文本。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatMention

func FormatMention(path string, isDir, preserveQuote bool) string

FormatMention 把选中路径格式化为插入文本。目录保留尾斜杠;含空白用引号; 遇到语法无法安全表示的路径返回空串。

Types

type Token

type Token struct {
	Prefix string // 被整体替换的 token
	Query  string // @ 之后的路径查询
	Quoted bool   // 是否引号路径
}

Token 是光标处活动的 @token。

func ActiveAtToken

func ActiveAtToken(line string, cursorCol int) (Token, bool)

ActiveAtToken 提取光标列之前的 @path 或 @"path" token;不在 @token 上时 ok=false。

Jump to

Keyboard shortcuts

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