Skip to main content

GetURLFromURIComponentsDTO

Function GetURLFromURIComponentsDTO 

Source
pub fn GetURLFromURIComponentsDTO(URIDTO: &Value) -> Result<Url, CommonError>
Expand description

Helper to get a Url from a serde_json::Value which is expected to be a UriComponents DTO from VS Code, a plain URI string, or a UriComponents object without the external convenience field.

Cocoon’s wire shapes vary by call site:

  • Diagnostic.Set and a few others send the URI as a plain string (the canonical form returned by Uri.toString()).
  • MainThread* boundaries send the {scheme, authority, path, query, fragment, external} object that vs/base/common/uri.ts emits via URI.toJSON().
  • Some legacy paths send {scheme, path} with no external.

All three are valid; Mountain accepts whichever arrives. Without this the Diagnostic.Set call from vscode.languages.createDiagnosticCollection().set trips the breaker after 5 publishes and silences every linter / compiler across all language extensions.