-
Notifications
You must be signed in to change notification settings - Fork 687
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
Brand new TextMate grammar for providing C# syntax highlighting #1115
Merged
Merged
Changes from 136 commits
Commits
Show all changes
138 commits
Select commit
Hold shift + click to select a range
cae9cfe
Start new C# grammar with comments, type names, and using directives
DustinCampbell 6c65c7e
Add extern aliases
DustinCampbell df59ed0
Add basic attribute support
DustinCampbell 3f5b10b
String literals
DustinCampbell 1887e71
Add attribute named arguments
DustinCampbell c5831f6
Add namespace declarations
DustinCampbell 8a242d4
Refine using directives a bit
DustinCampbell 839b76d
Add class declarations
DustinCampbell 6b258ee
Add interface declarations
DustinCampbell 30bcf56
Refactor test infrastructure a bit and improve test performance by 2X
DustinCampbell 6a23de3
Split type-declaration into class-declaration and interface-declaration
DustinCampbell 973adf2
Add struct declarations
DustinCampbell cbc65f9
Add enum declarations
DustinCampbell 2af4bf2
Add delegate declarations
DustinCampbell d0ecb1a
Add field declarations
DustinCampbell c9e65f5
Add property declarations
DustinCampbell 7a4d60b
Allow muliple declarators in field declarations
DustinCampbell b18805c
Add event declarations
DustinCampbell 28008bc
Refine field declarations
DustinCampbell 47e7a22
Refine property declarations
DustinCampbell e6c0532
Add indexer declarations
DustinCampbell e406840
Add interpolated strings
DustinCampbell b5c61eb
Refactor tests a bit
DustinCampbell 2c2a8cb
A bit more refactoring of tests
DustinCampbell fc096de
Add a few more numeric literal tests
DustinCampbell 81ba982
Refine interpolated strings and escaped braces
DustinCampbell 7a2b7fc
Update TODO list for declarations
DustinCampbell f6e7212
Refine type name regular expressions a bit more
DustinCampbell ed44f41
Add method declarations
DustinCampbell 04f8754
Add return statement and a handful of operators
DustinCampbell 02bb1e9
Add a way to tokenize specific bits of code in tests
DustinCampbell 541464f
Update a couple tests
DustinCampbell 98a1240
Stop testing token line/column
DustinCampbell 57bf1bf
Test only the parts that matter
DustinCampbell 20aa1f5
Rename csharp2.json to csharp-new.json
DustinCampbell 9f90808
Further test clean up
DustinCampbell 5588e5b
Add while and do..while loops
DustinCampbell ffe5396
Rename file
DustinCampbell 6710e7e
Shorten names for a few oft-used tokens
DustinCampbell 90bd717
Add tuple types
DustinCampbell 30dd20c
Add support for alias-qualified names
DustinCampbell c293861
Add support for constructors
DustinCampbell 3ebbb0c
Add support for destructors
DustinCampbell 2c9ee01
Add support for operator declarations
DustinCampbell b782dce
Add support for conversion operators
DustinCampbell b81b894
Add support for verbatim string literals
DustinCampbell 9105b28
Add support for explicitly-implemented interface methods
DustinCampbell 673044d
Add support for explicitly-implemented interface indexers
DustinCampbell 8814cf6
Add support for explicitly-implemented interface properties and events
DustinCampbell 1ad05ee
Add support for interface members
DustinCampbell 1b1c450
Move to YAML to make it easier to define grammar
DustinCampbell 757b65b
Share match for 'base types'
DustinCampbell da284d3
Rename build.ts -> buildSyntax.ts and update npm commands
DustinCampbell dc293b5
Add support for constructor initializers
DustinCampbell ca07e82
Add support for labeled statements
DustinCampbell 9fbf444
Add support for local variable declarations
DustinCampbell db74360
Add support for local constant declarations
DustinCampbell 1999df6
Add support for if/else statements
DustinCampbell f6818cf
Add switch and goto statements
DustinCampbell 8a1c309
Factor our return statements
DustinCampbell e1ff4d6
Factor out do and while statements
DustinCampbell 20a0c8d
Add support for for statements
DustinCampbell 58d7636
Add foreach statements
DustinCampbell 586fd96
Add support for try statements with finally and catch clauses
DustinCampbell 61c7d88
Remove syntaxes/csharp.tmLanguage since we build it
DustinCampbell d6cf67b
Add support for checked/unchecked statements and expressions
DustinCampbell ef31f10
Add support for lock statements
DustinCampbell 4c489c3
Add support for using statements
DustinCampbell 6ec599a
Add support for break, continue, throw and yield statements
DustinCampbell 99b8dca
Factor out if and else statements
DustinCampbell 6d8b187
Move TODO list into YAML file
DustinCampbell 6408bca
Add support for invocation expressions
DustinCampbell df9ced1
Add support for element access expressions
DustinCampbell 5573dc5
Add support for cast expressions
DustinCampbell 2534ff3
Fix typo
DustinCampbell 60271d1
Add regression test for issue #802
DustinCampbell 7be2f67
Add regression tests for issue #816
DustinCampbell 74ee310
Add regression test for issue #830
DustinCampbell 487eb62
Fix #829 and add regression test
DustinCampbell d161564
Fix #861 and add regression test
DustinCampbell 1ab9c08
Fix #1078 and add regression tests
DustinCampbell 813b83e
Fix #1084 and add regression test
DustinCampbell b09b97e
Add regression test for #1084
DustinCampbell 1b53e8d
Add regression test for issue #1097
DustinCampbell c49b733
Add regression test for issue #1108
DustinCampbell 8eee866
Allow comments in more places
DustinCampbell 75c7168
Add array creation expressions
DustinCampbell 544d983
Add override and virtual modifiers
DustinCampbell c1c575d
Fix cast expressions
DustinCampbell e20b131
Add support for initializers and several more fixes
DustinCampbell 553efe4
Add regression test for issue #1096
DustinCampbell 4b17d8f
Revamp invocation, element access and member access expressions and a…
DustinCampbell 212e5b7
Add support for preprocessor
DustinCampbell ff5455a
Add regression test for issue #731
DustinCampbell b4f1ab2
Add regression test for issue #225
DustinCampbell 43cfbe9
Improve display of type declaration names with type parameters and al…
DustinCampbell 6255ad9
Display built-in types as keywords
DustinCampbell 80745b9
Big revamp of type name matching and support added for nullable type …
DustinCampbell 3dca527
Add support for var in local variable declarations and foreach statem…
DustinCampbell b4e05bf
Add support for query expressions
DustinCampbell 7475dd2
Add regression test for issue #1106 and fix enough to make it pass
DustinCampbell b337d17
Fix array suffixes for jagged arrays and multi-dimensional arrays wit…
DustinCampbell f4e7989
Fix several bugs
DustinCampbell 2f93a87
Ensure preprocessor works in enum member lists
DustinCampbell 3435be2
Refine queries a bit so that clauses are only matched inside a query
DustinCampbell 5728dfe
Add unsafe storage modifier
DustinCampbell 1a06b43
Add tests for lambda expression support
DustinCampbell c0ca262
Allow constructor initializers to have line break between : and this/…
DustinCampbell 0496580
Add support for default expressions
DustinCampbell 5861d0d
Consolidate statement tests
DustinCampbell 616d6c7
Consolidate expression and literal tests
DustinCampbell e01afdb
Clean up several token types
DustinCampbell ae019da
Add support for anonymous methods
DustinCampbell 78dae22
Add support for null coalescing operator
DustinCampbell a125c41
Add support for conditional operator
DustinCampbell 9fdc7c9
Allow attributes on property and event accessors
DustinCampbell 446395f
Choose different keyword name for 'operator' since 'keyword.other.ope…
DustinCampbell ac01c0a
Add support for XML doc comments by leveraging 'text.xml'
DustinCampbell 39db070
Add regression test for issue #316
DustinCampbell e467be7
Handle XML doc comments rather than delegating to text.xml (so we can…
DustinCampbell 6cda9f5
Add regression tests for issue #1091
DustinCampbell 75a1c99
Switch to new grammar
DustinCampbell 166995a
Add top-level methods and statements and fix issue with implicit lamb…
DustinCampbell 3e3148b
Tweak tuple type rule slightly
DustinCampbell 2024390
Add support for compound operators and 'this' keyword on extension me…
DustinCampbell 057a854
Add support for nameof expressions
DustinCampbell 8ebfdf8
Add support for null-conditional operator
DustinCampbell e214cdf
Tweak to anonymous object creation expressions
DustinCampbell 2f3f41e
Add regression test for issue #268
DustinCampbell 0b2b402
Add support for await expressions
DustinCampbell 161ddf2
Tweak query expressions slightly
DustinCampbell 28ff2cf
Add support for is and as casts
DustinCampbell 3873cc6
Delete old grammar
DustinCampbell 93b3b54
Remove third-party notice for old grammar
DustinCampbell 8e868b6
Clean up syntax.md
DustinCampbell b0d0041
Add plist output to source control
DustinCampbell eed1bbe
Revert unintended changes in package.json
DustinCampbell 47fb5c5
Remove 'meta.type.parameters.cs' name which causes tuple element name…
DustinCampbell 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 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 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,23 @@ | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
import * as yaml from 'js-yaml'; | ||
import * as plist from 'plist'; | ||
|
||
function writePlistFile(grammar: any, fileName: string) { | ||
const text = plist.build(grammar); | ||
fs.writeFileSync(fileName, text, "utf8"); | ||
} | ||
|
||
function readYaml(fileName: string) { | ||
const text = fs.readFileSync(fileName, "utf8"); | ||
return yaml.safeLoad(text); | ||
} | ||
|
||
function buildGrammar() { | ||
const tsGrammar = readYaml("syntaxes/csharp.tmLanguage.yml"); | ||
|
||
// Write csharp.tmLanguage | ||
writePlistFile(tsGrammar, "syntaxes/csharp.tmLanguage"); | ||
} | ||
|
||
buildGrammar(); |
This file contains 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 |
---|---|---|
|
@@ -24,9 +24,10 @@ | |
"main": "./out/src/main", | ||
"scripts": { | ||
"vscode:prepublish": "tsc -p ./", | ||
"compile": "tsc -p ./ && gulp tslint", | ||
"compile": "tsc -p ./ && gulp tslint && node ./out/buildSyntax.js", | ||
"watch": "tsc -watch -p ./", | ||
"test": "node ./node_modules/vscode/bin/test", | ||
"test": "node ./node_modules/vscode/bin/test && mocha --timeout 15000 --ui bdd ./out/test/syntaxes/*.test.syntax.js", | ||
"build-syntax": "node ./out/buildSyntax.js", | ||
"test-syntax": "mocha --timeout 15000 --ui bdd ./out/test/syntaxes/*.test.syntax.js", | ||
"postinstall": "node ./node_modules/vscode/bin/install" | ||
}, | ||
|
@@ -46,6 +47,7 @@ | |
"devDependencies": { | ||
"@types/chai": "^3.4.34", | ||
"@types/fs-extra": "0.0.35", | ||
"@types/js-yaml": "^3.5.29", | ||
"@types/mkdirp": "^0.3.29", | ||
"@types/mocha": "^2.2.32", | ||
"@types/node": "^6.0.40", | ||
|
@@ -56,7 +58,9 @@ | |
"gulp": "^3.9.1", | ||
"gulp-mocha": "^2.1.3", | ||
"gulp-tslint": "^4.3.0", | ||
"js-yaml": "^3.7.0", | ||
"mocha": "^2.3.3", | ||
"plist": "^2.0.1", | ||
"tslint": "^3.15.1", | ||
"tslint-microsoft-contrib": "^2.0.12", | ||
"typescript": "^2.0.3", | ||
|
@@ -390,7 +394,7 @@ | |
{ | ||
"language": "csharp", | ||
"scopeName": "source.cs", | ||
"path": "./syntaxes/csharp.json" | ||
"path": "./syntaxes/csharp.tmLanguage" | ||
} | ||
], | ||
"jsonValidation": [ | ||
|
@@ -474,13 +478,11 @@ | |
"razor" | ||
] | ||
}, | ||
"runtime": "node", | ||
"runtimeArgs": [], | ||
"variables": { | ||
"pickProcess": "csharp.listProcess", | ||
"pickRemoteProcess": "csharp.listRemoteProcess" | ||
}, | ||
"program": "./out/src/coreclr-debug/proxy.js", | ||
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217", | ||
"configurationAttributes": { | ||
"launch": { | ||
|
@@ -1140,8 +1142,17 @@ | |
"request": "attach", | ||
"processId": "${command.pickProcess}" | ||
} | ||
] | ||
], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or this |
||
"windows": { | ||
"program": "./.debugger/OpenDebugAD7.exe" | ||
}, | ||
"osx": { | ||
"program": "./.debugger/OpenDebugAD7" | ||
}, | ||
"linux": { | ||
"program": "./.debugger/OpenDebugAD7" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or this one