ToURI returns the document URI for this identifier. An explicitly provided URI is returned as-is; a file name is first normalized to an absolute path against cwd before being converted to a URI.
(cwd string)
| 266 | // is returned as-is; a file name is first normalized to an absolute path against |
| 267 | // cwd before being converted to a URI. |
| 268 | func (d DocumentIdentifier) ToURI(cwd string) lsproto.DocumentUri { |
| 269 | if d.URI != "" { |
| 270 | return d.URI |
| 271 | } |
| 272 | return lsconv.FileNameToDocumentURI(tspath.GetNormalizedAbsolutePath(d.FileName, cwd)) |
| 273 | } |
| 274 | |
| 275 | func (d DocumentIdentifier) ToAbsoluteFileName(cwd string) string { |
| 276 | if d.URI != "" { |
no test coverage detected