@codingame/monaco-vscode-rust-default-extension 1.85.2 → 1.85.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -3,8 +3,10 @@ import { registerExtension } from 'vscode/extensions';
3
3
  var manifest = {name:"rust",displayName:"%displayName%",description:"%description%",version:"1.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammar.mjs"},contributes:{languages:[{id:"rust",extensions:[".rs"],aliases:["Rust","rust"],configuration:"./language-configuration.json"}],grammars:[{language:"rust",path:"./syntaxes/rust.tmLanguage.json",scopeName:"source.rust"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"},main:undefined};
4
4
 
5
5
  const { registerFileUrl, whenReady } = registerExtension(manifest);
6
- registerFileUrl('./syntaxes/rust.tmLanguage.json', new URL('./rust.tmLanguage.json', import.meta.url).toString(), 'application/json');
7
- registerFileUrl('./language-configuration.json', new URL('./language-configuration.json', import.meta.url).toString(), 'application/json');
8
- registerFileUrl('package.nls.json', new URL('./package.nls.json', import.meta.url).toString(), 'application/json');
6
+ registerFileUrl('language-configuration.json', new URL('./resources/language-configuration.json', import.meta.url).toString(), 'application/json');
7
+ registerFileUrl('package.json', new URL('./resources/package.json', import.meta.url).toString(), 'application/json');
8
+ registerFileUrl('package.nls.json', new URL('./resources/package.nls.json', import.meta.url).toString(), 'application/json');
9
+ registerFileUrl('build/update-grammar.mjs', new URL('./resources/update-grammar.mjs', import.meta.url).toString(), 'application/javascript');
10
+ registerFileUrl('syntaxes/rust.tmLanguage.json', new URL('./resources/rust.tmLanguage.json', import.meta.url).toString(), 'application/json');
9
11
 
10
12
  export { whenReady };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-rust-default-extension",
3
- "version": "1.85.2",
3
+ "version": "1.85.3",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -18,6 +18,6 @@
18
18
  "module": "index.js",
19
19
  "types": "index.d.ts",
20
20
  "dependencies": {
21
- "vscode": "npm:@codingame/monaco-vscode-api@1.85.2"
21
+ "vscode": "npm:@codingame/monaco-vscode-api@1.85.3"
22
22
  }
23
23
  }
@@ -0,0 +1 @@
1
+ {"comments":{"lineComment":"//","blockComment":["/*","*/"]},"brackets":[["{","}"],["[","]"],["(",")"]],"autoClosingPairs":[["{","}"],["[","]"],["(",")"],{"open":"\"","close":"\"","notIn":["string"]}],"surroundingPairs":[["{","}"],["[","]"],["(",")"],["\"","\""],["<",">"]],"indentationRules":{"increaseIndentPattern":"^.*\\{[^}\"']*$|^.*\\([^\\)\"']*$","decreaseIndentPattern":"^\\s*(\\s*\\/[*].*[*]\\/\\s*)*[})]"},"folding":{"markers":{"start":"^\\s*//\\s*#?region\\b","end":"^\\s*//\\s*#?endregion\\b"}}}
@@ -0,0 +1 @@
1
+ {"name":"rust","displayName":"%displayName%","description":"%description%","version":"1.0.0","publisher":"vscode","license":"MIT","engines":{"vscode":"*"},"scripts":{"update-grammar":"node ./build/update-grammar.mjs"},"contributes":{"languages":[{"id":"rust","extensions":[".rs"],"aliases":["Rust","rust"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"rust","path":"./syntaxes/rust.tmLanguage.json","scopeName":"source.rust"}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}}
@@ -0,0 +1 @@
1
+ {"displayName":"Rust Language Basics","description":"Provides syntax highlighting and bracket matching in Rust files."}
@@ -0,0 +1 @@
1
+ {"information_for_contributors":["This file has been converted from https://github.com/dustypomerleau/rust-syntax/blob/master/syntaxes/rust.tmLanguage.json","If you want to provide a fix or improvement, please create a pull request against the original repository.","Once accepted there, we are happy to receive an update request."],"version":"https://github.com/dustypomerleau/rust-syntax/commit/20730dff3c367cb40a7edd278fdaf0239ea50833","name":"Rust","scopeName":"source.rust","patterns":[{"comment":"boxed slice literal","begin":"(<)(\\[)","beginCaptures":{"1":{"name":"punctuation.brackets.angle.rust"},"2":{"name":"punctuation.brackets.square.rust"}},"end":">","endCaptures":{"0":{"name":"punctuation.brackets.angle.rust"}},"patterns":[{"include":"#block-comments"},{"include":"#comments"},{"include":"#gtypes"},{"include":"#lvariables"},{"include":"#lifetimes"},{"include":"#punctuation"},{"include":"#types"}]},{"comment":"macro type metavariables","name":"meta.macro.metavariable.type.rust","match":"(\\$)((crate)|([A-Z][A-Za-z0-9_]*))((:)(block|expr|ident|item|lifetime|literal|meta|path?|stmt|tt|ty|vis))?","captures":{"1":{"name":"keyword.operator.macro.dollar.rust"},"3":{"name":"keyword.other.crate.rust"},"4":{"name":"entity.name.type.metavariable.rust"},"6":{"name":"keyword.operator.key-value.rust"},"7":{"name":"variable.other.metavariable.specifier.rust"}},"patterns":[{"include":"#keywords"}]},{"comment":"macro metavariables","name":"meta.macro.metavariable.rust","match":"(\\$)([a-z][A-Za-z0-9_]*)((:)(block|expr|ident|item|lifetime|literal|meta|path?|stmt|tt|ty|vis))?","captures":{"1":{"name":"keyword.operator.macro.dollar.rust"},"2":{"name":"variable.other.metavariable.name.rust"},"4":{"name":"keyword.operator.key-value.rust"},"5":{"name":"variable.other.metavariable.specifier.rust"}},"patterns":[{"include":"#keywords"}]},{"comment":"macro rules","name":"meta.macro.rules.rust","match":"\\b(macro_rules!)\\s+(([a-z0-9_]+)|([A-Z][a-z0-9_]*))\\s+(\\{)","captures":{"1":{"name":"entity.name.function.macro.rules.rust"},"3":{"name":"entity.name.function.macro.rust"},"4":{"name":"entity.name.type.macro.rust"},"5":{"name":"punctuation.brackets.curly.rust"}}},{"comment":"modules","match":"(mod)\\s+((?:r#(?!crate|[Ss]elf|super))?[a-z][A-Za-z0-9_]*)","captures":{"1":{"name":"storage.type.rust"},"2":{"name":"entity.name.module.rust"}}},{"comment":"external crate imports","name":"meta.import.rust","begin":"\\b(extern)\\s+(crate)","beginCaptures":{"1":{"name":"storage.type.rust"},"2":{"name":"keyword.other.crate.rust"}},"end":";","endCaptures":{"0":{"name":"punctuation.semi.rust"}},"patterns":[{"include":"#block-comments"},{"include":"#comments"},{"include":"#keywords"},{"include":"#punctuation"}]},{"comment":"use statements","name":"meta.use.rust","begin":"\\b(use)\\s","beginCaptures":{"1":{"name":"keyword.other.rust"}},"end":";","endCaptures":{"0":{"name":"punctuation.semi.rust"}},"patterns":[{"include":"#block-comments"},{"include":"#comments"},{"include":"#keywords"},{"include":"#namespaces"},{"include":"#punctuation"},{"include":"#types"},{"include":"#lvariables"}]},{"include":"#block-comments"},{"include":"#comments"},{"include":"#attributes"},{"include":"#lvariables"},{"include":"#constants"},{"include":"#gtypes"},{"include":"#functions"},{"include":"#types"},{"include":"#keywords"},{"include":"#lifetimes"},{"include":"#macros"},{"include":"#namespaces"},{"include":"#punctuation"},{"include":"#strings"},{"include":"#variables"}],"repository":{"comments":{"patterns":[{"comment":"documentation comments","name":"comment.line.documentation.rust","match":"^\\s*///.*"},{"comment":"line comments","name":"comment.line.double-slash.rust","match":"\\s*//.*"}]},"block-comments":{"patterns":[{"comment":"empty block comments","name":"comment.block.rust","match":"/\\*\\*/"},{"comment":"block documentation comments","name":"comment.block.documentation.rust","begin":"/\\*\\*","end":"\\*/","patterns":[{"include":"#block-comments"}]},{"comment":"block comments","name":"comment.block.rust","begin":"/\\*(?!\\*)","end":"\\*/","patterns":[{"include":"#block-comments"}]}]},"constants":{"patterns":[{"comment":"ALL CAPS constants","name":"constant.other.caps.rust","match":"\\b[A-Z]{2}[A-Z0-9_]*\\b"},{"comment":"constant declarations","match":"\\b(const)\\s+([A-Z][A-Za-z0-9_]*)\\b","captures":{"1":{"name":"storage.type.rust"},"2":{"name":"constant.other.caps.rust"}}},{"comment":"decimal integers and floats","name":"constant.numeric.decimal.rust","match":"\\b\\d[\\d_]*(\\.?)[\\d_]*(?:(E|e)([+-]?)([\\d_]+))?(f32|f64|i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize)?\\b","captures":{"1":{"name":"punctuation.separator.dot.decimal.rust"},"2":{"name":"keyword.operator.exponent.rust"},"3":{"name":"keyword.operator.exponent.sign.rust"},"4":{"name":"constant.numeric.decimal.exponent.mantissa.rust"},"5":{"name":"entity.name.type.numeric.rust"}}},{"comment":"hexadecimal integers","name":"constant.numeric.hex.rust","match":"\\b0x[\\da-fA-F_]+(i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize)?\\b","captures":{"1":{"name":"entity.name.type.numeric.rust"}}},{"comment":"octal integers","name":"constant.numeric.oct.rust","match":"\\b0o[0-7_]+(i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize)?\\b","captures":{"1":{"name":"entity.name.type.numeric.rust"}}},{"comment":"binary integers","name":"constant.numeric.bin.rust","match":"\\b0b[01_]+(i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize)?\\b","captures":{"1":{"name":"entity.name.type.numeric.rust"}}},{"comment":"booleans","name":"constant.language.bool.rust","match":"\\b(true|false)\\b"}]},"escapes":{"comment":"escapes: ASCII, byte, Unicode, quote, regex","name":"constant.character.escape.rust","match":"(\\\\)(?:(?:(x[0-7][\\da-fA-F])|(u(\\{)[\\da-fA-F]{4,6}(\\}))|.))","captures":{"1":{"name":"constant.character.escape.backslash.rust"},"2":{"name":"constant.character.escape.bit.rust"},"3":{"name":"constant.character.escape.unicode.rust"},"4":{"name":"constant.character.escape.unicode.punctuation.rust"},"5":{"name":"constant.character.escape.unicode.punctuation.rust"}}},"attributes":{"comment":"attributes","name":"meta.attribute.rust","begin":"(#)(\\!?)(\\[)","beginCaptures":{"1":{"name":"punctuation.definition.attribute.rust"},"3":{"name":"punctuation.brackets.attribute.rust"}},"end":"\\]","endCaptures":{"0":{"name":"punctuation.brackets.attribute.rust"}},"patterns":[{"include":"#block-comments"},{"include":"#comments"},{"include":"#keywords"},{"include":"#lifetimes"},{"include":"#punctuation"},{"include":"#strings"},{"include":"#gtypes"},{"include":"#types"}]},"functions":{"patterns":[{"comment":"pub as a function","match":"\\b(pub)(\\()","captures":{"1":{"name":"keyword.other.rust"},"2":{"name":"punctuation.brackets.round.rust"}}},{"comment":"function definition","name":"meta.function.definition.rust","begin":"\\b(fn)\\s+((?:r#(?!crate|[Ss]elf|super))?[A-Za-z0-9_]+)((\\()|(<))","beginCaptures":{"1":{"name":"keyword.other.fn.rust"},"2":{"name":"entity.name.function.rust"},"4":{"name":"punctuation.brackets.round.rust"},"5":{"name":"punctuation.brackets.angle.rust"}},"end":"\\{|;","endCaptures":{"0":{"name":"punctuation.brackets.curly.rust"}},"patterns":[{"include":"#block-comments"},{"include":"#comments"},{"include":"#keywords"},{"include":"#lvariables"},{"include":"#constants"},{"include":"#gtypes"},{"include":"#functions"},{"include":"#lifetimes"},{"include":"#macros"},{"include":"#namespaces"},{"include":"#punctuation"},{"include":"#strings"},{"include":"#types"},{"include":"#variables"}]},{"comment":"function/method calls, chaining","name":"meta.function.call.rust","begin":"((?:r#(?!crate|[Ss]elf|super))?[A-Za-z0-9_]+)(\\()","beginCaptures":{"1":{"name":"entity.name.function.rust"},"2":{"name":"punctuation.brackets.round.rust"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.brackets.round.rust"}},"patterns":[{"include":"#block-comments"},{"include":"#comments"},{"include":"#attributes"},{"include":"#keywords"},{"include":"#lvariables"},{"include":"#constants"},{"include":"#gtypes"},{"include":"#functions"},{"include":"#lifetimes"},{"include":"#macros"},{"include":"#namespaces"},{"include":"#punctuation"},{"include":"#strings"},{"include":"#types"},{"include":"#variables"}]},{"comment":"function/method calls with turbofish","name":"meta.function.call.rust","begin":"((?:r#(?!crate|[Ss]elf|super))?[A-Za-z0-9_]+)(?=::<.*>\\()","beginCaptures":{"1":{"name":"entity.name.function.rust"}},"end":"\\)","endCaptures":{"0":{"name":"punctuation.brackets.round.rust"}},"patterns":[{"include":"#block-comments"},{"include":"#comments"},{"include":"#attributes"},{"include":"#keywords"},{"include":"#lvariables"},{"include":"#constants"},{"include":"#gtypes"},{"include":"#functions"},{"include":"#lifetimes"},{"include":"#macros"},{"include":"#namespaces"},{"include":"#punctuation"},{"include":"#strings"},{"include":"#types"},{"include":"#variables"}]}]},"keywords":{"patterns":[{"comment":"control flow keywords","name":"keyword.control.rust","match":"\\b(await|break|continue|do|else|for|if|loop|match|return|try|while|yield)\\b"},{"comment":"storage keywords","name":"keyword.other.rust storage.type.rust","match":"\\b(extern|let|macro|mod)\\b"},{"comment":"const keyword","name":"storage.modifier.rust","match":"\\b(const)\\b"},{"comment":"type keyword","name":"keyword.declaration.type.rust storage.type.rust","match":"\\b(type)\\b"},{"comment":"enum keyword","name":"keyword.declaration.enum.rust storage.type.rust","match":"\\b(enum)\\b"},{"comment":"trait keyword","name":"keyword.declaration.trait.rust storage.type.rust","match":"\\b(trait)\\b"},{"comment":"struct keyword","name":"keyword.declaration.struct.rust storage.type.rust","match":"\\b(struct)\\b"},{"comment":"storage modifiers","name":"storage.modifier.rust","match":"\\b(abstract|static)\\b"},{"comment":"other keywords","name":"keyword.other.rust","match":"\\b(as|async|become|box|dyn|move|final|impl|in|override|priv|pub|ref|typeof|union|unsafe|unsized|use|virtual|where)\\b"},{"comment":"fn","name":"keyword.other.fn.rust","match":"\\bfn\\b"},{"comment":"crate","name":"keyword.other.crate.rust","match":"\\bcrate\\b"},{"comment":"mut","name":"storage.modifier.mut.rust","match":"\\bmut\\b"},{"comment":"logical operators","name":"keyword.operator.logical.rust","match":"(\\^|\\||\\|\\||&&|<<|>>|!)(?!=)"},{"comment":"logical AND, borrow references","name":"keyword.operator.borrow.and.rust","match":"&(?![&=])"},{"comment":"assignment operators","name":"keyword.operator.assignment.rust","match":"(\\+=|-=|\\*=|/=|%=|\\^=|&=|\\|=|<<=|>>=)"},{"comment":"single equal","name":"keyword.operator.assignment.equal.rust","match":"(?<![<>])=(?!=|>)"},{"comment":"comparison operators","name":"keyword.operator.comparison.rust","match":"(=(=)?(?!>)|!=|<=|(?<!=)>=)"},{"comment":"math operators","name":"keyword.operator.math.rust","match":"(([+%]|(\\*(?!\\w)))(?!=))|(-(?!>))|(/(?!/))"},{"comment":"less than, greater than (special case)","match":"(?:\\b|(?:(\\))|(\\])|(\\})))[ \\t]+([<>])[ \\t]+(?:\\b|(?:(\\()|(\\[)|(\\{)))","captures":{"1":{"name":"punctuation.brackets.round.rust"},"2":{"name":"punctuation.brackets.square.rust"},"3":{"name":"punctuation.brackets.curly.rust"},"4":{"name":"keyword.operator.comparison.rust"},"5":{"name":"punctuation.brackets.round.rust"},"6":{"name":"punctuation.brackets.square.rust"},"7":{"name":"punctuation.brackets.curly.rust"}}},{"comment":"namespace operator","name":"keyword.operator.namespace.rust","match":"::"},{"comment":"dereference asterisk","match":"(\\*)(?=\\w+)","captures":{"1":{"name":"keyword.operator.dereference.rust"}}},{"comment":"subpattern binding","name":"keyword.operator.subpattern.rust","match":"@"},{"comment":"dot access","name":"keyword.operator.access.dot.rust","match":"\\.(?!\\.)"},{"comment":"ranges, range patterns","name":"keyword.operator.range.rust","match":"\\.{2}(=|\\.)?"},{"comment":"colon","name":"keyword.operator.key-value.rust","match":":(?!:)"},{"comment":"dashrocket, skinny arrow","name":"keyword.operator.arrow.skinny.rust","match":"->"},{"comment":"hashrocket, fat arrow","name":"keyword.operator.arrow.fat.rust","match":"=>"},{"comment":"dollar macros","name":"keyword.operator.macro.dollar.rust","match":"\\$"},{"comment":"question mark operator, questionably sized, macro kleene matcher","name":"keyword.operator.question.rust","match":"\\?"}]},"interpolations":{"comment":"curly brace interpolations","name":"meta.interpolation.rust","match":"({)[^\"{}]*(})","captures":{"1":{"name":"punctuation.definition.interpolation.rust"},"2":{"name":"punctuation.definition.interpolation.rust"}}},"lifetimes":{"patterns":[{"comment":"named lifetime parameters","match":"(['])([a-zA-Z_][0-9a-zA-Z_]*)(?!['])\\b","captures":{"1":{"name":"punctuation.definition.lifetime.rust"},"2":{"name":"entity.name.type.lifetime.rust"}}},{"comment":"borrowing references to named lifetimes","match":"(\\&)(['])([a-zA-Z_][0-9a-zA-Z_]*)(?!['])\\b","captures":{"1":{"name":"keyword.operator.borrow.rust"},"2":{"name":"punctuation.definition.lifetime.rust"},"3":{"name":"entity.name.type.lifetime.rust"}}}]},"macros":{"patterns":[{"comment":"macros","name":"meta.macro.rust","match":"(([a-z_][A-Za-z0-9_]*!)|([A-Z_][A-Za-z0-9_]*!))","captures":{"2":{"name":"entity.name.function.macro.rust"},"3":{"name":"entity.name.type.macro.rust"}}}]},"namespaces":{"patterns":[{"comment":"namespace (non-type, non-function path segment)","match":"(?<![A-Za-z0-9_])([A-Za-z0-9_]+)((?<!super|self)::)","captures":{"1":{"name":"entity.name.namespace.rust"},"2":{"name":"keyword.operator.namespace.rust"}}}]},"types":{"patterns":[{"comment":"numeric types","match":"(?<![A-Za-z])(f32|f64|i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize)\\b","captures":{"1":{"name":"entity.name.type.numeric.rust"}}},{"comment":"parameterized types","begin":"\\b(_?[A-Z][A-Za-z0-9_]*)(<)","beginCaptures":{"1":{"name":"entity.name.type.rust"},"2":{"name":"punctuation.brackets.angle.rust"}},"end":">","endCaptures":{"0":{"name":"punctuation.brackets.angle.rust"}},"patterns":[{"include":"#block-comments"},{"include":"#comments"},{"include":"#keywords"},{"include":"#lvariables"},{"include":"#lifetimes"},{"include":"#punctuation"},{"include":"#types"},{"include":"#variables"}]},{"comment":"primitive types","name":"entity.name.type.primitive.rust","match":"\\b(bool|char|str)\\b"},{"comment":"trait declarations","match":"\\b(trait)\\s+(_?[A-Z][A-Za-z0-9_]*)\\b","captures":{"1":{"name":"keyword.declaration.trait.rust storage.type.rust"},"2":{"name":"entity.name.type.trait.rust"}}},{"comment":"struct declarations","match":"\\b(struct)\\s+(_?[A-Z][A-Za-z0-9_]*)\\b","captures":{"1":{"name":"keyword.declaration.struct.rust storage.type.rust"},"2":{"name":"entity.name.type.struct.rust"}}},{"comment":"enum declarations","match":"\\b(enum)\\s+(_?[A-Z][A-Za-z0-9_]*)\\b","captures":{"1":{"name":"keyword.declaration.enum.rust storage.type.rust"},"2":{"name":"entity.name.type.enum.rust"}}},{"comment":"type declarations","match":"\\b(type)\\s+(_?[A-Z][A-Za-z0-9_]*)\\b","captures":{"1":{"name":"keyword.declaration.type.rust storage.type.rust"},"2":{"name":"entity.name.type.declaration.rust"}}},{"comment":"types","name":"entity.name.type.rust","match":"\\b_?[A-Z][A-Za-z0-9_]*\\b(?!!)"}]},"gtypes":{"patterns":[{"comment":"option types","name":"entity.name.type.option.rust","match":"\\b(Some|None)\\b"},{"comment":"result types","name":"entity.name.type.result.rust","match":"\\b(Ok|Err)\\b"}]},"punctuation":{"patterns":[{"comment":"comma","name":"punctuation.comma.rust","match":","},{"comment":"curly braces","name":"punctuation.brackets.curly.rust","match":"[{}]"},{"comment":"parentheses, round brackets","name":"punctuation.brackets.round.rust","match":"[()]"},{"comment":"semicolon","name":"punctuation.semi.rust","match":";"},{"comment":"square brackets","name":"punctuation.brackets.square.rust","match":"[\\[\\]]"},{"comment":"angle brackets","name":"punctuation.brackets.angle.rust","match":"(?<!=)[<>]"}]},"strings":{"patterns":[{"comment":"double-quoted strings and byte strings","name":"string.quoted.double.rust","begin":"(b?)(\")","beginCaptures":{"1":{"name":"string.quoted.byte.raw.rust"},"2":{"name":"punctuation.definition.string.rust"}},"end":"\"","endCaptures":{"0":{"name":"punctuation.definition.string.rust"}},"patterns":[{"include":"#escapes"},{"include":"#interpolations"}]},{"comment":"double-quoted raw strings and raw byte strings","name":"string.quoted.double.rust","begin":"(b?r)(#*)(\")","beginCaptures":{"1":{"name":"string.quoted.byte.raw.rust"},"2":{"name":"punctuation.definition.string.raw.rust"},"3":{"name":"punctuation.definition.string.rust"}},"end":"(\")(\\2)","endCaptures":{"1":{"name":"punctuation.definition.string.rust"},"2":{"name":"punctuation.definition.string.raw.rust"}}},{"comment":"characters and bytes","name":"string.quoted.single.char.rust","begin":"(b)?(')","beginCaptures":{"1":{"name":"string.quoted.byte.raw.rust"},"2":{"name":"punctuation.definition.char.rust"}},"end":"'","endCaptures":{"0":{"name":"punctuation.definition.char.rust"}},"patterns":[{"include":"#escapes"}]}]},"lvariables":{"patterns":[{"comment":"self","name":"variable.language.self.rust","match":"\\b[Ss]elf\\b"},{"comment":"super","name":"variable.language.super.rust","match":"\\bsuper\\b"}]},"variables":{"patterns":[{"comment":"variables","name":"variable.other.rust","match":"\\b(?<!(?<!\\.)\\.)(?:r#(?!(crate|[Ss]elf|super)))?[a-z0-9_]+\\b"}]}}}
@@ -0,0 +1,9 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ //@ts-check
6
+
7
+ import * as vscodeGrammarUpdater from 'vscode-grammar-updater';
8
+
9
+ vscodeGrammarUpdater.update('dustypomerleau/rust-syntax', 'syntaxes/rust.tmLanguage.json', './syntaxes/rust.tmLanguage.json', undefined, 'main');
@@ -1,34 +0,0 @@
1
- {
2
- "comments": {
3
- "lineComment": "//",
4
- "blockComment": [ "/*", "*/" ]
5
- },
6
- "brackets": [
7
- ["{", "}"],
8
- ["[", "]"],
9
- ["(", ")"]
10
- ],
11
- "autoClosingPairs": [
12
- ["{", "}"],
13
- ["[", "]"],
14
- ["(", ")"],
15
- { "open": "\"", "close": "\"", "notIn": ["string"] }
16
- ],
17
- "surroundingPairs": [
18
- ["{", "}"],
19
- ["[", "]"],
20
- ["(", ")"],
21
- ["\"", "\""],
22
- ["<", ">"]
23
- ],
24
- "indentationRules": {
25
- "increaseIndentPattern": "^.*\\{[^}\"']*$|^.*\\([^\\)\"']*$",
26
- "decreaseIndentPattern": "^\\s*(\\s*\\/[*].*[*]\\/\\s*)*[})]"
27
- },
28
- "folding": {
29
- "markers": {
30
- "start": "^\\s*//\\s*#?region\\b",
31
- "end": "^\\s*//\\s*#?endregion\\b"
32
- }
33
- }
34
- }
package/package.nls.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "displayName": "Rust Language Basics",
3
- "description": "Provides syntax highlighting and bracket matching in Rust files."
4
- }
@@ -1,1176 +0,0 @@
1
- {
2
- "information_for_contributors": [
3
- "This file has been converted from https://github.com/dustypomerleau/rust-syntax/blob/master/syntaxes/rust.tmLanguage.json",
4
- "If you want to provide a fix or improvement, please create a pull request against the original repository.",
5
- "Once accepted there, we are happy to receive an update request."
6
- ],
7
- "version": "https://github.com/dustypomerleau/rust-syntax/commit/20730dff3c367cb40a7edd278fdaf0239ea50833",
8
- "name": "Rust",
9
- "scopeName": "source.rust",
10
- "patterns": [
11
- {
12
- "comment": "boxed slice literal",
13
- "begin": "(<)(\\[)",
14
- "beginCaptures": {
15
- "1": {
16
- "name": "punctuation.brackets.angle.rust"
17
- },
18
- "2": {
19
- "name": "punctuation.brackets.square.rust"
20
- }
21
- },
22
- "end": ">",
23
- "endCaptures": {
24
- "0": {
25
- "name": "punctuation.brackets.angle.rust"
26
- }
27
- },
28
- "patterns": [
29
- {
30
- "include": "#block-comments"
31
- },
32
- {
33
- "include": "#comments"
34
- },
35
- {
36
- "include": "#gtypes"
37
- },
38
- {
39
- "include": "#lvariables"
40
- },
41
- {
42
- "include": "#lifetimes"
43
- },
44
- {
45
- "include": "#punctuation"
46
- },
47
- {
48
- "include": "#types"
49
- }
50
- ]
51
- },
52
- {
53
- "comment": "macro type metavariables",
54
- "name": "meta.macro.metavariable.type.rust",
55
- "match": "(\\$)((crate)|([A-Z][A-Za-z0-9_]*))((:)(block|expr|ident|item|lifetime|literal|meta|path?|stmt|tt|ty|vis))?",
56
- "captures": {
57
- "1": {
58
- "name": "keyword.operator.macro.dollar.rust"
59
- },
60
- "3": {
61
- "name": "keyword.other.crate.rust"
62
- },
63
- "4": {
64
- "name": "entity.name.type.metavariable.rust"
65
- },
66
- "6": {
67
- "name": "keyword.operator.key-value.rust"
68
- },
69
- "7": {
70
- "name": "variable.other.metavariable.specifier.rust"
71
- }
72
- },
73
- "patterns": [
74
- {
75
- "include": "#keywords"
76
- }
77
- ]
78
- },
79
- {
80
- "comment": "macro metavariables",
81
- "name": "meta.macro.metavariable.rust",
82
- "match": "(\\$)([a-z][A-Za-z0-9_]*)((:)(block|expr|ident|item|lifetime|literal|meta|path?|stmt|tt|ty|vis))?",
83
- "captures": {
84
- "1": {
85
- "name": "keyword.operator.macro.dollar.rust"
86
- },
87
- "2": {
88
- "name": "variable.other.metavariable.name.rust"
89
- },
90
- "4": {
91
- "name": "keyword.operator.key-value.rust"
92
- },
93
- "5": {
94
- "name": "variable.other.metavariable.specifier.rust"
95
- }
96
- },
97
- "patterns": [
98
- {
99
- "include": "#keywords"
100
- }
101
- ]
102
- },
103
- {
104
- "comment": "macro rules",
105
- "name": "meta.macro.rules.rust",
106
- "match": "\\b(macro_rules!)\\s+(([a-z0-9_]+)|([A-Z][a-z0-9_]*))\\s+(\\{)",
107
- "captures": {
108
- "1": {
109
- "name": "entity.name.function.macro.rules.rust"
110
- },
111
- "3": {
112
- "name": "entity.name.function.macro.rust"
113
- },
114
- "4": {
115
- "name": "entity.name.type.macro.rust"
116
- },
117
- "5": {
118
- "name": "punctuation.brackets.curly.rust"
119
- }
120
- }
121
- },
122
- {
123
- "comment": "modules",
124
- "match": "(mod)\\s+((?:r#(?!crate|[Ss]elf|super))?[a-z][A-Za-z0-9_]*)",
125
- "captures": {
126
- "1": {
127
- "name": "storage.type.rust"
128
- },
129
- "2": {
130
- "name": "entity.name.module.rust"
131
- }
132
- }
133
- },
134
- {
135
- "comment": "external crate imports",
136
- "name": "meta.import.rust",
137
- "begin": "\\b(extern)\\s+(crate)",
138
- "beginCaptures": {
139
- "1": {
140
- "name": "storage.type.rust"
141
- },
142
- "2": {
143
- "name": "keyword.other.crate.rust"
144
- }
145
- },
146
- "end": ";",
147
- "endCaptures": {
148
- "0": {
149
- "name": "punctuation.semi.rust"
150
- }
151
- },
152
- "patterns": [
153
- {
154
- "include": "#block-comments"
155
- },
156
- {
157
- "include": "#comments"
158
- },
159
- {
160
- "include": "#keywords"
161
- },
162
- {
163
- "include": "#punctuation"
164
- }
165
- ]
166
- },
167
- {
168
- "comment": "use statements",
169
- "name": "meta.use.rust",
170
- "begin": "\\b(use)\\s",
171
- "beginCaptures": {
172
- "1": {
173
- "name": "keyword.other.rust"
174
- }
175
- },
176
- "end": ";",
177
- "endCaptures": {
178
- "0": {
179
- "name": "punctuation.semi.rust"
180
- }
181
- },
182
- "patterns": [
183
- {
184
- "include": "#block-comments"
185
- },
186
- {
187
- "include": "#comments"
188
- },
189
- {
190
- "include": "#keywords"
191
- },
192
- {
193
- "include": "#namespaces"
194
- },
195
- {
196
- "include": "#punctuation"
197
- },
198
- {
199
- "include": "#types"
200
- },
201
- {
202
- "include": "#lvariables"
203
- }
204
- ]
205
- },
206
- {
207
- "include": "#block-comments"
208
- },
209
- {
210
- "include": "#comments"
211
- },
212
- {
213
- "include": "#attributes"
214
- },
215
- {
216
- "include": "#lvariables"
217
- },
218
- {
219
- "include": "#constants"
220
- },
221
- {
222
- "include": "#gtypes"
223
- },
224
- {
225
- "include": "#functions"
226
- },
227
- {
228
- "include": "#types"
229
- },
230
- {
231
- "include": "#keywords"
232
- },
233
- {
234
- "include": "#lifetimes"
235
- },
236
- {
237
- "include": "#macros"
238
- },
239
- {
240
- "include": "#namespaces"
241
- },
242
- {
243
- "include": "#punctuation"
244
- },
245
- {
246
- "include": "#strings"
247
- },
248
- {
249
- "include": "#variables"
250
- }
251
- ],
252
- "repository": {
253
- "comments": {
254
- "patterns": [
255
- {
256
- "comment": "documentation comments",
257
- "name": "comment.line.documentation.rust",
258
- "match": "^\\s*///.*"
259
- },
260
- {
261
- "comment": "line comments",
262
- "name": "comment.line.double-slash.rust",
263
- "match": "\\s*//.*"
264
- }
265
- ]
266
- },
267
- "block-comments": {
268
- "patterns": [
269
- {
270
- "comment": "empty block comments",
271
- "name": "comment.block.rust",
272
- "match": "/\\*\\*/"
273
- },
274
- {
275
- "comment": "block documentation comments",
276
- "name": "comment.block.documentation.rust",
277
- "begin": "/\\*\\*",
278
- "end": "\\*/",
279
- "patterns": [
280
- {
281
- "include": "#block-comments"
282
- }
283
- ]
284
- },
285
- {
286
- "comment": "block comments",
287
- "name": "comment.block.rust",
288
- "begin": "/\\*(?!\\*)",
289
- "end": "\\*/",
290
- "patterns": [
291
- {
292
- "include": "#block-comments"
293
- }
294
- ]
295
- }
296
- ]
297
- },
298
- "constants": {
299
- "patterns": [
300
- {
301
- "comment": "ALL CAPS constants",
302
- "name": "constant.other.caps.rust",
303
- "match": "\\b[A-Z]{2}[A-Z0-9_]*\\b"
304
- },
305
- {
306
- "comment": "constant declarations",
307
- "match": "\\b(const)\\s+([A-Z][A-Za-z0-9_]*)\\b",
308
- "captures": {
309
- "1": {
310
- "name": "storage.type.rust"
311
- },
312
- "2": {
313
- "name": "constant.other.caps.rust"
314
- }
315
- }
316
- },
317
- {
318
- "comment": "decimal integers and floats",
319
- "name": "constant.numeric.decimal.rust",
320
- "match": "\\b\\d[\\d_]*(\\.?)[\\d_]*(?:(E|e)([+-]?)([\\d_]+))?(f32|f64|i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize)?\\b",
321
- "captures": {
322
- "1": {
323
- "name": "punctuation.separator.dot.decimal.rust"
324
- },
325
- "2": {
326
- "name": "keyword.operator.exponent.rust"
327
- },
328
- "3": {
329
- "name": "keyword.operator.exponent.sign.rust"
330
- },
331
- "4": {
332
- "name": "constant.numeric.decimal.exponent.mantissa.rust"
333
- },
334
- "5": {
335
- "name": "entity.name.type.numeric.rust"
336
- }
337
- }
338
- },
339
- {
340
- "comment": "hexadecimal integers",
341
- "name": "constant.numeric.hex.rust",
342
- "match": "\\b0x[\\da-fA-F_]+(i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize)?\\b",
343
- "captures": {
344
- "1": {
345
- "name": "entity.name.type.numeric.rust"
346
- }
347
- }
348
- },
349
- {
350
- "comment": "octal integers",
351
- "name": "constant.numeric.oct.rust",
352
- "match": "\\b0o[0-7_]+(i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize)?\\b",
353
- "captures": {
354
- "1": {
355
- "name": "entity.name.type.numeric.rust"
356
- }
357
- }
358
- },
359
- {
360
- "comment": "binary integers",
361
- "name": "constant.numeric.bin.rust",
362
- "match": "\\b0b[01_]+(i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize)?\\b",
363
- "captures": {
364
- "1": {
365
- "name": "entity.name.type.numeric.rust"
366
- }
367
- }
368
- },
369
- {
370
- "comment": "booleans",
371
- "name": "constant.language.bool.rust",
372
- "match": "\\b(true|false)\\b"
373
- }
374
- ]
375
- },
376
- "escapes": {
377
- "comment": "escapes: ASCII, byte, Unicode, quote, regex",
378
- "name": "constant.character.escape.rust",
379
- "match": "(\\\\)(?:(?:(x[0-7][\\da-fA-F])|(u(\\{)[\\da-fA-F]{4,6}(\\}))|.))",
380
- "captures": {
381
- "1": {
382
- "name": "constant.character.escape.backslash.rust"
383
- },
384
- "2": {
385
- "name": "constant.character.escape.bit.rust"
386
- },
387
- "3": {
388
- "name": "constant.character.escape.unicode.rust"
389
- },
390
- "4": {
391
- "name": "constant.character.escape.unicode.punctuation.rust"
392
- },
393
- "5": {
394
- "name": "constant.character.escape.unicode.punctuation.rust"
395
- }
396
- }
397
- },
398
- "attributes": {
399
- "comment": "attributes",
400
- "name": "meta.attribute.rust",
401
- "begin": "(#)(\\!?)(\\[)",
402
- "beginCaptures": {
403
- "1": {
404
- "name": "punctuation.definition.attribute.rust"
405
- },
406
- "3": {
407
- "name": "punctuation.brackets.attribute.rust"
408
- }
409
- },
410
- "end": "\\]",
411
- "endCaptures": {
412
- "0": {
413
- "name": "punctuation.brackets.attribute.rust"
414
- }
415
- },
416
- "patterns": [
417
- {
418
- "include": "#block-comments"
419
- },
420
- {
421
- "include": "#comments"
422
- },
423
- {
424
- "include": "#keywords"
425
- },
426
- {
427
- "include": "#lifetimes"
428
- },
429
- {
430
- "include": "#punctuation"
431
- },
432
- {
433
- "include": "#strings"
434
- },
435
- {
436
- "include": "#gtypes"
437
- },
438
- {
439
- "include": "#types"
440
- }
441
- ]
442
- },
443
- "functions": {
444
- "patterns": [
445
- {
446
- "comment": "pub as a function",
447
- "match": "\\b(pub)(\\()",
448
- "captures": {
449
- "1": {
450
- "name": "keyword.other.rust"
451
- },
452
- "2": {
453
- "name": "punctuation.brackets.round.rust"
454
- }
455
- }
456
- },
457
- {
458
- "comment": "function definition",
459
- "name": "meta.function.definition.rust",
460
- "begin": "\\b(fn)\\s+((?:r#(?!crate|[Ss]elf|super))?[A-Za-z0-9_]+)((\\()|(<))",
461
- "beginCaptures": {
462
- "1": {
463
- "name": "keyword.other.fn.rust"
464
- },
465
- "2": {
466
- "name": "entity.name.function.rust"
467
- },
468
- "4": {
469
- "name": "punctuation.brackets.round.rust"
470
- },
471
- "5": {
472
- "name": "punctuation.brackets.angle.rust"
473
- }
474
- },
475
- "end": "\\{|;",
476
- "endCaptures": {
477
- "0": {
478
- "name": "punctuation.brackets.curly.rust"
479
- }
480
- },
481
- "patterns": [
482
- {
483
- "include": "#block-comments"
484
- },
485
- {
486
- "include": "#comments"
487
- },
488
- {
489
- "include": "#keywords"
490
- },
491
- {
492
- "include": "#lvariables"
493
- },
494
- {
495
- "include": "#constants"
496
- },
497
- {
498
- "include": "#gtypes"
499
- },
500
- {
501
- "include": "#functions"
502
- },
503
- {
504
- "include": "#lifetimes"
505
- },
506
- {
507
- "include": "#macros"
508
- },
509
- {
510
- "include": "#namespaces"
511
- },
512
- {
513
- "include": "#punctuation"
514
- },
515
- {
516
- "include": "#strings"
517
- },
518
- {
519
- "include": "#types"
520
- },
521
- {
522
- "include": "#variables"
523
- }
524
- ]
525
- },
526
- {
527
- "comment": "function/method calls, chaining",
528
- "name": "meta.function.call.rust",
529
- "begin": "((?:r#(?!crate|[Ss]elf|super))?[A-Za-z0-9_]+)(\\()",
530
- "beginCaptures": {
531
- "1": {
532
- "name": "entity.name.function.rust"
533
- },
534
- "2": {
535
- "name": "punctuation.brackets.round.rust"
536
- }
537
- },
538
- "end": "\\)",
539
- "endCaptures": {
540
- "0": {
541
- "name": "punctuation.brackets.round.rust"
542
- }
543
- },
544
- "patterns": [
545
- {
546
- "include": "#block-comments"
547
- },
548
- {
549
- "include": "#comments"
550
- },
551
- {
552
- "include": "#attributes"
553
- },
554
- {
555
- "include": "#keywords"
556
- },
557
- {
558
- "include": "#lvariables"
559
- },
560
- {
561
- "include": "#constants"
562
- },
563
- {
564
- "include": "#gtypes"
565
- },
566
- {
567
- "include": "#functions"
568
- },
569
- {
570
- "include": "#lifetimes"
571
- },
572
- {
573
- "include": "#macros"
574
- },
575
- {
576
- "include": "#namespaces"
577
- },
578
- {
579
- "include": "#punctuation"
580
- },
581
- {
582
- "include": "#strings"
583
- },
584
- {
585
- "include": "#types"
586
- },
587
- {
588
- "include": "#variables"
589
- }
590
- ]
591
- },
592
- {
593
- "comment": "function/method calls with turbofish",
594
- "name": "meta.function.call.rust",
595
- "begin": "((?:r#(?!crate|[Ss]elf|super))?[A-Za-z0-9_]+)(?=::<.*>\\()",
596
- "beginCaptures": {
597
- "1": {
598
- "name": "entity.name.function.rust"
599
- }
600
- },
601
- "end": "\\)",
602
- "endCaptures": {
603
- "0": {
604
- "name": "punctuation.brackets.round.rust"
605
- }
606
- },
607
- "patterns": [
608
- {
609
- "include": "#block-comments"
610
- },
611
- {
612
- "include": "#comments"
613
- },
614
- {
615
- "include": "#attributes"
616
- },
617
- {
618
- "include": "#keywords"
619
- },
620
- {
621
- "include": "#lvariables"
622
- },
623
- {
624
- "include": "#constants"
625
- },
626
- {
627
- "include": "#gtypes"
628
- },
629
- {
630
- "include": "#functions"
631
- },
632
- {
633
- "include": "#lifetimes"
634
- },
635
- {
636
- "include": "#macros"
637
- },
638
- {
639
- "include": "#namespaces"
640
- },
641
- {
642
- "include": "#punctuation"
643
- },
644
- {
645
- "include": "#strings"
646
- },
647
- {
648
- "include": "#types"
649
- },
650
- {
651
- "include": "#variables"
652
- }
653
- ]
654
- }
655
- ]
656
- },
657
- "keywords": {
658
- "patterns": [
659
- {
660
- "comment": "control flow keywords",
661
- "name": "keyword.control.rust",
662
- "match": "\\b(await|break|continue|do|else|for|if|loop|match|return|try|while|yield)\\b"
663
- },
664
- {
665
- "comment": "storage keywords",
666
- "name": "keyword.other.rust storage.type.rust",
667
- "match": "\\b(extern|let|macro|mod)\\b"
668
- },
669
- {
670
- "comment": "const keyword",
671
- "name": "storage.modifier.rust",
672
- "match": "\\b(const)\\b"
673
- },
674
- {
675
- "comment": "type keyword",
676
- "name": "keyword.declaration.type.rust storage.type.rust",
677
- "match": "\\b(type)\\b"
678
- },
679
- {
680
- "comment": "enum keyword",
681
- "name": "keyword.declaration.enum.rust storage.type.rust",
682
- "match": "\\b(enum)\\b"
683
- },
684
- {
685
- "comment": "trait keyword",
686
- "name": "keyword.declaration.trait.rust storage.type.rust",
687
- "match": "\\b(trait)\\b"
688
- },
689
- {
690
- "comment": "struct keyword",
691
- "name": "keyword.declaration.struct.rust storage.type.rust",
692
- "match": "\\b(struct)\\b"
693
- },
694
- {
695
- "comment": "storage modifiers",
696
- "name": "storage.modifier.rust",
697
- "match": "\\b(abstract|static)\\b"
698
- },
699
- {
700
- "comment": "other keywords",
701
- "name": "keyword.other.rust",
702
- "match": "\\b(as|async|become|box|dyn|move|final|impl|in|override|priv|pub|ref|typeof|union|unsafe|unsized|use|virtual|where)\\b"
703
- },
704
- {
705
- "comment": "fn",
706
- "name": "keyword.other.fn.rust",
707
- "match": "\\bfn\\b"
708
- },
709
- {
710
- "comment": "crate",
711
- "name": "keyword.other.crate.rust",
712
- "match": "\\bcrate\\b"
713
- },
714
- {
715
- "comment": "mut",
716
- "name": "storage.modifier.mut.rust",
717
- "match": "\\bmut\\b"
718
- },
719
- {
720
- "comment": "logical operators",
721
- "name": "keyword.operator.logical.rust",
722
- "match": "(\\^|\\||\\|\\||&&|<<|>>|!)(?!=)"
723
- },
724
- {
725
- "comment": "logical AND, borrow references",
726
- "name": "keyword.operator.borrow.and.rust",
727
- "match": "&(?![&=])"
728
- },
729
- {
730
- "comment": "assignment operators",
731
- "name": "keyword.operator.assignment.rust",
732
- "match": "(\\+=|-=|\\*=|/=|%=|\\^=|&=|\\|=|<<=|>>=)"
733
- },
734
- {
735
- "comment": "single equal",
736
- "name": "keyword.operator.assignment.equal.rust",
737
- "match": "(?<![<>])=(?!=|>)"
738
- },
739
- {
740
- "comment": "comparison operators",
741
- "name": "keyword.operator.comparison.rust",
742
- "match": "(=(=)?(?!>)|!=|<=|(?<!=)>=)"
743
- },
744
- {
745
- "comment": "math operators",
746
- "name": "keyword.operator.math.rust",
747
- "match": "(([+%]|(\\*(?!\\w)))(?!=))|(-(?!>))|(/(?!/))"
748
- },
749
- {
750
- "comment": "less than, greater than (special case)",
751
- "match": "(?:\\b|(?:(\\))|(\\])|(\\})))[ \\t]+([<>])[ \\t]+(?:\\b|(?:(\\()|(\\[)|(\\{)))",
752
- "captures": {
753
- "1": {
754
- "name": "punctuation.brackets.round.rust"
755
- },
756
- "2": {
757
- "name": "punctuation.brackets.square.rust"
758
- },
759
- "3": {
760
- "name": "punctuation.brackets.curly.rust"
761
- },
762
- "4": {
763
- "name": "keyword.operator.comparison.rust"
764
- },
765
- "5": {
766
- "name": "punctuation.brackets.round.rust"
767
- },
768
- "6": {
769
- "name": "punctuation.brackets.square.rust"
770
- },
771
- "7": {
772
- "name": "punctuation.brackets.curly.rust"
773
- }
774
- }
775
- },
776
- {
777
- "comment": "namespace operator",
778
- "name": "keyword.operator.namespace.rust",
779
- "match": "::"
780
- },
781
- {
782
- "comment": "dereference asterisk",
783
- "match": "(\\*)(?=\\w+)",
784
- "captures": {
785
- "1": {
786
- "name": "keyword.operator.dereference.rust"
787
- }
788
- }
789
- },
790
- {
791
- "comment": "subpattern binding",
792
- "name": "keyword.operator.subpattern.rust",
793
- "match": "@"
794
- },
795
- {
796
- "comment": "dot access",
797
- "name": "keyword.operator.access.dot.rust",
798
- "match": "\\.(?!\\.)"
799
- },
800
- {
801
- "comment": "ranges, range patterns",
802
- "name": "keyword.operator.range.rust",
803
- "match": "\\.{2}(=|\\.)?"
804
- },
805
- {
806
- "comment": "colon",
807
- "name": "keyword.operator.key-value.rust",
808
- "match": ":(?!:)"
809
- },
810
- {
811
- "comment": "dashrocket, skinny arrow",
812
- "name": "keyword.operator.arrow.skinny.rust",
813
- "match": "->"
814
- },
815
- {
816
- "comment": "hashrocket, fat arrow",
817
- "name": "keyword.operator.arrow.fat.rust",
818
- "match": "=>"
819
- },
820
- {
821
- "comment": "dollar macros",
822
- "name": "keyword.operator.macro.dollar.rust",
823
- "match": "\\$"
824
- },
825
- {
826
- "comment": "question mark operator, questionably sized, macro kleene matcher",
827
- "name": "keyword.operator.question.rust",
828
- "match": "\\?"
829
- }
830
- ]
831
- },
832
- "interpolations": {
833
- "comment": "curly brace interpolations",
834
- "name": "meta.interpolation.rust",
835
- "match": "({)[^\"{}]*(})",
836
- "captures": {
837
- "1": {
838
- "name": "punctuation.definition.interpolation.rust"
839
- },
840
- "2": {
841
- "name": "punctuation.definition.interpolation.rust"
842
- }
843
- }
844
- },
845
- "lifetimes": {
846
- "patterns": [
847
- {
848
- "comment": "named lifetime parameters",
849
- "match": "(['])([a-zA-Z_][0-9a-zA-Z_]*)(?!['])\\b",
850
- "captures": {
851
- "1": {
852
- "name": "punctuation.definition.lifetime.rust"
853
- },
854
- "2": {
855
- "name": "entity.name.type.lifetime.rust"
856
- }
857
- }
858
- },
859
- {
860
- "comment": "borrowing references to named lifetimes",
861
- "match": "(\\&)(['])([a-zA-Z_][0-9a-zA-Z_]*)(?!['])\\b",
862
- "captures": {
863
- "1": {
864
- "name": "keyword.operator.borrow.rust"
865
- },
866
- "2": {
867
- "name": "punctuation.definition.lifetime.rust"
868
- },
869
- "3": {
870
- "name": "entity.name.type.lifetime.rust"
871
- }
872
- }
873
- }
874
- ]
875
- },
876
- "macros": {
877
- "patterns": [
878
- {
879
- "comment": "macros",
880
- "name": "meta.macro.rust",
881
- "match": "(([a-z_][A-Za-z0-9_]*!)|([A-Z_][A-Za-z0-9_]*!))",
882
- "captures": {
883
- "2": {
884
- "name": "entity.name.function.macro.rust"
885
- },
886
- "3": {
887
- "name": "entity.name.type.macro.rust"
888
- }
889
- }
890
- }
891
- ]
892
- },
893
- "namespaces": {
894
- "patterns": [
895
- {
896
- "comment": "namespace (non-type, non-function path segment)",
897
- "match": "(?<![A-Za-z0-9_])([A-Za-z0-9_]+)((?<!super|self)::)",
898
- "captures": {
899
- "1": {
900
- "name": "entity.name.namespace.rust"
901
- },
902
- "2": {
903
- "name": "keyword.operator.namespace.rust"
904
- }
905
- }
906
- }
907
- ]
908
- },
909
- "types": {
910
- "patterns": [
911
- {
912
- "comment": "numeric types",
913
- "match": "(?<![A-Za-z])(f32|f64|i128|i16|i32|i64|i8|isize|u128|u16|u32|u64|u8|usize)\\b",
914
- "captures": {
915
- "1": {
916
- "name": "entity.name.type.numeric.rust"
917
- }
918
- }
919
- },
920
- {
921
- "comment": "parameterized types",
922
- "begin": "\\b(_?[A-Z][A-Za-z0-9_]*)(<)",
923
- "beginCaptures": {
924
- "1": {
925
- "name": "entity.name.type.rust"
926
- },
927
- "2": {
928
- "name": "punctuation.brackets.angle.rust"
929
- }
930
- },
931
- "end": ">",
932
- "endCaptures": {
933
- "0": {
934
- "name": "punctuation.brackets.angle.rust"
935
- }
936
- },
937
- "patterns": [
938
- {
939
- "include": "#block-comments"
940
- },
941
- {
942
- "include": "#comments"
943
- },
944
- {
945
- "include": "#keywords"
946
- },
947
- {
948
- "include": "#lvariables"
949
- },
950
- {
951
- "include": "#lifetimes"
952
- },
953
- {
954
- "include": "#punctuation"
955
- },
956
- {
957
- "include": "#types"
958
- },
959
- {
960
- "include": "#variables"
961
- }
962
- ]
963
- },
964
- {
965
- "comment": "primitive types",
966
- "name": "entity.name.type.primitive.rust",
967
- "match": "\\b(bool|char|str)\\b"
968
- },
969
- {
970
- "comment": "trait declarations",
971
- "match": "\\b(trait)\\s+(_?[A-Z][A-Za-z0-9_]*)\\b",
972
- "captures": {
973
- "1": {
974
- "name": "keyword.declaration.trait.rust storage.type.rust"
975
- },
976
- "2": {
977
- "name": "entity.name.type.trait.rust"
978
- }
979
- }
980
- },
981
- {
982
- "comment": "struct declarations",
983
- "match": "\\b(struct)\\s+(_?[A-Z][A-Za-z0-9_]*)\\b",
984
- "captures": {
985
- "1": {
986
- "name": "keyword.declaration.struct.rust storage.type.rust"
987
- },
988
- "2": {
989
- "name": "entity.name.type.struct.rust"
990
- }
991
- }
992
- },
993
- {
994
- "comment": "enum declarations",
995
- "match": "\\b(enum)\\s+(_?[A-Z][A-Za-z0-9_]*)\\b",
996
- "captures": {
997
- "1": {
998
- "name": "keyword.declaration.enum.rust storage.type.rust"
999
- },
1000
- "2": {
1001
- "name": "entity.name.type.enum.rust"
1002
- }
1003
- }
1004
- },
1005
- {
1006
- "comment": "type declarations",
1007
- "match": "\\b(type)\\s+(_?[A-Z][A-Za-z0-9_]*)\\b",
1008
- "captures": {
1009
- "1": {
1010
- "name": "keyword.declaration.type.rust storage.type.rust"
1011
- },
1012
- "2": {
1013
- "name": "entity.name.type.declaration.rust"
1014
- }
1015
- }
1016
- },
1017
- {
1018
- "comment": "types",
1019
- "name": "entity.name.type.rust",
1020
- "match": "\\b_?[A-Z][A-Za-z0-9_]*\\b(?!!)"
1021
- }
1022
- ]
1023
- },
1024
- "gtypes": {
1025
- "patterns": [
1026
- {
1027
- "comment": "option types",
1028
- "name": "entity.name.type.option.rust",
1029
- "match": "\\b(Some|None)\\b"
1030
- },
1031
- {
1032
- "comment": "result types",
1033
- "name": "entity.name.type.result.rust",
1034
- "match": "\\b(Ok|Err)\\b"
1035
- }
1036
- ]
1037
- },
1038
- "punctuation": {
1039
- "patterns": [
1040
- {
1041
- "comment": "comma",
1042
- "name": "punctuation.comma.rust",
1043
- "match": ","
1044
- },
1045
- {
1046
- "comment": "curly braces",
1047
- "name": "punctuation.brackets.curly.rust",
1048
- "match": "[{}]"
1049
- },
1050
- {
1051
- "comment": "parentheses, round brackets",
1052
- "name": "punctuation.brackets.round.rust",
1053
- "match": "[()]"
1054
- },
1055
- {
1056
- "comment": "semicolon",
1057
- "name": "punctuation.semi.rust",
1058
- "match": ";"
1059
- },
1060
- {
1061
- "comment": "square brackets",
1062
- "name": "punctuation.brackets.square.rust",
1063
- "match": "[\\[\\]]"
1064
- },
1065
- {
1066
- "comment": "angle brackets",
1067
- "name": "punctuation.brackets.angle.rust",
1068
- "match": "(?<!=)[<>]"
1069
- }
1070
- ]
1071
- },
1072
- "strings": {
1073
- "patterns": [
1074
- {
1075
- "comment": "double-quoted strings and byte strings",
1076
- "name": "string.quoted.double.rust",
1077
- "begin": "(b?)(\")",
1078
- "beginCaptures": {
1079
- "1": {
1080
- "name": "string.quoted.byte.raw.rust"
1081
- },
1082
- "2": {
1083
- "name": "punctuation.definition.string.rust"
1084
- }
1085
- },
1086
- "end": "\"",
1087
- "endCaptures": {
1088
- "0": {
1089
- "name": "punctuation.definition.string.rust"
1090
- }
1091
- },
1092
- "patterns": [
1093
- {
1094
- "include": "#escapes"
1095
- },
1096
- {
1097
- "include": "#interpolations"
1098
- }
1099
- ]
1100
- },
1101
- {
1102
- "comment": "double-quoted raw strings and raw byte strings",
1103
- "name": "string.quoted.double.rust",
1104
- "begin": "(b?r)(#*)(\")",
1105
- "beginCaptures": {
1106
- "1": {
1107
- "name": "string.quoted.byte.raw.rust"
1108
- },
1109
- "2": {
1110
- "name": "punctuation.definition.string.raw.rust"
1111
- },
1112
- "3": {
1113
- "name": "punctuation.definition.string.rust"
1114
- }
1115
- },
1116
- "end": "(\")(\\2)",
1117
- "endCaptures": {
1118
- "1": {
1119
- "name": "punctuation.definition.string.rust"
1120
- },
1121
- "2": {
1122
- "name": "punctuation.definition.string.raw.rust"
1123
- }
1124
- }
1125
- },
1126
- {
1127
- "comment": "characters and bytes",
1128
- "name": "string.quoted.single.char.rust",
1129
- "begin": "(b)?(')",
1130
- "beginCaptures": {
1131
- "1": {
1132
- "name": "string.quoted.byte.raw.rust"
1133
- },
1134
- "2": {
1135
- "name": "punctuation.definition.char.rust"
1136
- }
1137
- },
1138
- "end": "'",
1139
- "endCaptures": {
1140
- "0": {
1141
- "name": "punctuation.definition.char.rust"
1142
- }
1143
- },
1144
- "patterns": [
1145
- {
1146
- "include": "#escapes"
1147
- }
1148
- ]
1149
- }
1150
- ]
1151
- },
1152
- "lvariables": {
1153
- "patterns": [
1154
- {
1155
- "comment": "self",
1156
- "name": "variable.language.self.rust",
1157
- "match": "\\b[Ss]elf\\b"
1158
- },
1159
- {
1160
- "comment": "super",
1161
- "name": "variable.language.super.rust",
1162
- "match": "\\bsuper\\b"
1163
- }
1164
- ]
1165
- },
1166
- "variables": {
1167
- "patterns": [
1168
- {
1169
- "comment": "variables",
1170
- "name": "variable.other.rust",
1171
- "match": "\\b(?<!(?<!\\.)\\.)(?:r#(?!(crate|[Ss]elf|super)))?[a-z0-9_]+\\b"
1172
- }
1173
- ]
1174
- }
1175
- }
1176
- }