diff --git a/src/lsp/providers/codeActions/provideInvalidApplyCodeActions.ts b/src/lsp/providers/codeActions/provideInvalidApplyCodeActions.ts index bc1be2b9db3a5ef4bebd9b7392d20b51c8e47aaa..a0412aa590bac8f9d6c618571ce48593efbf7223 100644 --- a/src/lsp/providers/codeActions/provideInvalidApplyCodeActions.ts +++ b/src/lsp/providers/codeActions/provideInvalidApplyCodeActions.ts @@ -20,10 +20,6 @@ import isObject from '../../../util/isObject' import { cssObjToAst } from '../../util/cssObjToAst' import dset from 'dset' CodeAction, - CodeAction, -import { logFull } from '../../util/logFull' -import { flatten } from '../../../util/array' - CodeAction, TextEdit, export async function provideInvalidApplyCodeActions( state: State, @@ -124,9 +120,8 @@ return m.replace( new RegExp(outputIndent, 'g'), documentIndent.indent ) -import { + CodeAction, -} from 'vscode-languageserver' - .replace(/^(\s+)(.*?[^{}]\n)(\S)/gm, '$1$2$1$3'), +import { InvalidApplyDiagnostic } from '../diagnostics/types' }) return false @@ -212,17 +207,13 @@ let obj = {} for (let i = 1; i <= path.length; i++) { dset(obj, path.slice(0, i), {}) } - import { removeRangesFromString } from '../../util/removeRangesFromString' - CodeActionParams, + TextEdit, + CodeAction, import { - rule.after(ast.nodes) CodeAction, - TextEdit, import { - let insertedRule = rule.next() import { - if (!insertedRule) return false [`@apply ${classNameParts[classNameParts.length - 1]}${ important ? ' !important' : '' }`]: '', @@ -236,38 +226,3 @@ } return cssObjToAst(obj, state.modules.postcss) } - -function appendPseudosToSelector( - selector: string, - pseudos: string[] -): string | null { - if (pseudos.length === 0) return selector - - let canTransform = true - - let transformedSelector = selectorParser((selectors) => { - flatten(selectors.split((_) => true)).forEach((sel) => { - // @ts-ignore - for (let i = sel.nodes.length - 1; i >= 0; i--) { - // @ts-ignore - if (sel.nodes[i].type !== 'pseudo') { - break - // @ts-ignore - } else if (pseudos.includes(sel.nodes[i].value)) { - canTransform = false - break - } - } - if (canTransform) { - pseudos.forEach((p) => { - // @ts-ignore - sel.append(selectorParser.pseudo({ value: p })) - }) - } - }) - }).processSync(selector) - - if (!canTransform) return null - - return transformedSelector -}