diff --git a/package-lock.json b/package-lock.json index d9889a78..13d61a94 100644 --- a/package-lock.json +++ b/package-lock.json @@ -56,7 +56,7 @@ "tree-sitter-php": "0.20.0", "tree-sitter-python": "0.20.4", "tree-sitter-ruby": "0.19.0", - "tree-sitter-rust": "0.20.1", + "tree-sitter-rust": "0.20.4", "tree-sitter-typescript": "0.20.5" }, "peerDependencies": { @@ -7097,13 +7097,13 @@ } }, "node_modules/tree-sitter-rust": { - "version": "0.20.1", - "resolved": "https://registry.npmjs.org/tree-sitter-rust/-/tree-sitter-rust-0.20.1.tgz", - "integrity": "sha512-du8yLJBnjzjynQDPlt4IhbHgGHq2o/hdUGrHuedyAd5008i3ghB6trDB805B9qXNPFJGNy8gY0kxQPak2zOsFw==", + "version": "0.20.4", + "resolved": "https://registry.npmjs.org/tree-sitter-rust/-/tree-sitter-rust-0.20.4.tgz", + "integrity": "sha512-pgqPgw/vmx3LGjsfOXHJ+YrIx/Xg0NYVPbUWwlonoQMHD0Jxd1i/Fgq6N0ANOu9Wmb188MN9dVRLHPotF+IW5g==", "hasInstallScript": true, "optional": true, "dependencies": { - "nan": "^2.14.0" + "nan": "^2.17.0" } }, "node_modules/tree-sitter-typescript": { diff --git a/package.json b/package.json index a8909411..bc335e30 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "tree-sitter-php": "0.20.0", "tree-sitter-python": "0.20.4", "tree-sitter-ruby": "0.19.0", - "tree-sitter-rust": "0.20.1", + "tree-sitter-rust": "0.20.4", "tree-sitter-typescript": "0.20.5" }, "devDependencies": { diff --git a/src/language/rustLanguage.ts b/src/language/rustLanguage.ts index 5050fb15..194eadfb 100644 --- a/src/language/rustLanguage.ts +++ b/src/language/rustLanguage.ts @@ -27,67 +27,53 @@ export const rustLanguage: Language = { }, defineParameterTypeQueries: [ - ` -(attribute_item - (meta_item - (identifier) @meta-name - arguments: (meta_arguments - [ - ( - (meta_item - (identifier) @name-key - value: (string_literal) @name - ) - (meta_item - (identifier) @value-key - value: (string_literal) @expression - ) - ) - ( - (meta_item - (identifier) @value-key - value: (string_literal) @expression - ) - (meta_item - (identifier) @name-key - value: (string_literal) @name - ) + `(attribute_item + (attribute + (identifier) @meta-name + arguments: (token_tree + [ + ( + (identifier) @name-key + (string_literal) @name + (identifier) @value-key + (string_literal) @expression + ) + ( + (identifier) @value-key + (string_literal) @expression + (identifier) @name-key + (string_literal) @name + ) + ] ) - ] - ) - ) - (#eq? @meta-name "param") - (#eq? @name-key "name") - (#eq? @value-key "regex") -) @root -`, + ) + (#eq? @meta-name "param") + (#eq? @name-key "name") + (#eq? @value-key "regex") + ) @root + `, ], defineStepDefinitionQueries: [ - ` -(source_file (attribute_item - (meta_item - ( - (identifier) @meta-name - arguments: (meta_arguments - [ - (string_literal) @expression - (meta_item - value: (string_literal) @expression) - (meta_item - (identifier) - value: (string_literal) @expression) - (meta_item - value: (raw_string_literal) @expression) - ] + `(source_file + (attribute_item + (attribute + ( + (identifier) @meta-name + arguments: (token_tree + [ + (string_literal) @expression + (identifier) + (string_literal) @expression + (raw_string_literal) @expression + ] + ) + ) + ) + (#match? @meta-name "given|when|then") ) - ) - ) - (#match? @meta-name "given|when|then") -) -(function_item) ) @root -`, + (function_item) ) @root + `, ], - snippetParameters: { int: { type: 'i32', name: 'i' }, float: { type: 'f32', name: 'f' },