Unnamed repository; edit this file 'description' to name the repository.
feat(languages): update fga to latest (#15473)
Update tree-sitter-fga to latest and update highlight queries
accordingly.
| -rw-r--r-- | languages.toml | 4 | ||||
| -rw-r--r-- | runtime/queries/fga/highlights.scm | 133 | ||||
| -rw-r--r-- | runtime/queries/fga/indents.scm | 1 | ||||
| -rw-r--r-- | runtime/queries/fga/injections.scm | 2 | ||||
| -rw-r--r-- | runtime/queries/fga/locals.scm | 16 | ||||
| -rw-r--r-- | runtime/queries/fga/textobjects.scm | 6 |
6 files changed, 81 insertions, 81 deletions
diff --git a/languages.toml b/languages.toml index 05903c34..22c588de 100644 --- a/languages.toml +++ b/languages.toml @@ -4787,13 +4787,13 @@ source = { git = "https://github.com/uncenter/tree-sitter-tera", rev = "e8d679a2 name = "fga" scope = "source.fga" injection-regex = "fga" -file-types = ["fga"] +file-types = ["fga", { glob = "fga.mod" } ] comment-token = "#" indent = { tab-width = 2, unit = " " } [[grammar]] name = "fga" -source = { git = "https://github.com/matoous/tree-sitter-fga", rev = "5005e8dd976e1f67beb3d23204580eb6f8b4c965" } +source = { git = "https://github.com/matoous/tree-sitter-fga", rev = "ce72d1c484ba133a18e966d67be66bce85695451" } [[language]] name = "csv" diff --git a/runtime/queries/fga/highlights.scm b/runtime/queries/fga/highlights.scm index 402f6f4d..8fb2337e 100644 --- a/runtime/queries/fga/highlights.scm +++ b/runtime/queries/fga/highlights.scm @@ -1,97 +1,72 @@ -; Expressions +(condition_declaration + name: (identifier) @function) -(call_expression - function: (identifier) @function) +(condition_declaration + (param + name: (identifier) @variable.parameter)) -(call_expression - function: (selector_expression - field: (identifier) @function.method)) +(conditional + condition: (identifier) @function) +(type_declaration + name: (extended_identifier) @type) -; Type Definitions +(definition + relation: (extended_identifier) @variable) -(type_declaration (identifier) @type) +(indirect_relation + relation: (extended_identifier) @variable.other.member + tupleset: (extended_identifier) @variable) -(definition - relation: (identifier) @variable) +(relation_ref) @type +(all) @type +((simple_type_identifier) @type.builtin) -; Relation Definitions +((container_type_identifier) @type.builtin) -(relation_def (identifier) @variable.other.member) +(version) @constant.numeric +(int) @constant.numeric.integer +(uint) @constant.numeric.integer +(float) @constant.numeric.float -(direct_relationship (identifier) @type) -(direct_relationship (conditional (identifier) @function)) +(string) @string +(bytes) @string.special -(relation_ref - . (identifier) @type - (identifier) @variable.other.member) +(boolean) @constant.builtin.boolean +(null) @constant.builtin -(indirect_relation - . (identifier) @variable.other.member - (identifier) @variable) +(condition_body + (identifier) @variable) +(parenthesized_condition + (identifier) @variable) -; Condition Defintions +(bracket_condition + (identifier) @variable) -(condition_declaration - name: (identifier) @function) +(braced_condition + (identifier) @variable) -(condition_declaration (param (identifier) @variable.parameter)) - -(binary_expression (identifier) @variable) - -((type_identifier) @type.builtin - (#any-of? @type.builtin "string" "int" "map" "uint" "list" "timestamp" "bool" "duration" "double" "ipaddress")) - - -; Operators - -[ - "!=" - "%" - "&" - "&&" - "&^" - "*" - "+" - "-" - "/" - "<" - "<<" - "<=" - "==" - ">" - ">=" - ">>" - "^" - "|" - "||" -] @operator - -[ - "or" - "and" - "but not" - "from" - "with" -] @keyword.operator - -; Keywords - -[ - "model" - "schema" - "type" - "relations" - "define" -] @keyword - -[ - "condition" -] @keyword.function - -; Misc +(operator) @operator +(condition_operator) @operator + +(condition_body ["{" "}"] @punctuation.bracket) +(parenthesized_condition ["(" ")"] @punctuation.bracket) +(bracket_condition ["[" "]"] @punctuation.bracket) +(braced_condition ["{" "}"] @punctuation.bracket) + +(model) @keyword +(module "module" @keyword) +(schema "schema" @keyword) +(contents "contents" @keyword) +(relations "relations" @keyword) +(type_declaration "extend" @keyword) +(type_declaration "type" @keyword) +(definition "define" @keyword) + +(indirect_relation "from" @keyword.operator) +(conditional "with" @keyword.operator) +(condition_declaration "condition" @keyword.function) -(version) @constant.numeric (comment) @comment diff --git a/runtime/queries/fga/indents.scm b/runtime/queries/fga/indents.scm index a75c3761..2eb71d75 100644 --- a/runtime/queries/fga/indents.scm +++ b/runtime/queries/fga/indents.scm @@ -1,5 +1,6 @@ [ (source_file) + (contents) (type_declaration) (relations) (condition_declaration) diff --git a/runtime/queries/fga/injections.scm b/runtime/queries/fga/injections.scm new file mode 100644 index 00000000..2f0e58eb --- /dev/null +++ b/runtime/queries/fga/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/fga/locals.scm b/runtime/queries/fga/locals.scm new file mode 100644 index 00000000..3c64a5b9 --- /dev/null +++ b/runtime/queries/fga/locals.scm @@ -0,0 +1,16 @@ +(condition_declaration) @local.scope + +(param + name: (identifier) @local.definition.variable.parameter) + +(condition_body + (identifier) @local.reference) + +(parenthesized_condition + (identifier) @local.reference) + +(bracket_condition + (identifier) @local.reference) + +(braced_condition + (identifier) @local.reference) diff --git a/runtime/queries/fga/textobjects.scm b/runtime/queries/fga/textobjects.scm index eddaa614..457aaecf 100644 --- a/runtime/queries/fga/textobjects.scm +++ b/runtime/queries/fga/textobjects.scm @@ -1,6 +1,12 @@ +(type_declaration + (relations) @class.inside) @class.around + (condition_declaration body: (_) @function.inside) @function.around +(relations + (definition) @entry.inside) @entry.around + (param ((_) @parameter.inside . ","? @parameter.around) @parameter.around) |