-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Syntax highlighter in VScode for carbon programming language #3953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 13 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
9c9b233
Create carbon.tmLanguage.json
RohanVashisht1234 402ab77
Update language-configuration.json
RohanVashisht1234 946e00a
Update package.json
RohanVashisht1234 9c1cb0d
Update package.json
RohanVashisht1234 b06eb89
Update carbon.tmLanguage.json
RohanVashisht1234 14db0c5
Update package.json
RohanVashisht1234 8bc3355
Merge branch 'carbon-language:trunk' into trunk
RohanVashisht1234 7912544
Update carbon.tmLanguage.json
RohanVashisht1234 5558662
Update package.json
RohanVashisht1234 bea96b7
Update carbon.tmLanguage.json
RohanVashisht1234 299934a
Merge branch 'trunk' into trunk
RohanVashisht1234 70f0910
Update carbon.tmLanguage.json
RohanVashisht1234 907d2b7
Merge branch 'trunk' into trunk
RohanVashisht1234 9106862
Delete utils/textmate/Syntaxes directory
RohanVashisht1234 02a5711
Update and rename Carbon.plist to carbon.tmLanguage.json
RohanVashisht1234 6b54f34
Create carbon.tmLanguage.json
RohanVashisht1234 b157b64
Delete utils/vscode/syntaxes directory
RohanVashisht1234 2ef24fb
Update package.json
RohanVashisht1234 8adb752
Merge branch 'trunk' into trunk
RohanVashisht1234 c4e7d1b
Update carbon.tmLanguage.json
RohanVashisht1234 3c4dac1
ok
RohanVashisht1234 cb8585f
ok
RohanVashisht1234 114a36b
ok
RohanVashisht1234 5975efe
ok
RohanVashisht1234 fc729cb
ok
RohanVashisht1234 21674a4
Update utils/textmate/Syntaxes/carbon.tmLanguage.json
RohanVashisht1234 94eb0a8
Update utils/textmate/Syntaxes/carbon.tmLanguage.json
RohanVashisht1234 df51138
ok
RohanVashisht1234 79da246
Update utils/textmate/Syntaxes/carbon.tmLanguage.json
RohanVashisht1234 7b68d47
Update utils/vscode/language-configuration.json
RohanVashisht1234 a27500f
Update utils/vscode/language-configuration.json
RohanVashisht1234 ddad5e6
Update utils/vscode/language-configuration.json
RohanVashisht1234 8839ced
Update utils/vscode/language-configuration.json
RohanVashisht1234 b4f3e02
Update carbon.tmLanguage.json
RohanVashisht1234 97f661c
Update language-configuration.json
RohanVashisht1234 5fadaac
ok
RohanVashisht1234 05a6df6
Update utils/textmate/Syntaxes/carbon.tmLanguage.json
RohanVashisht1234 1773518
ok
RohanVashisht1234 5e2c701
Merge branch 'trunk' into trunk
RohanVashisht1234 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,178 @@ | ||
| { | ||
zygoloid marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", | ||
zygoloid marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "name": "carbon", | ||
RohanVashisht1234 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "patterns": [ | ||
| { | ||
| "include": "#comments" | ||
| }, | ||
| { | ||
| "include": "#operators" | ||
| }, | ||
| { | ||
| "include": "#strings" | ||
| }, | ||
| { | ||
| "include": "#numbers" | ||
| }, | ||
| { | ||
| "include": "#reserved-words" | ||
| }, | ||
| { | ||
| "include": "#operator-dedicated-keywords-statements" | ||
| }, | ||
| { | ||
| "include": "#ctrl-statements" | ||
| }, | ||
| { | ||
| "include": "#special-keywords" | ||
| }, | ||
| { | ||
| "include": "#true-false" | ||
| }, | ||
| { | ||
| "include": "#functions" | ||
| }, | ||
| { | ||
| "include": "#customs" | ||
| } | ||
| ], | ||
| "repository": { | ||
| "operators": { | ||
| "patterns": [ | ||
| { | ||
| "name": "keyword.operator.new.carbon", | ||
| "match": "\\b(\\+|-|\\*|/|!)\\b" | ||
| } | ||
| ] | ||
| }, | ||
| "comments": { | ||
| "patterns": [ | ||
| { | ||
| "name": "comment.line.double-dash.carbon", | ||
RohanVashisht1234 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "begin": "//", | ||
| "end": "\n" | ||
| } | ||
| ] | ||
| }, | ||
| "strings": { | ||
| "patterns": [ | ||
| { | ||
| "name": "string.quoted.single.carbon", | ||
| "begin": "'", | ||
| "end": "'" | ||
| }, | ||
| { | ||
| "name": "string.quoted.double.carbon", | ||
| "begin": "\"", | ||
| "end": "\"" | ||
| }, | ||
| { | ||
| "name": "string.quoted.triple.carbon", | ||
| "begin": "\"\"\"", | ||
| "end": "\"\"\"" | ||
zygoloid marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| ] | ||
| }, | ||
| "special-keywords": { | ||
| "patterns": [ | ||
| { | ||
| "name": "keyword.control.less.carbon", | ||
zygoloid marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "match": "\\b(break|case|continue|default|else|if|for|match|return|returned|then|while)\\b" | ||
| } | ||
| ] | ||
| }, | ||
| "operator-dedicated-keywords-statements": { | ||
| "patterns": [ | ||
| { | ||
| "name": "keyword.carbon", | ||
| "match": "\\b(abstract|adapt|addr|alias|and|api|as|auto|base|choice|class|constraint|destructor|extend|final|fn|forall|friend|impl|impls|import|in|interface|let|library|like|namespace|not|observe|or|override|package|partial|private|protected|require|Self|template|type|var|virtual|where|_)\\b" | ||
| } | ||
| ] | ||
| }, | ||
| "reserved-words": { | ||
| "patterns": [ | ||
| { | ||
| "name": "support.type.carbon", | ||
| "match": "\\b(As|bool|Carbon\\.Int|Carbon\\.UInt|f16|f32|f64|f128|i8|i16|i32|i64|i128|i256|Slice|String|StringView|type|u8|u16|u32|u64|u128|u256)\\b" | ||
| } | ||
| ] | ||
| }, | ||
| "true-false": { | ||
| "patterns": [ | ||
| { | ||
| "name": "keyword.operator.new.carbon", | ||
zygoloid marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "match": "\\b(true|false)\\b" | ||
| } | ||
| ] | ||
| }, | ||
| "functions": { | ||
| "patterns": [ | ||
| { | ||
| "name": "support.function.carbon", | ||
| "match": "\\b[a-zA-Z]+\\s*\\(" | ||
| } | ||
| ] | ||
| }, | ||
| "customs": { | ||
| "patterns": [ | ||
| { | ||
| "name": "support.class.carbon", | ||
| "match": "(?<=\\bpackage\\s)\\w+" | ||
| }, | ||
| { | ||
| "name": "support.variable.carbon", | ||
| "match": "(?<=\\s*\\.)\\w+" | ||
| }, | ||
| { | ||
| "name": "support.variable.carbon", | ||
| "match": "(?<=\\bas\\s)\\w+" | ||
| }, | ||
| { | ||
| "name": "support.variable.carbon", | ||
| "match": "\\w+(?=\\s*:)" | ||
| }, | ||
| { | ||
| "name": "support.variable.carbon", | ||
| "match": "(?<=\\blet\\s)\\w+" | ||
| }, | ||
| { | ||
| "name": "support.variable.carbon", | ||
| "match": "(?<=\\bvar\\s)\\w+" | ||
| }, | ||
| { | ||
| "name": "support.function.carbon", | ||
| "match": "(?<=\\bfn\\s)\\w+" | ||
| }, | ||
| { | ||
| "name": "support.other.carbon", | ||
| "match": "(?<=\\bimpl\\s)\\w+" | ||
| }, | ||
| { | ||
| "name": "support.type.property-name.carbon", | ||
| "match": "(?<=\\bimport\\s)\\w+" | ||
| }, | ||
| { | ||
| "name": "support.class.carbon", | ||
| "match": "(?<=\\bclass\\s)\\w+" | ||
| } | ||
| ] | ||
| }, | ||
| "numbers": { | ||
| "patterns": [ | ||
| { | ||
| "name": "constant.numeric.carbon", | ||
| "match": "\\b\\d+\\b" | ||
| }, | ||
| { | ||
| "name": "constant.numeric.carbon", | ||
| "match": "\\b\\d+\\.\\d+\\b" | ||
| }, | ||
| { | ||
| "name": "constant.numeric.carbon", | ||
| "match": "\\b\\d{1,3}(?:_\\d{3})*\\b" | ||
| } | ||
RohanVashisht1234 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ] | ||
| } | ||
| }, | ||
| "scopeName": "source.carbon" | ||
zygoloid marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.