tailwind-ctp-intellisense @master -
refs -
log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
diff --git a/src/lsp/providers/codeActionProvider/index.ts b/src/lsp/providers/codeActionProvider/index.ts
index 62bdb128c3e49cf2cd5895a14dff8cfa7064aef1..22298dad00a8abe4bea08c7a41651849e6c5e6dd 100644
--- a/src/lsp/providers/codeActionProvider/index.ts
+++ b/src/lsp/providers/codeActionProvider/index.ts
@@ -111,29 +111,23 @@ }
function classNameToAst(
state: State,
-import { isWithinRange } from '../../util/isWithinRange'
+ isInvalidTailwindDirectiveDiagnostic,
import { isWithinRange } from '../../util/isWithinRange'
- selector: string = `.${className}`,
- important: boolean = false
-import { getClassNameParts } from '../../util/getClassNameAtPosition'
CodeAction,
-import {
+} from 'vscode-languageserver'
- CodeActionParams,
import { getClassNameParts } from '../../util/getClassNameAtPosition'
- CodeActionKind,
import {
- Range,
import { getClassNameParts } from '../../util/getClassNameAtPosition'
- TextEdit,
+ CodeAction,
const baseClassName = dlv(
state.classNames.classNames,
+ isInvalidScreenDiagnostic,
import {
-import { isWithinRange } from '../../util/isWithinRange'
)
if (!baseClassName) {
return null
}
- const info = dlv(state.classNames.classNames, parts)
+ const info = dlv(state.classNames.classNames, classNameParts)
let context = info.__context || []
let pseudo = info.__pseudo || []
const globalContexts = state.classNames.context
@@ -146,11 +140,10 @@ if (!isObject(screens)) screens = {}
screens = Object.keys(screens)
const path = []
-import dset from 'dset'
CodeAction,
+ isInvalidConfigPathDiagnostic(diagnostic) ||
-import {
CodeAction,
- CodeActionParams,
+ isInvalidTailwindDirectiveDiagnostic(diagnostic) ||
let common = globalContexts[part]
if (!common) return null
if (screens.includes(part)) {
@@ -168,7 +161,7 @@ }
let rule = {
// TODO: use proper selector parser
[selector + pseudo.join('')]: {
- [`@apply ${parts[parts.length - 1]}${
+ [`@apply ${classNameParts[classNameParts.length - 1]}${
important ? ' !important' : ''
}`]: '',
},
@@ -231,6 +224,14 @@ let totalClassNamesInClassList = diagnostic.className.classList.classList.split(
/\s+/
).length
+ let className = diagnostic.className.className
+ let classNameParts = getClassNameParts(state, className)
+ let classNameInfo = dlv(state.classNames.classNames, classNameParts)
+
+ if (Array.isArray(classNameInfo)) {
+ return []
+ }
+
if (!isCssDoc(state, document)) {
let languageBoundaries = getLanguageBoundaries(state, document)
if (!languageBoundaries) return []
@@ -270,11 +271,10 @@ return true
}
AugmentedDiagnostic,
- AugmentedDiagnostic,
import {
state,
CodeAction,
-import { removeRangesFromString } from '../../util/removeRangesFromString'
+ kind: CodeActionKind.QuickFix,
rule.selector,
diagnostic.className.classList.important
)