mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 10:38:59 +01:00
[html][css] diagnistics for embedded content
This commit is contained in:
27
extensions/html/client/src/embeddedContentUri.ts
Normal file
27
extensions/html/client/src/embeddedContentUri.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { Uri } from 'vscode';
|
||||
|
||||
export const EMBEDDED_CONTENT_SCHEME = 'embedded-content';
|
||||
|
||||
export function isEmbeddedContentUri(virtualDocumentUri: Uri): boolean {
|
||||
return virtualDocumentUri.scheme === EMBEDDED_CONTENT_SCHEME;
|
||||
}
|
||||
|
||||
export function getEmbeddedContentUri(parentDocumentUri: string, embeddedLanguageId: string): Uri {
|
||||
return Uri.parse(EMBEDDED_CONTENT_SCHEME + '://' + embeddedLanguageId + '/' + encodeURIComponent(parentDocumentUri) + '.' + embeddedLanguageId);
|
||||
};
|
||||
|
||||
export function getHostDocumentUri(virtualDocumentUri: Uri): string {
|
||||
let languageId = virtualDocumentUri.authority;
|
||||
let path = virtualDocumentUri.path.substring(1, virtualDocumentUri.path.length - languageId.length - 1); // remove leading '/' and new file extension
|
||||
return decodeURIComponent(path);
|
||||
};
|
||||
|
||||
export function getEmbeddedLanguageId(virtualDocumentUri: Uri): string {
|
||||
return virtualDocumentUri.authority;
|
||||
}
|
||||
Reference in New Issue
Block a user