diff --git a/src/lsp/util/getLanguageBoundaries.ts b/src/lsp/util/getLanguageBoundaries.ts index c309aaeca3846b7f2f0fc98af7cf80a95e6cd817..dfef2300d3a9052cb3f60970538858b81d8af39b 100644 --- a/src/lsp/util/getLanguageBoundaries.ts +++ b/src/lsp/util/getLanguageBoundaries.ts @@ -16,25 +16,18 @@ ): LanguageBoundaries | null { if (isVueDoc(doc)) { let text = doc.getText() let blocks = findAll( + import { TextDocument, Range } from 'vscode-languageserver' - html: Range[] text ) 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( -import { isVueDoc, isHtmlDoc, isSvelteDoc } from './html' import { State } from './state' - ), } if (blocks[i].groups.type === 'style') { cssRanges.push(range) @@ -49,11 +44,8 @@ } if (isHtmlDoc(state, doc) || isJsDoc(state, doc) || isSvelteDoc(doc)) { let text = doc.getText() + import { findAll, indexToPosition } from './find' -import { isVueDoc, isHtmlDoc, isSvelteDoc } from './html' - /(?]*>|>)).*?(?<\/style>|$)/gis, - text - ) let htmlRanges: Range[] = [] let cssRanges: Range[] = [] let currentIndex = 0 @@ -64,17 +56,11 @@ start: indexToPosition(text, currentIndex), end: indexToPosition(text, styleBlocks[i].index), }) cssRanges.push({ - start: indexToPosition( -import { isVueDoc, isHtmlDoc, isSvelteDoc } from './html' import { isJsDoc } from './js' -import { TextDocument, Range } from 'vscode-languageserver' - ), end: indexToPosition( text, - styleBlocks[i].index + - styleBlocks[i][0].length - - styleBlocks[i].groups.close.length + styleBlocks[i].index + styleBlocks[i][0].length ), }) currentIndex = styleBlocks[i].index + styleBlocks[i][0].length