Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
withFragment(fragment: string): URI {
const newCodeUri = Uri.from({
...this.codeUri.toJSON(),
fragment
})
return new URI(newCodeUri);
}
withQuery(query: string): URI {
const newCodeUri = Uri.from({
...this.codeUri.toJSON(),
scheme: this.codeUri.scheme,
query
});
return new URI(newCodeUri);
}
withScheme(scheme: string): URI {
const newCodeUri = Uri.from({
...this.codeUri.toJSON(),
scheme
})
return new URI(newCodeUri);
}
withAuthority(authority: string): URI {
const newCodeUri = Uri.from({
...this.codeUri.toJSON(),
scheme: this.codeUri.scheme,
authority
});
return new URI(newCodeUri);
}
withPath(path: string | Path): URI {
const newCodeUri = Uri.from({
...this.codeUri.toJSON(),
path: path.toString()
})
return new URI(newCodeUri);
}
export function getEmbeddedContentUri(parentDocumentUri: string, embeddedLanguageId: string): Uri {
return Uri.from({ scheme: EMBEDDED_CONTENT_SCHEME, authority: embeddedLanguageId, path: '/' + encodeURIComponent(parentDocumentUri) + '.' + embeddedLanguageId });
};
withPath(path: string | Path): URI {
const newCodeUri = Uri.from({
...this.codeUri.toJSON(),
scheme: this.codeUri.scheme,
path: path.toString()
});
return new URI(newCodeUri);
}
constructor(uri?: string | Uri) {
if (uri === undefined) {
this.codeUri = Uri.from({})
} else if (uri instanceof Uri) {
this.codeUri = uri
} else {
this.codeUri = Uri.parse(uri)
}
}
withFragment(fragment: string): URI {
const newCodeUri = Uri.from({
...this.codeUri.toJSON(),
scheme: this.codeUri.scheme,
fragment
});
return new URI(newCodeUri);
}
withQuery(query: string): URI {
const newCodeUri = Uri.from({
...this.codeUri.toJSON(),
query
})
return new URI(newCodeUri);
}