MCPcopy Create free account
hub / github.com/diillson/chatcli / relPath

Function relPath

cli/lsp_tool_adapter.go:86–94  ·  view source on GitHub ↗

relPath renders a location path relative to the session root when possible.

(root, uri string)

Source from the content-addressed store, hash-verified

84
85// relPath renders a location path relative to the session root when possible.
86func relPath(root, uri string) string {
87 p := strings.TrimPrefix(uri, "file://")
88 if root != "" {
89 if rel, err := filepath.Rel(root, p); err == nil && !strings.HasPrefix(rel, "..") {
90 return rel
91 }
92 }
93 return p
94}
95
96// Diagnostics implements plugins.LSPAdapter.
97func (a *lspToolAdapter) Diagnostics(file string) (string, error) {

Callers 4

TestLSPRelPathFunction · 0.85
DiagnosticsMethod · 0.85
SymbolsMethod · 0.85
formatLocationsFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestLSPRelPathFunction · 0.68