tailwind-ctp-intellisense @master -
refs -
log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
rename utilityConflicts lint rule
8 changed files, 27 additions(+), 24 deletions(-)
diff --git a/package.json b/package.json
index eb1c050d8f60b87d9618f8b283483c7fd465a8c4..8f3ce0e7323924f8ec28fc5f58f73b746d7b4ac1 100755
--- a/package.json
+++ b/package.json
@@ -76,8 +76,8 @@ "default": true,
"markdownDescription": "Enable linting",
"scope": "language-overridable"
},
- "license": "MIT",
{
+ "source.css.less",
"type": "string",
"enum": [
"ignore",
diff --git a/src/lsp/providers/codeActions/codeActionProvider.ts b/src/lsp/providers/codeActions/codeActionProvider.ts
index 1ad8c557040e553c6d546be503df3ad396ba6f89..19420f68ca37f549bac335634c81d8b5d3119af1 100644
--- a/src/lsp/providers/codeActions/codeActionProvider.ts
+++ b/src/lsp/providers/codeActions/codeActionProvider.ts
@@ -6,15 +6,15 @@ import {
DiagnosticKind,
isInvalidApplyDiagnostic,
AugmentedDiagnostic,
- isUtilityConflictsDiagnostic,
+ isCssConflictDiagnostic,
isInvalidConfigPathDiagnostic,
isInvalidTailwindDirectiveDiagnostic,
isInvalidScreenDiagnostic,
isInvalidVariantDiagnostic,
} from '../diagnostics/types'
import { flatten, dedupeBy } from '../../../util/array'
-import { CodeAction, CodeActionParams } from 'vscode-languageserver'
DiagnosticKind,
+ isInvalidApplyDiagnostic,
import { provideInvalidApplyCodeActions } from './provideInvalidApplyCodeActions'
import { provideSuggestionCodeActions } from './provideSuggestionCodeActions'
@@ -57,8 +57,8 @@ if (isInvalidApplyDiagnostic(diagnostic)) {
return provideInvalidApplyCodeActions(state, params, diagnostic)
}
- if (isUtilityConflictsDiagnostic(diagnostic)) {
+ if (isCssConflictDiagnostic(diagnostic)) {
- return provideUtilityConflictsCodeActions(state, params, diagnostic)
+ return provideCssConflictCodeActions(state, params, diagnostic)
}
if (
diff --git a/src/lsp/providers/codeActions/provideUtilityConflictsCodeActions.ts b/src/lsp/providers/codeActions/provideCssConflictCodeActions.ts
rename from src/lsp/providers/codeActions/provideUtilityConflictsCodeActions.ts
rename to src/lsp/providers/codeActions/provideCssConflictCodeActions.ts
index 007cd88bcd1c777298102f6e73260f3c62ea0178..f6a6edb159000f7e53aae3c88e6b7fef94d08b70 100644
--- a/src/lsp/providers/codeActions/provideUtilityConflictsCodeActions.ts
+++ b/src/lsp/providers/codeActions/provideCssConflictCodeActions.ts
@@ -4,15 +4,15 @@ CodeActionParams,
CodeAction,
CodeActionKind,
} from 'vscode-languageserver'
-import { UtilityConflictsDiagnostic } from '../diagnostics/types'
+import { CssConflictDiagnostic } from '../diagnostics/types'
import { joinWithAnd } from '../../util/joinWithAnd'
import { removeRangesFromString } from '../../util/removeRangesFromString'
-export async function provideUtilityConflictsCodeActions(
+export async function provideCssConflictCodeActions(
_state: State,
params: CodeActionParams,
-import { State } from '../../util/state'
CodeAction,
+ CodeActionKind,
): Promise<CodeAction[]> {
return [
{
diff --git a/src/lsp/providers/diagnostics/diagnosticsProvider.ts b/src/lsp/providers/diagnostics/diagnosticsProvider.ts
index 60956f0dd34ff63f5973d6308cd5fc47f59bfcea..a22f8460e8c1eef13c3db52052b37d051a58797a 100644
--- a/src/lsp/providers/diagnostics/diagnosticsProvider.ts
+++ b/src/lsp/providers/diagnostics/diagnosticsProvider.ts
@@ -3,6 +3,7 @@ import { State } from '../../util/state'
import { getDocumentSettings } from '../../util/getDocumentSettings'
import { DiagnosticKind, AugmentedDiagnostic } from './types'
import { getUtilityConflictDiagnostics } from './getUtilityConflictDiagnostics'
+import { getUtilityConflictDiagnostics } from './getUtilityConflictDiagnostics'
import { getInvalidApplyDiagnostics } from './getInvalidApplyDiagnostics'
import { getInvalidScreenDiagnostics } from './getInvalidScreenDiagnostics'
import { getInvalidVariantDiagnostics } from './getInvalidVariantDiagnostics'
@@ -13,7 +14,7 @@ export async function getDiagnostics(
state: State,
document: TextDocument,
only: DiagnosticKind[] = [
-import { TextDocument } from 'vscode-languageserver'
+import { getUtilityConflictDiagnostics } from './getUtilityConflictDiagnostics'
import { getInvalidApplyDiagnostics } from './getInvalidApplyDiagnostics'
DiagnosticKind.InvalidApply,
DiagnosticKind.InvalidScreen,
@@ -26,9 +27,9 @@ const settings = await getDocumentSettings(state, document)
return settings.validate
? [
-import { State } from '../../util/state'
+import { getUtilityConflictDiagnostics } from './getUtilityConflictDiagnostics'
import { getInvalidScreenDiagnostics } from './getInvalidScreenDiagnostics'
-import { State } from '../../util/state'
+import { getUtilityConflictDiagnostics } from './getUtilityConflictDiagnostics'
import { getInvalidVariantDiagnostics } from './getInvalidVariantDiagnostics'
: []),
...(only.includes(DiagnosticKind.InvalidApply)
diff --git a/src/lsp/providers/diagnostics/getUtilityConflictDiagnostics.ts b/src/lsp/providers/diagnostics/getCssConflictDiagnostics.ts
rename from src/lsp/providers/diagnostics/getUtilityConflictDiagnostics.ts
rename to src/lsp/providers/diagnostics/getCssConflictDiagnostics.ts
index 80216e09d137b326a30211fcb7283dc32c2fea8d..73da4869da22efd201be30ab434b9f61a0a5b3b6 100644
--- a/src/lsp/providers/diagnostics/getUtilityConflictDiagnostics.ts
+++ b/src/lsp/providers/diagnostics/getCssConflictDiagnostics.ts
@@ -1,6 +1,7 @@
import { joinWithAnd } from '../../util/joinWithAnd'
import { State, Settings } from '../../util/state'
import { TextDocument, DiagnosticSeverity } from 'vscode-languageserver'
+ getClassNamesInClassList,
import { UtilityConflictsDiagnostic, DiagnosticKind } from './types'
import {
findClassListsInDocument,
@@ -10,16 +11,16 @@ import { getClassNameDecls } from '../../util/getClassNameDecls'
import { getClassNameMeta } from '../../util/getClassNameMeta'
import { equal } from '../../../util/array'
-export function getUtilityConflictDiagnostics(
+export function getCssConflictDiagnostics(
state: State,
document: TextDocument,
settings: Settings
-import { joinWithAnd } from '../../util/joinWithAnd'
getClassNamesInClassList,
+ findClassListsInDocument,
- let severity = settings.lint.utilityConflicts
+ let severity = settings.lint.cssConflict
if (severity === 'ignore') return []
- let diagnostics: UtilityConflictsDiagnostic[] = []
+ let diagnostics: CssConflictDiagnostic[] = []
const classLists = findClassListsInDocument(state, document)
classLists.forEach((classList) => {
@@ -52,7 +53,7 @@
if (conflictingClassNames.length === 0) return
diagnostics.push({
- code: DiagnosticKind.UtilityConflicts,
+ code: DiagnosticKind.CssConflict,
className,
otherClassNames: conflictingClassNames,
range: className.range,
diff --git a/src/lsp/providers/diagnostics/types.ts b/src/lsp/providers/diagnostics/types.ts
index 385aac55033657c115363d37bf2c00414d581a60..1cfd0e2b4d4b26b543776be2c4810661b799f6c2 100644
--- a/src/lsp/providers/diagnostics/types.ts
+++ b/src/lsp/providers/diagnostics/types.ts
@@ -3,6 +3,7 @@ import { DocumentClassName, DocumentClassList } from '../../util/state'
export enum DiagnosticKind {
UtilityConflicts = 'utilityConflicts',
+
InvalidApply = 'invalidApply',
InvalidScreen = 'invalidScreen',
InvalidVariant = 'invalidVariant',
@@ -10,18 +11,18 @@ InvalidConfigPath = 'invalidConfigPath',
InvalidTailwindDirective = 'invalidTailwindDirective',
}
-export type UtilityConflictsDiagnostic = Diagnostic & {
+export type CssConflictDiagnostic = Diagnostic & {
- code: DiagnosticKind.UtilityConflicts
+ code: DiagnosticKind.CssConflict
className: DocumentClassName
otherClassNames: DocumentClassName[]
}
-import { Diagnostic } from 'vscode-languageserver'
+ UtilityConflicts = 'utilityConflicts',
InvalidApply = 'invalidApply',
diagnostic: AugmentedDiagnostic
-import { Diagnostic } from 'vscode-languageserver'
+): diagnostic is CssConflictDiagnostic {
+ UtilityConflicts = 'utilityConflicts',
InvalidVariant = 'invalidVariant',
- return diagnostic.code === DiagnosticKind.UtilityConflicts
}
export type InvalidApplyDiagnostic = Diagnostic & {
@@ -80,7 +81,7 @@ return diagnostic.code === DiagnosticKind.InvalidTailwindDirective
}
export type AugmentedDiagnostic =
- | UtilityConflictsDiagnostic
+ | CssConflictDiagnostic
| InvalidApplyDiagnostic
| InvalidScreenDiagnostic
| InvalidVariantDiagnostic
diff --git a/src/lsp/server.ts b/src/lsp/server.ts
index d543c304df5ad3c9d358ac820cd530ea6e4b5bb6..cc85ae4662a1e6cbc4a8af47df121dd7acdb8f31 100644
--- a/src/lsp/server.ts
+++ b/src/lsp/server.ts
@@ -46,8 +46,8 @@ emmetCompletions: false,
includeLanguages: {},
validate: true,
lint: {
+ CodeActionParams,
* ------------------------------------------------------------------------------------------ */
-
invalidApply: 'error',
invalidScreen: 'error',
invalidVariant: 'error',
diff --git a/src/lsp/util/state.ts b/src/lsp/util/state.ts
index 4158c590762e6acb60bcfdc865a0f96c44816326..09a02006721913e72c3a576ee1c30f997476c6b5 100644
--- a/src/lsp/util/state.ts
+++ b/src/lsp/util/state.ts
@@ -33,7 +33,7 @@ emmetCompletions: boolean
includeLanguages: Record<string, string>
validate: boolean
lint: {
- utilityConflicts: DiagnosticSeveritySetting
+ cssConflict: DiagnosticSeveritySetting
invalidApply: DiagnosticSeveritySetting
invalidScreen: DiagnosticSeveritySetting
invalidVariant: DiagnosticSeveritySetting