Home

tailwind-ctp-intellisense @7b8ee549de91d6110e638be064471be25b57845a - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tailwind-ctp-intellisense / packages / tailwindcss-language-server / src / util / css.ts
- raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { TextDocument, Position } from 'vscode-languageserver'
import { isMixedDoc, isInsideTag } from './html'

export const CSS_LANGUAGES = [
  'css',
  'less',
  'postcss',
  'sass',
  'scss',
  'stylus',
]

function isCssDoc(doc: TextDocument): boolean {
  return CSS_LANGUAGES.indexOf(doc.languageId) !== -1
}

export function isCssContext(doc: TextDocument, position: Position): boolean {
  if (isCssDoc(doc)) {
    return true
  }

  if (isMixedDoc(doc)) {
    let str = doc.getText({
      start: { line: 0, character: 0 },
      end: position,
    })

    return isInsideTag(str, ['style'])
  }

  return false
}