Home

tailwind-ctp-intellisense @47d512edde5d9b6cbf058076b0e992949d95f6d9 - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tailwind-ctp-intellisense / packages / tailwindcss-language-server / src / lsp / diagnosticsProvider.ts
- raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
import type { TextDocument } from 'vscode-languageserver-textdocument'
import { State } from 'tailwindcss-language-service/src/util/state'
import { doValidate } from 'tailwindcss-language-service/src/diagnostics/diagnosticsProvider'
import isExcluded from '../util/isExcluded'

export async function provideDiagnostics(state: State, document: TextDocument) {
  if (await isExcluded(state, document)) {
    clearDiagnostics(state, document)
  } else {
    state.editor?.connection.sendDiagnostics({
      uri: document.uri,
      diagnostics: await doValidate(state, document),
    })
  }
}

export function clearDiagnostics(state: State, document: TextDocument): void {
  state.editor?.connection.sendDiagnostics({
    uri: document.uri,
    diagnostics: [],
  })
}