Home

tailwind-ctp-intellisense @14ffaf4aeaf025a87a73f3ea4ada67e38f85a1f2 - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tailwind-ctp-intellisense / packages / tailwindcss-language-server / src / util / isWithinRange.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
33
34
import { Position, Range } from 'vscode-languageserver'

export function isWithinRange(position: Position, range: Range): boolean {
  if (
    position.line === range.start.line &&
    position.character >= range.start.character
  ) {
    if (
      position.line === range.end.line &&
      position.character > range.end.character
    ) {
      return false
    } else {
      return true
    }
  }
  if (
    position.line === range.end.line &&
    position.character <= range.end.character
  ) {
    if (
      position.line === range.start.line &&
      position.character < range.end.character
    ) {
      return false
    } else {
      return true
    }
  }
  if (position.line > range.start.line && position.line < range.end.line) {
    return true
  }
  return false
}