References implements plugins.LSPAdapter. line/column are 1-based.
(file string, line, column int, includeDeclaration bool, limit int)
| 138 | |
| 139 | // References implements plugins.LSPAdapter. line/column are 1-based. |
| 140 | func (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. |
| 166 | func (a *lspToolAdapter) Symbols(file string) (string, error) { |
nothing calls this directly
no test coverage detected