[ci] yarn format
This commit is contained in:
parent
c3c96bf498
commit
86ed94e0c6
11 changed files with 494 additions and 619 deletions
|
@ -75,10 +75,7 @@ export abstract class ReadableDocument implements TextDocument {
|
|||
}
|
||||
|
||||
const lineOffset = lineOffsets[position.line];
|
||||
const nextLineOffset =
|
||||
position.line + 1 < lineOffsets.length
|
||||
? lineOffsets[position.line + 1]
|
||||
: this.getTextLength();
|
||||
const nextLineOffset = position.line + 1 < lineOffsets.length ? lineOffsets[position.line + 1] : this.getTextLength();
|
||||
|
||||
return clamp(nextLineOffset, lineOffset, lineOffset + position.character);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
CodeAction,
|
||||
SelectionRange,
|
||||
TextEdit,
|
||||
InsertReplaceEdit
|
||||
InsertReplaceEdit,
|
||||
} from 'vscode-languageserver';
|
||||
import { TagInformation, offsetAt, positionAt } from './utils';
|
||||
import { SourceMapConsumer } from 'source-map';
|
||||
|
@ -89,11 +89,7 @@ export class IdentityMapper implements DocumentMapper {
|
|||
* Maps positions in a fragment relative to a parent.
|
||||
*/
|
||||
export class FragmentMapper implements DocumentMapper {
|
||||
constructor(
|
||||
private originalText: string,
|
||||
private tagInfo: TagInformation,
|
||||
private url: string
|
||||
) {}
|
||||
constructor(private originalText: string, private tagInfo: TagInformation, private url: string) {}
|
||||
|
||||
getOriginalPosition(generatedPosition: Position): Position {
|
||||
const parentOffset = this.offsetInParent(offsetAt(generatedPosition, this.tagInfo.content));
|
||||
|
@ -120,11 +116,7 @@ export class FragmentMapper implements DocumentMapper {
|
|||
}
|
||||
|
||||
export class SourceMapDocumentMapper implements DocumentMapper {
|
||||
constructor(
|
||||
protected consumer: SourceMapConsumer,
|
||||
protected sourceUri: string,
|
||||
private parent?: DocumentMapper
|
||||
) {}
|
||||
constructor(protected consumer: SourceMapConsumer, protected sourceUri: string, private parent?: DocumentMapper) {}
|
||||
|
||||
getOriginalPosition(generatedPosition: Position): Position {
|
||||
if (this.parent) {
|
||||
|
@ -137,7 +129,7 @@ export class SourceMapDocumentMapper implements DocumentMapper {
|
|||
|
||||
const mapped = this.consumer.originalPositionFor({
|
||||
line: generatedPosition.line + 1,
|
||||
column: generatedPosition.character
|
||||
column: generatedPosition.character,
|
||||
});
|
||||
|
||||
if (!mapped) {
|
||||
|
@ -150,7 +142,7 @@ export class SourceMapDocumentMapper implements DocumentMapper {
|
|||
|
||||
return {
|
||||
line: (mapped.line || 0) - 1,
|
||||
character: mapped.column || 0
|
||||
character: mapped.column || 0,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -162,7 +154,7 @@ export class SourceMapDocumentMapper implements DocumentMapper {
|
|||
const mapped = this.consumer.generatedPositionFor({
|
||||
line: originalPosition.line + 1,
|
||||
column: originalPosition.character,
|
||||
source: this.sourceUri
|
||||
source: this.sourceUri,
|
||||
});
|
||||
|
||||
if (!mapped) {
|
||||
|
@ -171,7 +163,7 @@ export class SourceMapDocumentMapper implements DocumentMapper {
|
|||
|
||||
const result = {
|
||||
line: (mapped.line || 0) - 1,
|
||||
character: mapped.column || 0
|
||||
character: mapped.column || 0,
|
||||
};
|
||||
|
||||
if (result.line < 0) {
|
||||
|
@ -203,25 +195,21 @@ export class SourceMapDocumentMapper implements DocumentMapper {
|
|||
}
|
||||
}
|
||||
|
||||
export function mapRangeToOriginal(
|
||||
fragment: Pick<DocumentMapper, 'getOriginalPosition'>,
|
||||
range: Range
|
||||
): Range {
|
||||
export function mapRangeToOriginal(fragment: Pick<DocumentMapper, 'getOriginalPosition'>, range: Range): Range {
|
||||
// DON'T use Range.create here! Positions might not be mapped
|
||||
// and therefore return negative numbers, which makes Range.create throw.
|
||||
// These invalid position need to be handled
|
||||
// on a case-by-case basis in the calling functions.
|
||||
const originalRange = {
|
||||
start: fragment.getOriginalPosition(range.start),
|
||||
end: fragment.getOriginalPosition(range.end)
|
||||
end: fragment.getOriginalPosition(range.end),
|
||||
};
|
||||
|
||||
// Range may be mapped one character short - reverse that for "in the same line" cases
|
||||
if (
|
||||
originalRange.start.line === originalRange.end.line &&
|
||||
range.start.line === range.end.line &&
|
||||
originalRange.end.character - originalRange.start.character ===
|
||||
range.end.character - range.start.character - 1
|
||||
originalRange.end.character - originalRange.start.character === range.end.character - range.start.character - 1
|
||||
) {
|
||||
originalRange.end.character += 1;
|
||||
}
|
||||
|
@ -230,30 +218,21 @@ export function mapRangeToOriginal(
|
|||
}
|
||||
|
||||
export function mapRangeToGenerated(fragment: DocumentMapper, range: Range): Range {
|
||||
return Range.create(
|
||||
fragment.getGeneratedPosition(range.start),
|
||||
fragment.getGeneratedPosition(range.end)
|
||||
);
|
||||
return Range.create(fragment.getGeneratedPosition(range.start), fragment.getGeneratedPosition(range.end));
|
||||
}
|
||||
|
||||
export function mapCompletionItemToOriginal(
|
||||
fragment: Pick<DocumentMapper, 'getOriginalPosition'>,
|
||||
item: CompletionItem
|
||||
): CompletionItem {
|
||||
export function mapCompletionItemToOriginal(fragment: Pick<DocumentMapper, 'getOriginalPosition'>, item: CompletionItem): CompletionItem {
|
||||
if (!item.textEdit) {
|
||||
return item;
|
||||
}
|
||||
|
||||
return {
|
||||
...item,
|
||||
textEdit: mapEditToOriginal(fragment, item.textEdit)
|
||||
textEdit: mapEditToOriginal(fragment, item.textEdit),
|
||||
};
|
||||
}
|
||||
|
||||
export function mapHoverToParent(
|
||||
fragment: Pick<DocumentMapper, 'getOriginalPosition'>,
|
||||
hover: Hover
|
||||
): Hover {
|
||||
export function mapHoverToParent(fragment: Pick<DocumentMapper, 'getOriginalPosition'>, hover: Hover): Hover {
|
||||
if (!hover.range) {
|
||||
return hover;
|
||||
}
|
||||
|
@ -261,46 +240,29 @@ export function mapHoverToParent(
|
|||
return { ...hover, range: mapRangeToOriginal(fragment, hover.range) };
|
||||
}
|
||||
|
||||
export function mapObjWithRangeToOriginal<T extends { range: Range }>(
|
||||
fragment: Pick<DocumentMapper, 'getOriginalPosition'>,
|
||||
objWithRange: T
|
||||
): T {
|
||||
export function mapObjWithRangeToOriginal<T extends { range: Range }>(fragment: Pick<DocumentMapper, 'getOriginalPosition'>, objWithRange: T): T {
|
||||
return { ...objWithRange, range: mapRangeToOriginal(fragment, objWithRange.range) };
|
||||
}
|
||||
|
||||
export function mapInsertReplaceEditToOriginal(
|
||||
fragment: Pick<DocumentMapper, 'getOriginalPosition'>,
|
||||
edit: InsertReplaceEdit
|
||||
): InsertReplaceEdit {
|
||||
export function mapInsertReplaceEditToOriginal(fragment: Pick<DocumentMapper, 'getOriginalPosition'>, edit: InsertReplaceEdit): InsertReplaceEdit {
|
||||
return {
|
||||
...edit,
|
||||
insert: mapRangeToOriginal(fragment, edit.insert),
|
||||
replace: mapRangeToOriginal(fragment, edit.replace)
|
||||
replace: mapRangeToOriginal(fragment, edit.replace),
|
||||
};
|
||||
}
|
||||
|
||||
export function mapEditToOriginal(
|
||||
fragment: Pick<DocumentMapper, 'getOriginalPosition'>,
|
||||
edit: TextEdit | InsertReplaceEdit
|
||||
): TextEdit | InsertReplaceEdit {
|
||||
return TextEdit.is(edit)
|
||||
? mapObjWithRangeToOriginal(fragment, edit)
|
||||
: mapInsertReplaceEditToOriginal(fragment, edit);
|
||||
export function mapEditToOriginal(fragment: Pick<DocumentMapper, 'getOriginalPosition'>, edit: TextEdit | InsertReplaceEdit): TextEdit | InsertReplaceEdit {
|
||||
return TextEdit.is(edit) ? mapObjWithRangeToOriginal(fragment, edit) : mapInsertReplaceEditToOriginal(fragment, edit);
|
||||
}
|
||||
|
||||
export function mapDiagnosticToGenerated(
|
||||
fragment: DocumentMapper,
|
||||
diagnostic: Diagnostic
|
||||
): Diagnostic {
|
||||
export function mapDiagnosticToGenerated(fragment: DocumentMapper, diagnostic: Diagnostic): Diagnostic {
|
||||
return { ...diagnostic, range: mapRangeToGenerated(fragment, diagnostic.range) };
|
||||
}
|
||||
|
||||
export function mapColorPresentationToOriginal(
|
||||
fragment: Pick<DocumentMapper, 'getOriginalPosition'>,
|
||||
presentation: ColorPresentation
|
||||
): ColorPresentation {
|
||||
export function mapColorPresentationToOriginal(fragment: Pick<DocumentMapper, 'getOriginalPosition'>, presentation: ColorPresentation): ColorPresentation {
|
||||
const item = {
|
||||
...presentation
|
||||
...presentation,
|
||||
};
|
||||
|
||||
if (item.textEdit) {
|
||||
|
@ -308,36 +270,22 @@ export function mapColorPresentationToOriginal(
|
|||
}
|
||||
|
||||
if (item.additionalTextEdits) {
|
||||
item.additionalTextEdits = item.additionalTextEdits.map((edit) =>
|
||||
mapObjWithRangeToOriginal(fragment, edit)
|
||||
);
|
||||
item.additionalTextEdits = item.additionalTextEdits.map((edit) => mapObjWithRangeToOriginal(fragment, edit));
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
export function mapSymbolInformationToOriginal(
|
||||
fragment: Pick<DocumentMapper, 'getOriginalPosition'>,
|
||||
info: SymbolInformation
|
||||
): SymbolInformation {
|
||||
export function mapSymbolInformationToOriginal(fragment: Pick<DocumentMapper, 'getOriginalPosition'>, info: SymbolInformation): SymbolInformation {
|
||||
return { ...info, location: mapObjWithRangeToOriginal(fragment, info.location) };
|
||||
}
|
||||
|
||||
export function mapLocationLinkToOriginal(
|
||||
fragment: DocumentMapper,
|
||||
def: LocationLink
|
||||
): LocationLink {
|
||||
export function mapLocationLinkToOriginal(fragment: DocumentMapper, def: LocationLink): LocationLink {
|
||||
return LocationLink.create(
|
||||
def.targetUri,
|
||||
fragment.getURL() === def.targetUri
|
||||
? mapRangeToOriginal(fragment, def.targetRange)
|
||||
: def.targetRange,
|
||||
fragment.getURL() === def.targetUri
|
||||
? mapRangeToOriginal(fragment, def.targetSelectionRange)
|
||||
: def.targetSelectionRange,
|
||||
def.originSelectionRange
|
||||
? mapRangeToOriginal(fragment, def.originSelectionRange)
|
||||
: undefined
|
||||
fragment.getURL() === def.targetUri ? mapRangeToOriginal(fragment, def.targetRange) : def.targetRange,
|
||||
fragment.getURL() === def.targetUri ? mapRangeToOriginal(fragment, def.targetSelectionRange) : def.targetSelectionRange,
|
||||
def.originSelectionRange ? mapRangeToOriginal(fragment, def.originSelectionRange) : undefined
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -356,22 +304,14 @@ export function mapCodeActionToOriginal(fragment: DocumentMapper, codeAction: Co
|
|||
return CodeAction.create(
|
||||
codeAction.title,
|
||||
{
|
||||
documentChanges: codeAction.edit!.documentChanges!.map((edit) =>
|
||||
mapTextDocumentEditToOriginal(fragment, edit as TextDocumentEdit)
|
||||
)
|
||||
documentChanges: codeAction.edit!.documentChanges!.map((edit) => mapTextDocumentEditToOriginal(fragment, edit as TextDocumentEdit)),
|
||||
},
|
||||
codeAction.kind
|
||||
);
|
||||
}
|
||||
|
||||
export function mapSelectionRangeToParent(
|
||||
fragment: Pick<DocumentMapper, 'getOriginalPosition'>,
|
||||
selectionRange: SelectionRange
|
||||
): SelectionRange {
|
||||
export function mapSelectionRangeToParent(fragment: Pick<DocumentMapper, 'getOriginalPosition'>, selectionRange: SelectionRange): SelectionRange {
|
||||
const { range, parent } = selectionRange;
|
||||
|
||||
return SelectionRange.create(
|
||||
mapRangeToOriginal(fragment, range),
|
||||
parent && mapSelectionRangeToParent(fragment, parent)
|
||||
);
|
||||
return SelectionRange.create(mapRangeToOriginal(fragment, range), parent && mapSelectionRangeToParent(fragment, parent));
|
||||
}
|
|
@ -12,9 +12,7 @@ export interface TagInformation {
|
|||
container: { start: number; end: number };
|
||||
}
|
||||
|
||||
function parseAttributes(
|
||||
rawAttrs: Record<string, string | null> | undefined
|
||||
): Record<string, string> {
|
||||
function parseAttributes(rawAttrs: Record<string, string | null> | undefined): Record<string, string> {
|
||||
const attrs: Record<string, string> = {};
|
||||
if (!rawAttrs) {
|
||||
return attrs;
|
||||
|
@ -27,10 +25,7 @@ function parseAttributes(
|
|||
return attrs;
|
||||
|
||||
function removeOuterQuotes(attrValue: string) {
|
||||
if (
|
||||
(attrValue.startsWith('"') && attrValue.endsWith('"')) ||
|
||||
(attrValue.startsWith("'") && attrValue.endsWith("'"))
|
||||
) {
|
||||
if ((attrValue.startsWith('"') && attrValue.endsWith('"')) || (attrValue.startsWith("'") && attrValue.endsWith("'"))) {
|
||||
return attrValue.slice(1, attrValue.length - 1);
|
||||
}
|
||||
return attrValue;
|
||||
|
@ -202,14 +197,9 @@ export function* walk(node: Node, startIndex = 0) {
|
|||
* @param source text content to extract tag from
|
||||
* @param tag the tag to extract
|
||||
*/
|
||||
function extractTags(
|
||||
text: string,
|
||||
tag: 'script' | 'style' | 'template',
|
||||
html?: HTMLDocument
|
||||
): TagInformation[] {
|
||||
function extractTags(text: string, tag: 'script' | 'style' | 'template', html?: HTMLDocument): TagInformation[] {
|
||||
const rootNodes = html?.roots || parseHtml(text).roots;
|
||||
const matchedNodes = rootNodes
|
||||
.filter((node) => node.tag === tag);
|
||||
const matchedNodes = rootNodes.filter((node) => node.tag === tag);
|
||||
|
||||
if (tag === 'style' && !matchedNodes.length && rootNodes.length && rootNodes[0].tag === 'html') {
|
||||
for (let child of walk(rootNodes[0])) {
|
||||
|
@ -228,7 +218,7 @@ export function* walk(node: Node, startIndex = 0) {
|
|||
const endPos = positionAt(end, text);
|
||||
const container = {
|
||||
start: matchedNode.start,
|
||||
end: matchedNode.end
|
||||
end: matchedNode.end,
|
||||
};
|
||||
const content = text.substring(start, end);
|
||||
|
||||
|
@ -239,7 +229,7 @@ export function* walk(node: Node, startIndex = 0) {
|
|||
end,
|
||||
startPos,
|
||||
endPos,
|
||||
container
|
||||
container,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ export class CSSDocument extends ReadableDocument implements DocumentMapper {
|
|||
this.styleInfo = {
|
||||
attributes: {},
|
||||
start: -1,
|
||||
end: -1
|
||||
end: -1,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -26,20 +26,12 @@ export class CSSPlugin implements CompletionsProvider {
|
|||
});
|
||||
}
|
||||
|
||||
getCompletions(
|
||||
document: Document,
|
||||
position: Position,
|
||||
completionContext?: CompletionContext
|
||||
): CompletionList | null {
|
||||
getCompletions(document: Document, position: Position, completionContext?: CompletionContext): CompletionList | null {
|
||||
const triggerCharacter = completionContext?.triggerCharacter;
|
||||
const triggerKind = completionContext?.triggerKind;
|
||||
const isCustomTriggerCharacter = triggerKind === CompletionTriggerKind.TriggerCharacter;
|
||||
|
||||
if (
|
||||
isCustomTriggerCharacter &&
|
||||
triggerCharacter &&
|
||||
!this.triggerCharacters.has(triggerCharacter)
|
||||
) {
|
||||
if (isCustomTriggerCharacter && triggerCharacter && !this.triggerCharacters.has(triggerCharacter)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -60,21 +52,13 @@ export class CSSPlugin implements CompletionsProvider {
|
|||
|
||||
if (this.inStyleAttributeWithoutInterpolation(attributeContext, document.getText())) {
|
||||
const [start, end] = attributeContext.valueRange;
|
||||
return this.getCompletionsInternal(
|
||||
document,
|
||||
position,
|
||||
new StyleAttributeDocument(document, start, end)
|
||||
);
|
||||
return this.getCompletionsInternal(document, position, new StyleAttributeDocument(document, start, end));
|
||||
} else {
|
||||
return getIdClassCompletion(cssDocument, attributeContext);
|
||||
}
|
||||
}
|
||||
|
||||
private getCompletionsInternal(
|
||||
document: Document,
|
||||
position: Position,
|
||||
cssDocument: CSSDocumentBase
|
||||
) {
|
||||
private getCompletionsInternal(document: Document, position: Position, cssDocument: CSSDocumentBase) {
|
||||
if (isSASS(cssDocument)) {
|
||||
// the css language service does not support sass, still we can use
|
||||
// the emmet helper directly to at least get emmet completions
|
||||
|
@ -86,42 +70,23 @@ export class CSSPlugin implements CompletionsProvider {
|
|||
const lang = getLanguageService(type);
|
||||
const emmetResults: CompletionList = {
|
||||
isIncomplete: true,
|
||||
items: []
|
||||
items: [],
|
||||
};
|
||||
if (false /* this.configManager.getConfig().css.completions.emmet */) {
|
||||
lang.setCompletionParticipants([
|
||||
getEmmetCompletionParticipants(
|
||||
cssDocument,
|
||||
cssDocument.getGeneratedPosition(position),
|
||||
getLanguage(type),
|
||||
this.configManager.getEmmetConfig(),
|
||||
emmetResults
|
||||
)
|
||||
getEmmetCompletionParticipants(cssDocument, cssDocument.getGeneratedPosition(position), getLanguage(type), this.configManager.getEmmetConfig(), emmetResults),
|
||||
]);
|
||||
}
|
||||
const results = lang.doComplete(
|
||||
cssDocument,
|
||||
cssDocument.getGeneratedPosition(position),
|
||||
cssDocument.stylesheet
|
||||
);
|
||||
const results = lang.doComplete(cssDocument, cssDocument.getGeneratedPosition(position), cssDocument.stylesheet);
|
||||
return CompletionList.create(
|
||||
[...(results ? results.items : []), ...emmetResults.items].map((completionItem) =>
|
||||
mapCompletionItemToOriginal(cssDocument, completionItem)
|
||||
),
|
||||
[...(results ? results.items : []), ...emmetResults.items].map((completionItem) => mapCompletionItemToOriginal(cssDocument, completionItem)),
|
||||
// Emmet completions change on every keystroke, so they are never complete
|
||||
emmetResults.items.length > 0
|
||||
);
|
||||
}
|
||||
|
||||
private inStyleAttributeWithoutInterpolation(
|
||||
attrContext: AttributeContext,
|
||||
text: string
|
||||
): attrContext is Required<AttributeContext> {
|
||||
return (
|
||||
attrContext.name === 'style' &&
|
||||
!!attrContext.valueRange &&
|
||||
!text.substring(attrContext.valueRange[0], attrContext.valueRange[1]).includes('{')
|
||||
);
|
||||
private inStyleAttributeWithoutInterpolation(attrContext: AttributeContext, text: string): attrContext is Required<AttributeContext> {
|
||||
return attrContext.name === 'style' && !!attrContext.valueRange && !text.substring(attrContext.valueRange[0], attrContext.valueRange[1]).includes('{');
|
||||
}
|
||||
|
||||
private getCSSDoc(document: Document) {
|
||||
|
|
|
@ -12,11 +12,7 @@ export class StyleAttributeDocument extends ReadableDocument implements Document
|
|||
public stylesheet: Stylesheet;
|
||||
public languageId = 'css';
|
||||
|
||||
constructor(
|
||||
private readonly parent: Document,
|
||||
private readonly attrStart: number,
|
||||
private readonly attrEnd: number
|
||||
) {
|
||||
constructor(private readonly parent: Document, private readonly attrStart: number, private readonly attrEnd: number) {
|
||||
super();
|
||||
|
||||
this.stylesheet = getLanguageService(this.languageId).parseStylesheet(this);
|
||||
|
|
|
@ -2,10 +2,7 @@ import { CompletionItem, CompletionItemKind, CompletionList } from 'vscode-langu
|
|||
import { AttributeContext } from '../../../core/documents/parseHtml';
|
||||
import { CSSDocument } from '../CSSDocument';
|
||||
|
||||
export function getIdClassCompletion(
|
||||
cssDoc: CSSDocument,
|
||||
attributeContext: AttributeContext
|
||||
): CompletionList | null {
|
||||
export function getIdClassCompletion(cssDoc: CSSDocument, attributeContext: AttributeContext): CompletionList | null {
|
||||
const collectingType = getCollectingType(attributeContext);
|
||||
|
||||
if (!collectingType) {
|
||||
|
@ -13,7 +10,7 @@ export function getIdClassCompletion(
|
|||
}
|
||||
const items = collectSelectors(cssDoc.stylesheet as CSSNode, collectingType);
|
||||
|
||||
console.log("getIdClassCompletion items", items.length);
|
||||
console.log('getIdClassCompletion items', items.length);
|
||||
return CompletionList.create(items);
|
||||
}
|
||||
|
||||
|
@ -37,7 +34,7 @@ function getCollectingType(attributeContext: AttributeContext): number | undefin
|
|||
*/
|
||||
export enum NodeType {
|
||||
ClassSelector = 14,
|
||||
IdentifierSelector = 15
|
||||
IdentifierSelector = 15,
|
||||
}
|
||||
|
||||
export type CSSNode = {
|
||||
|
@ -57,7 +54,7 @@ export function collectSelectors(stylesheet: CSSNode, type: number) {
|
|||
return result.map(
|
||||
(node): CompletionItem => ({
|
||||
label: node.getText().substring(1),
|
||||
kind: CompletionItemKind.Keyword
|
||||
kind: CompletionItemKind.Keyword,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
import {
|
||||
getCSSLanguageService,
|
||||
getSCSSLanguageService,
|
||||
getLESSLanguageService,
|
||||
LanguageService,
|
||||
ICSSDataProvider
|
||||
} from 'vscode-css-languageservice';
|
||||
import { getCSSLanguageService, getSCSSLanguageService, getLESSLanguageService, LanguageService, ICSSDataProvider } from 'vscode-css-languageservice';
|
||||
|
||||
const customDataProvider: ICSSDataProvider = {
|
||||
providePseudoClasses() {
|
||||
|
@ -18,23 +12,19 @@ const customDataProvider: ICSSDataProvider = {
|
|||
},
|
||||
providePseudoElements() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const [css, scss, less] = [
|
||||
getCSSLanguageService,
|
||||
getSCSSLanguageService,
|
||||
getLESSLanguageService
|
||||
].map((getService) =>
|
||||
const [css, scss, less] = [getCSSLanguageService, getSCSSLanguageService, getLESSLanguageService].map((getService) =>
|
||||
getService({
|
||||
customDataProviders: [customDataProvider]
|
||||
customDataProviders: [customDataProvider],
|
||||
})
|
||||
);
|
||||
|
||||
const langs = {
|
||||
css,
|
||||
scss,
|
||||
less
|
||||
less,
|
||||
};
|
||||
|
||||
export function getLanguage(kind?: string) {
|
||||
|
|
Loading…
Reference in a new issue