Skip to content
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

Syntax highlighter in VScode for carbon programming language #3953

Merged
merged 39 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
9c9b233
Create carbon.tmLanguage.json
RohanVashisht1234 May 16, 2024
402ab77
Update language-configuration.json
RohanVashisht1234 May 16, 2024
946e00a
Update package.json
RohanVashisht1234 May 16, 2024
9c1cb0d
Update package.json
RohanVashisht1234 May 16, 2024
b06eb89
Update carbon.tmLanguage.json
RohanVashisht1234 May 16, 2024
14db0c5
Update package.json
RohanVashisht1234 May 16, 2024
8bc3355
Merge branch 'carbon-language:trunk' into trunk
RohanVashisht1234 May 16, 2024
7912544
Update carbon.tmLanguage.json
RohanVashisht1234 May 17, 2024
5558662
Update package.json
RohanVashisht1234 May 17, 2024
bea96b7
Update carbon.tmLanguage.json
RohanVashisht1234 May 17, 2024
299934a
Merge branch 'trunk' into trunk
RohanVashisht1234 May 17, 2024
70f0910
Update carbon.tmLanguage.json
RohanVashisht1234 May 17, 2024
907d2b7
Merge branch 'trunk' into trunk
RohanVashisht1234 May 17, 2024
9106862
Delete utils/textmate/Syntaxes directory
RohanVashisht1234 May 17, 2024
02a5711
Update and rename Carbon.plist to carbon.tmLanguage.json
RohanVashisht1234 May 17, 2024
6b54f34
Create carbon.tmLanguage.json
RohanVashisht1234 May 17, 2024
b157b64
Delete utils/vscode/syntaxes directory
RohanVashisht1234 May 17, 2024
2ef24fb
Update package.json
RohanVashisht1234 May 17, 2024
8adb752
Merge branch 'trunk' into trunk
RohanVashisht1234 May 17, 2024
c4e7d1b
Update carbon.tmLanguage.json
RohanVashisht1234 May 17, 2024
3c4dac1
ok
RohanVashisht1234 May 17, 2024
cb8585f
ok
RohanVashisht1234 May 17, 2024
114a36b
ok
RohanVashisht1234 May 17, 2024
5975efe
ok
RohanVashisht1234 May 17, 2024
fc729cb
ok
RohanVashisht1234 May 17, 2024
21674a4
Update utils/textmate/Syntaxes/carbon.tmLanguage.json
RohanVashisht1234 May 18, 2024
94eb0a8
Update utils/textmate/Syntaxes/carbon.tmLanguage.json
RohanVashisht1234 May 18, 2024
df51138
ok
RohanVashisht1234 May 18, 2024
79da246
Update utils/textmate/Syntaxes/carbon.tmLanguage.json
RohanVashisht1234 May 19, 2024
7b68d47
Update utils/vscode/language-configuration.json
RohanVashisht1234 May 19, 2024
a27500f
Update utils/vscode/language-configuration.json
RohanVashisht1234 May 19, 2024
ddad5e6
Update utils/vscode/language-configuration.json
RohanVashisht1234 May 19, 2024
8839ced
Update utils/vscode/language-configuration.json
RohanVashisht1234 May 19, 2024
b4f3e02
Update carbon.tmLanguage.json
RohanVashisht1234 May 19, 2024
97f661c
Update language-configuration.json
RohanVashisht1234 May 19, 2024
5fadaac
ok
RohanVashisht1234 May 20, 2024
05a6df6
Update utils/textmate/Syntaxes/carbon.tmLanguage.json
RohanVashisht1234 May 20, 2024
1773518
ok
RohanVashisht1234 May 20, 2024
5e2c701
Merge branch 'trunk' into trunk
RohanVashisht1234 May 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 0 additions & 157 deletions utils/textmate/Syntaxes/Carbon.plist

This file was deleted.

201 changes: 201 additions & 0 deletions utils/textmate/Syntaxes/carbon.tmLanguage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "carbon",
"foldingStartMarker": "\\{\\s*$",
"foldingStopMarker": "^\\s*\\}",
"fileTypes": ["carbon"],
"patterns": [
{
"include": "#comments"
},
{
"include": "#operators"
},
{
"include": "#special-keywords"
},
{
"include": "#numbers"
},
{
"include": "#reserved-words"
},
{
"include": "#operator-dedicated-keywords-statements"
},
{
"include": "#ctrl-statements"
},
{
"include": "#true-false"
},
{
"include": "#functions"
},
{
"name": "string.quoted.triple.carbon",
RohanVashisht1234 marked this conversation as resolved.
Show resolved Hide resolved
"begin": "'''([^\\s'#]*\\n)?",
"end": "'''",
"beginCaptures": {
"1": {
"name": "constant.character.escape.carbon"
}
},
"patterns": [
{
"include": "#string_escapes"
}
]
},
{
"name": "string.quoted.double.carbon",
"begin": "\"",
"end": "\"",
"patterns": [
{
"include": "#string_escapes"
}
]
},
{
"include": "#customs"
}
],
"repository": {
"operators": {
"patterns": [
{
"name": "keyword.operator.carbon",
"match": "\\b(\\+|-|\\*|/|!)\\b"
}
]
},
"comments": {
"patterns": [
{
"begin": "(^[ \\t]+)?(?=//)",
"end": "(?!\\G)",
"patterns": [
{
"name": "comment.line.carbon",
"begin": "//",
"end": "$"
}
]
}
]
},
"string_escapes": {
"patterns": [
{
"name": "constant.character.escape.carbon",
"match": "\\\\([tnr'\"0\\0]|x[0-9A-F]{2}|u\\{[0-9A-F]{4,}\\})"
}
]
},
"special-keywords": {
"patterns": [
{
"name": "keyword.control.carbon",
"match": "\\b(break|case|continue|default|else|if|for|match|return|returned|then|while)\\b"
}
]
},
"operator-dedicated-keywords-statements": {
"patterns": [
{
"name": "keyword.other.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": "constant.language.carbon",
"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": "0x[_0-9A-F]+(\\.[_0-9A-F]+(p[-+]?[1-9][0-9]*)?)?"
},
{
"name": "constant.numeric.carbon",
"match": "0b[_01]+"
},
{
"name": "constant.numeric.carbon",
"match": "[1-9][_0-9]*(\\.[_0-9]+(e[-+]?[1-9][0-9]*)?)?"
}
]
}
},
"scopeName": "source.carbon"
}
1 change: 0 additions & 1 deletion utils/vscode/Carbon.plist

This file was deleted.

1 change: 1 addition & 0 deletions utils/vscode/carbon.tmLanguage.json
20 changes: 14 additions & 6 deletions utils/vscode/language-configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,27 @@
"comments": {
"lineComment": "//"
},
// Symbols used as brackets.
"brackets": [
["(", ")"],
["{", "}"],
["[", "]"],
["{", "}"]
["(", ")"]
],
// Symbols that are auto closed when typing.
"autoClosingPairs": [
["(", ")"],
["{", "}"],
["[", "]"],
["{", "}"]
["(", ")"],
["\"", "\""],
["'", "'"]
],
// Symbols that can be used to surround a selection.
"surroundingPairs": [
["(", ")"],
["{", "}"],
["[", "]"],
["{", "}"]
["(", ")"],
["\"", "\""],
["'", "'"],
["'''", "'''"]
]
}
Loading
Loading