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

Method References

cli/lsp_tool_adapter.go:140–163  ·  view source on GitHub ↗

References implements plugins.LSPAdapter. line/column are 1-based.

(file string, line, column int, includeDeclaration bool, limit int)

Source from the content-addressed store, hash-verified

138
139// References implements plugins.LSPAdapter. line/column are 1-based.
140func (a *lspToolAdapter) References(file string, line, column int, includeDeclaration bool, limit int) (string, error) {
141 sess, _, err := a.acquire(file)
142 if err != nil {
143 return "", err
144 }
145 if limit <= 0 {
146 limit = lspDefaultRefLimit
147 }
148 if limit > lspMaxRefLimit {
149 limit = lspMaxRefLimit
150 }
151 locs, err := sess.Client.References(sess.URI, lspPos(line, column), includeDeclaration)
152 if err != nil {
153 return "", err
154 }
155 if len(locs) == 0 {
156 return "No references found at that position — check that line/column point at the symbol name (1-based).", nil
157 }
158 total := len(locs)
159 if len(locs) > limit {
160 locs = locs[:limit]
161 }
162 return formatLocations("reference", sess.Root, locs, total), nil
163}
164
165// Symbols implements plugins.LSPAdapter.
166func (a *lspToolAdapter) Symbols(file string) (string, error) {

Callers

nothing calls this directly

Calls 4

acquireMethod · 0.95
lspPosFunction · 0.85
formatLocationsFunction · 0.85
ReferencesMethod · 0.65

Tested by

no test coverage detected