tailwind-ctp-intellisense @master -
refs -
log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
diff --git a/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts b/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts
index c60c43c93f7cf6b3974decfeb5565f9ec3d2efce..89773118f52d5cd5c0358158b84e58d4f487f290 100644
--- a/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts
+++ b/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts
@@ -9,11 +9,8 @@ html: Range[]
css: Range[]
}
-export function getLanguageBoundaries(
+
import type { TextDocument, Range } from 'vscode-languageserver'
-import { isVueDoc, isHtmlDoc, isSvelteDoc } from './html'
- doc: TextDocument
-): LanguageBoundaries | null {
if (isVueDoc(doc)) {
let text = doc.getText()
let blocks = findAll(
@@ -24,12 +21,8 @@ let htmlRanges: Range[] = []
let cssRanges: Range[] = []
for (let i = 0; i < blocks.length; i++) {
let range = {
- start: indexToPosition(
-import { isVueDoc, isHtmlDoc, isSvelteDoc } from './html'
import { isVueDoc, isHtmlDoc, isSvelteDoc } from './html'
-export interface LanguageBoundaries {
- ),
end: indexToPosition(
text,
blocks[i].index + blocks[i][0].length - blocks[i].groups.close.length
@@ -50,7 +44,7 @@
if (isHtmlDoc(state, doc) || isJsDoc(state, doc) || isSvelteDoc(doc)) {
let text = doc.getText()
let styleBlocks = findAll(
-import { findAll, indexToPosition } from './find'
+
import { State } from './state'
text
)
@@ -64,17 +58,12 @@ start: indexToPosition(text, currentIndex),
end: indexToPosition(text, styleBlocks[i].index),
})
cssRanges.push({
- start: indexToPosition(
-import { isVueDoc, isHtmlDoc, isSvelteDoc } from './html'
- styleBlocks[i].index + styleBlocks[i].groups.open.length
- ),
+import { findAll, indexToPosition } from './find'
end: indexToPosition(
text,
- styleBlocks[i].index +
+
import { isJsDoc } from './js'
-import { State } from './state'
- styleBlocks[i].groups.close.length
),
})
currentIndex = styleBlocks[i].index + styleBlocks[i][0].length
diff --git a/packages/tailwindcss-language-service/src/util/html.ts b/packages/tailwindcss-language-service/src/util/html.ts
index 02b9170e1865ce5ba49daf86bd00c8ff6497b555..af0ab8088139adbda5ef6d93f601d4c66a32f779 100644
--- a/packages/tailwindcss-language-service/src/util/html.ts
+++ b/packages/tailwindcss-language-service/src/util/html.ts
@@ -44,7 +44,7 @@ let open = 0
let close = 0
let match: RegExpExecArray
let tags = Array.isArray(tag) ? tag : [tag]
- let regex = new RegExp(`<(?<slash>/?)(?:${tags.join('|')})\\b`, 'ig')
+ let regex = new RegExp(`<(?<slash>/?)(?:${tags.join('|')})(?:\\s[^>]*[^\/]>|>|[^\/]>)`, 'ig')
while ((match = regex.exec(str)) !== null) {
if (match.groups.slash) {
close += 1