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

Method acquire

cli/lsp_tool_adapter.go:65–83  ·  view source on GitHub ↗

acquire resolves the file path (expansion + absolutization) and returns a ready session plus the absolute path.

(file string)

Source from the content-addressed store, hash-verified

63// acquire resolves the file path (expansion + absolutization) and returns a
64// ready session plus the absolute path.
65func (a *lspToolAdapter) acquire(file string) (*lsp.Session, string, error) {
66 expanded, err := utils.ExpandPath(file)
67 if err != nil {
68 expanded = file
69 }
70 abs, err := filepath.Abs(expanded)
71 if err != nil {
72 return nil, "", err
73 }
74 // @lsp calls have no caller deadline of their own; bound the possible
75 // cold spawn + initialize here (same pattern as the @knowledge adapter).
76 ctx, cancel := context.WithTimeout(context.Background(), lspOpTimeout)
77 defer cancel()
78 sess, err := a.pool().Acquire(ctx, abs)
79 if err != nil {
80 return nil, "", err
81 }
82 return sess, abs, nil
83}
84
85// relPath renders a location path relative to the session root when possible.
86func relPath(root, uri string) string {

Callers 5

DiagnosticsMethod · 0.95
DefinitionMethod · 0.95
ReferencesMethod · 0.95
SymbolsMethod · 0.95
HoverMethod · 0.95

Calls 3

poolMethod · 0.95
ExpandPathFunction · 0.92
AcquireMethod · 0.45

Tested by

no test coverage detected