relPath renders a location path relative to the session root when possible.
(root, uri string)
| 84 | |
| 85 | // relPath renders a location path relative to the session root when possible. |
| 86 | func 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. |
| 97 | func (a *lspToolAdapter) Diagnostics(file string) (string, error) { |
no outgoing calls