-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Description
Seems there is a bug here:
The call comes in from doHover(..) if its called on the 1st line - it comes in as line 0. So the for loop never triggers and an invariant error is thrown.
export function getRange(location: SourceLocation, queryText: string): IRange {
const parser = onlineParser();
const state = parser.startState();
const lines = queryText.split('\n');
invariant(
lines.length >= location.line,
'Query text must have more lines than where the error happened',
);
let stream = null;
for (let i = 0; i < location.line; i++) { // Likely should be <=
stream = new CharacterStream(lines[i]);
while (!stream.eol()) {
const style = parser.token(stream, state);
if (style === 'invalidchar') {
break;
}
}
}
invariant(stream, 'Expected Parser stream to be available.');