mirror of https://github.com/grafana/grafana.git
Update dependency @lezer/lr to v1.4.2 (#87522)
* Update dependency @lezer/lr to v1.4.2 * Fix: Update dependency @lezer/lr to v1.4.2 (#94818) * Update dependency @lezer/lr to v1.4.2 * Tempo: Update error detection shift in error lookup Since lezer 1.3.8 the position seems to be shifted + 1 * Add back looking for errors behind the cursor * Post-merge fixes --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Fix the resolvers for loki situation * grammar --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com> Co-authored-by: ismail simsek <ismailsimsek09@gmail.com>
This commit is contained in:
parent
f93fd77c9c
commit
8d3faabc90
|
|
@ -280,7 +280,7 @@
|
|||
"@leeoniya/ufuzzy": "1.0.14",
|
||||
"@lezer/common": "1.2.3",
|
||||
"@lezer/highlight": "1.2.1",
|
||||
"@lezer/lr": "1.3.3",
|
||||
"@lezer/lr": "1.4.2",
|
||||
"@locker/near-membrane-dom": "0.13.6",
|
||||
"@locker/near-membrane-shared": "0.13.6",
|
||||
"@locker/near-membrane-shared-dom": "0.13.6",
|
||||
|
|
|
|||
|
|
@ -367,6 +367,17 @@ describe('situation', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('identifies all labels from queries when cursor is at the beginning', () => {
|
||||
assertSituation('{^,two!="val2",three=~"val3",four!~"val4"}', {
|
||||
type: 'IN_LABEL_SELECTOR_NO_LABEL_NAME',
|
||||
otherLabels: [
|
||||
{ name: 'two', value: 'val2', op: '!=' },
|
||||
{ name: 'three', value: 'val3', op: '=~' },
|
||||
{ name: 'four', value: 'val4', op: '!~' },
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it('identifies all labels from queries when cursor is at end', () => {
|
||||
// Note the extra whitespace, if the cursor is after whitespace, the situation will fail to resolve
|
||||
assertSituation('{one="val1",two!="val2",three=~"val3",four!~"val4",^}', {
|
||||
|
|
|
|||
|
|
@ -185,7 +185,13 @@ const ERROR_NODE_ID = 0;
|
|||
|
||||
const RESOLVERS: Resolver[] = [
|
||||
{
|
||||
paths: [[Selector], [Selector, Matchers], [Matchers], [ERROR_NODE_ID, Matchers, Selector]],
|
||||
paths: [
|
||||
[Selector],
|
||||
[Selector, Matchers],
|
||||
[Matchers],
|
||||
[ERROR_NODE_ID, Matchers],
|
||||
[ERROR_NODE_ID, Matchers, Selector],
|
||||
],
|
||||
fun: resolveSelector,
|
||||
},
|
||||
{
|
||||
|
|
@ -624,13 +630,7 @@ function resolveSelector(node: SyntaxNode, text: string, pos: number): Situation
|
|||
}
|
||||
}
|
||||
|
||||
const selectorNode =
|
||||
node.type.id === ERROR_NODE_ID
|
||||
? walk(node, [
|
||||
['parent', Matchers],
|
||||
['parent', Selector],
|
||||
])
|
||||
: node;
|
||||
const selectorNode = node.type.id === ERROR_NODE_ID ? walk(node, [['parent', Matchers]]) : node;
|
||||
if (!selectorNode) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
"@grafana/schema": "workspace:*",
|
||||
"@grafana/ui": "workspace:*",
|
||||
"@lezer/common": "1.2.3",
|
||||
"@lezer/lr": "1.3.3",
|
||||
"@lezer/lr": "1.4.2",
|
||||
"@opentelemetry/api": "1.9.0",
|
||||
"@opentelemetry/exporter-collector": "0.25.0",
|
||||
"@opentelemetry/semantic-conventions": "1.27.0",
|
||||
|
|
|
|||
|
|
@ -169,6 +169,10 @@ export function getSituation(text: string, offset: number): Situation | null {
|
|||
// Try again with the previous character.
|
||||
errorNode = getErrorNode(tree, shiftedOffset - 1);
|
||||
}
|
||||
if (!errorNode) {
|
||||
// Try again with the next character
|
||||
errorNode = getErrorNode(tree, shiftedOffset + 1);
|
||||
}
|
||||
|
||||
const cur = errorNode != null ? errorNode.cursor() : tree.cursorAt(shiftedOffset);
|
||||
|
||||
|
|
|
|||
13
yarn.lock
13
yarn.lock
|
|
@ -3403,7 +3403,7 @@ __metadata:
|
|||
"@grafana/schema": "workspace:*"
|
||||
"@grafana/ui": "workspace:*"
|
||||
"@lezer/common": "npm:1.2.3"
|
||||
"@lezer/lr": "npm:1.3.3"
|
||||
"@lezer/lr": "npm:1.4.2"
|
||||
"@opentelemetry/api": "npm:1.9.0"
|
||||
"@opentelemetry/exporter-collector": "npm:0.25.0"
|
||||
"@opentelemetry/semantic-conventions": "npm:1.27.0"
|
||||
|
|
@ -4983,15 +4983,6 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@lezer/lr@npm:1.3.3":
|
||||
version: 1.3.3
|
||||
resolution: "@lezer/lr@npm:1.3.3"
|
||||
dependencies:
|
||||
"@lezer/common": "npm:^1.0.0"
|
||||
checksum: 10/7e61dc2554b85560ef1af6d3a6112c711d20d54e0c3184657099be8dc40d2747d28d5d332cc1b0d75064846d51fbff0bed162550a332aeccdfa36836b5541cfd
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@lezer/lr@npm:1.4.2":
|
||||
version: 1.4.2
|
||||
resolution: "@lezer/lr@npm:1.4.2"
|
||||
|
|
@ -18720,7 +18711,7 @@ __metadata:
|
|||
"@leeoniya/ufuzzy": "npm:1.0.14"
|
||||
"@lezer/common": "npm:1.2.3"
|
||||
"@lezer/highlight": "npm:1.2.1"
|
||||
"@lezer/lr": "npm:1.3.3"
|
||||
"@lezer/lr": "npm:1.4.2"
|
||||
"@locker/near-membrane-dom": "npm:0.13.6"
|
||||
"@locker/near-membrane-shared": "npm:0.13.6"
|
||||
"@locker/near-membrane-shared-dom": "npm:0.13.6"
|
||||
|
|
|
|||
Loading…
Reference in New Issue