use character-base ranges when looking for classes
parent
3d6e9b7e4d
commit
79a3f2b5a1
|
@ -306,7 +306,7 @@ function provideClassAttributeCompletions(
|
||||||
context?: CompletionContext
|
context?: CompletionContext
|
||||||
): CompletionList {
|
): CompletionList {
|
||||||
let str = document.getText({
|
let str = document.getText({
|
||||||
start: { line: Math.max(position.line - 10, 0), character: 0 },
|
start: document.positionAt(Math.max(0, document.offsetAt(position) - 500)),
|
||||||
end: position,
|
end: position,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -360,9 +360,10 @@ export async function findClassNameAtPosition(
|
||||||
position: Position
|
position: Position
|
||||||
): Promise<DocumentClassName> {
|
): Promise<DocumentClassName> {
|
||||||
let classNames = []
|
let classNames = []
|
||||||
const searchRange = {
|
const positionOffset = doc.offsetAt(position)
|
||||||
start: { line: Math.max(position.line - 10, 0), character: 0 },
|
const searchRange: Range = {
|
||||||
end: { line: position.line + 10, character: 0 },
|
start: doc.positionAt(Math.max(0, positionOffset - 500)),
|
||||||
|
end: doc.positionAt(positionOffset + 500),
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isCssContext(state, doc, position)) {
|
if (isCssContext(state, doc, position)) {
|
||||||
|
|
Loading…
Reference in New Issue