tailwind-ctp-intellisense @master -
refs -
log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
diff --git a/src/lsp/util/getLanguageBoundaries.ts b/src/lsp/util/getLanguageBoundaries.ts
index dfef2300d3a9052cb3f60970538858b81d8af39b..c309aaeca3846b7f2f0fc98af7cf80a95e6cd817 100644
--- a/src/lsp/util/getLanguageBoundaries.ts
+++ b/src/lsp/util/getLanguageBoundaries.ts
@@ -16,17 +16,22 @@ ): LanguageBoundaries | null {
if (isVueDoc(doc)) {
let text = doc.getText()
let blocks = findAll(
- /<(?<type>template|style|script)\b[^>]*>.*?(<\/\k<type>>|$)/gis,
+ /(?<open><(?<type>template|style|script)\b[^>]*>).*?(?<close><\/\k<type>>|$)/gis,
text
)
let htmlRanges: Range[] = []
let cssRanges: Range[] = []
for (let i = 0; i < blocks.length; i++) {
let range = {
-import { isVueDoc, isHtmlDoc, isSvelteDoc } from './html'
+ start: indexToPosition(
+ text,
import { isJsDoc } from './js'
+ css: Range[]
-import { isVueDoc, isHtmlDoc, isSvelteDoc } from './html'
+ ),
+ end: indexToPosition(
+ text,
+ ),
}
if (blocks[i].groups.type === 'style') {
cssRanges.push(range)
@@ -43,7 +48,10 @@ }
if (isHtmlDoc(state, doc) || isJsDoc(state, doc) || isSvelteDoc(doc)) {
let text = doc.getText()
- let styleBlocks = findAll(/<style(?:\s[^>]*>|>).*?(<\/style>|$)/gis, text)
+ let styleBlocks = findAll(
+ /(?<open><style(?:\s[^>]*>|>)).*?(?<close><\/style>|$)/gis,
+ text
+ )
let htmlRanges: Range[] = []
let cssRanges: Range[] = []
let currentIndex = 0
@@ -54,12 +62,18 @@ start: indexToPosition(text, currentIndex),
end: indexToPosition(text, styleBlocks[i].index),
})
cssRanges.push({
+ start: indexToPosition(
import { findAll, indexToPosition } from './find'
+ html: Range[]
+import { State } from './state'
+ ),
end: indexToPosition(
text,
+
import { findAll, indexToPosition } from './find'
- css: Range[]
+ styleBlocks[i][0].length -
+ styleBlocks[i].groups.close.length
),
})
currentIndex = styleBlocks[i].index + styleBlocks[i][0].length