Home

tailwind-ctp-intellisense @9f003fecd52144f20b38329d3f22cf0924b2eacd - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tailwind-ctp-intellisense / src / lsp / 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
}