aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/parser/qqmljs.g
diff options
context:
space:
mode:
authorSemih Yavuz <semih.yavuz@qt.io>2024-03-20 19:48:24 +0100
committerSemih Yavuz <semih.yavuz@qt.io>2024-04-11 00:06:11 +0200
commita8cb8731c460845e95d4529de8abcfdc544c4a88 (patch)
treee7ab5b240cc2c61b62000b26866b602e6617dc4d /src/qml/parser/qqmljs.g
parent47e76e83baa2bec96a3a84e60ed621138915bc95 (diff)
Add file locations for Pragma keyword, id and the values
Add missing identifier token location in the grammar file. Implement the missing file location regions for Pragma dom element. Those regions are the way to get source location of the corresponding dom element in the Dom API. It is needed in semantic highlighting implementation. Adding new region breaks a few of the pragma completions tests since it changes the closest item found and this makes the assumption that colon region exist wrong . Fix it by passing the Pragma element instead of the subelements of it to insidePragmaCompletion function. This guarantees that we find the ColonTokenRegion in the current item. Task-number: QTBUG-123775 Task-number: QTBUG-120000 Change-Id: I2759412810ce125d6ee36bb0d70509a859667266 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Diffstat (limited to 'src/qml/parser/qqmljs.g')
-rw-r--r--src/qml/parser/qqmljs.g2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/qml/parser/qqmljs.g b/src/qml/parser/qqmljs.g
index 219f603e5f..57954d7d1a 100644
--- a/src/qml/parser/qqmljs.g
+++ b/src/qml/parser/qqmljs.g
@@ -778,6 +778,7 @@ UiPragma: T_PRAGMA PragmaId Semicolon;
case $rule_number: {
AST::UiPragma *pragma = new (pool) AST::UiPragma(stringRef(2));
pragma->pragmaToken = loc(1);
+ pragma->pragmaIdToken = loc(2);
pragma->semicolonToken = loc(3);
sym(1).Node = pragma;
} break;
@@ -789,6 +790,7 @@ UiPragma: T_PRAGMA PragmaId T_COLON UiPragmaValueList Semicolon;
AST::UiPragma *pragma = new (pool) AST::UiPragma(
stringRef(2), sym(4).UiPragmaValueList->finish());
pragma->pragmaToken = loc(1);
+ pragma->pragmaIdToken = loc(2);
pragma->colonToken = loc(3);
pragma->semicolonToken = loc(5);
sym(1).Node = pragma;