Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Use injection to re-parse rust macro calls and defs as rust
Browse files Browse the repository at this point in the history
  • Loading branch information
maxbrunsfeld committed Jun 17, 2019
1 parent 6708932 commit 8988f87
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
Expand Up @@ -2,6 +2,7 @@ name: 'Rust'
scopeName: 'source.rust'
type: 'tree-sitter'
parser: 'tree-sitter-rust'
injectionRegex: 'rust'

fileTypes: [
'rs'
Expand Down
9 changes: 9 additions & 0 deletions packages/language-rust-bundled/lib/main.js
@@ -0,0 +1,9 @@
exports.activate = function() {
for (const nodeType of ['macro_invocation', 'macro_rule']) {
atom.grammars.addInjectionPoint('source.rust', {
type: nodeType,
language() { return 'rust'; },
content(node) { return node.lastChild; },
});
}
};
1 change: 1 addition & 0 deletions packages/language-rust-bundled/package.json
Expand Up @@ -7,6 +7,7 @@
"grammar",
"rust"
],
"main": "lib/main.js",
"repository": "https://github.com/atom/atom",
"license": "MIT",
"dependencies": {
Expand Down

0 comments on commit 8988f87

Please sign in to comment.