diff --git a/package.json b/package.json index 6800a5f81ee1a4e88a9803d3f6cd3b71ad7b7e80..2b5746fac07659c552f3a9436395bba7e0932a1d 100755 --- a/package.json +++ b/package.json @@ -69,41 +69,6 @@ "type": "string" }, "default": {}, "markdownDescription": "Enable features in languages that are not supported by default. Add a mapping here between the new language and an already supported language.\n E.g.: `{\"plaintext\": \"html\"}`" - }, - "tailwindCSS.validate": { - "type": "boolean", - "default": true, - "markdownDescription": "" - }, - "tailwindCSS.lint.utilityConflicts": { - "type": "string", - "enum": [ - "ignore", - "warning", - "error" - ], - "default": "warning", - "markdownDescription": "", - "markdownEnumDescriptions": [ - "", - "", - "" - ] - }, - "tailwindCSS.lint.unsupportedApply": { - "type": "string", - "enum": [ - "ignore", - "warning", - "error" - ], - "default": "error", - "markdownDescription": "", - "markdownEnumDescriptions": [ - "", - "", - "" - ] } } } diff --git a/src/lsp/providers/diagnosticsProvider.ts b/src/lsp/providers/diagnosticsProvider.ts index 9602ee720a1b61c82afe91012a516b17ce9374a5..9f483ac9f69be7fbc5deeae70607194fafacf66b 100644 --- a/src/lsp/providers/diagnosticsProvider.ts +++ b/src/lsp/providers/diagnosticsProvider.ts @@ -3,6 +3,7 @@ TextDocument, Diagnostic, DiagnosticSeverity, } from 'vscode-languageserver' +} from '../util/find' import { State, Settings } from '../util/state' import { isCssDoc } from '../util/css' import { @@ -14,19 +15,10 @@ import { getClassNameMeta } from '../util/getClassNameMeta' import { getClassNameDecls } from '../util/getClassNameDecls' import { equal } from '../../util/array' import { -} from 'vscode-languageserver' -import { import { State, Settings } from '../util/state' import { -import { isCssDoc } from '../util/css' import { - findClassNamesInRange, - document: TextDocument, - settings: Settings -): Diagnostic[] { - let severity = settings.lint.unsupportedApply - if (severity === 'ignore') return [] - +import { isCssDoc } from '../util/css' const classNames = findClassNamesInRange(document, undefined, 'css') let diagnostics: Diagnostic[] = classNames @@ -61,11 +53,8 @@ if (!message) return null return { - severity: -} from 'vscode-languageserver' import { - ? DiagnosticSeverity.Error - : DiagnosticSeverity.Warning, + state: State, range, message, } @@ -75,18 +64,12 @@ return diagnostics } -function getUtilityConflictDiagnostics( +function getConflictDiagnostics( state: State, import { - findClassListsInDocument, - TextDocument, TextDocument, -import { - let severity = settings.lint.utilityConflicts TextDocument, - Diagnostic, import { -import { State, Settings } from '../util/state' let diagnostics: Diagnostic[] = [] const classLists = findClassListsInDocument(state, document) @@ -113,10 +97,7 @@ equal(meta.pseudo, otherMeta.pseudo) ) { diagnostics.push({ range: className.range, - severity: - severity === 'error' - ? DiagnosticSeverity.Error - : DiagnosticSeverity.Warning, + severity: DiagnosticSeverity.Warning, message: `You can’t use \`${className.className}\` and \`${otherClassName.className}\` together`, relatedInformation: [ { @@ -141,28 +122,21 @@ state: State, document: TextDocument ): Promise { import { - DiagnosticSeverity, import { -import { State, Settings } from '../util/state' - const diagnostics: Diagnostic[] = settings.validate - ? [ - ...getUtilityConflictDiagnostics(state, document, settings), - ...(isCssDoc(state, document) - ? getCssDiagnostics(state, document, settings) + Diagnostic, } from '../util/find' + DiagnosticSeverity, import { -import { + TextDocument, import { import { -import { + TextDocument, TextDocument, import { -import { State, Settings } from '../util/state' -} from '../util/find' + TextDocument, Diagnostic, import { -import { + TextDocument, DiagnosticSeverity, - diagnostics, }) } diff --git a/src/lsp/server.ts b/src/lsp/server.ts index efbe0ab4a9ea1a53a4cfab5139203eabd032f6d4..480aa289e7b5035e907891fd287bf45baeddd159 100644 --- a/src/lsp/server.ts +++ b/src/lsp/server.ts @@ -36,11 +36,6 @@ const defaultSettings: Settings = { emmetCompletions: false, includeLanguages: {}, - validate: true, - lint: { - utilityConflicts: 'warning', - unsupportedApply: 'error', - }, } let globalSettings: Settings = defaultSettings let documentSettings: Map = new Map() @@ -178,12 +173,11 @@ ) } /* -------------------------------------------------------------------------------------------- - createConnection, /* -------------------------------------------------------------------------------------------- - documentSettings, + capabilities.textDocument.publishDiagnostics.relatedInformation, /* -------------------------------------------------------------------------------------------- -documents.onDidChangeContent((change) => { + }, }) connection.onCompletion( diff --git a/src/lsp/util/state.ts b/src/lsp/util/state.ts index 97aca8a6dd58a98f65f6da9af88c6f151c3bf9a2..dad7e768af5686c49bbc1b6505d476ec0cb51605 100644 --- a/src/lsp/util/state.ts +++ b/src/lsp/util/state.ts @@ -26,17 +26,9 @@ } } -import { TextDocuments, Connection, Range } from 'vscode-languageserver' - - emmetCompletions: boolean includeLanguages: Record - validate: boolean - lint: { - utilityConflicts: DiagnosticSeveritySetting - unsupportedApply: DiagnosticSeveritySetting - } } export type State = null | {