Skip to content

Commit 4d90180

Browse files
Merge pull request #1115 from DustinCampbell/new-syntax
Brand new TextMate grammar for providing C# syntax highlighting
2 parents 931498c + 47fb5c5 commit 4d90180

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+18630
-1672
lines changed

ThirdPartyNotices.txt

-40
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ expressly granted, whether by implication, estoppel or otherwise.
1212
3. run-in-terminal version 0.0.2 (https://github.com/microsoft/run-in-terminal)
1313
4. semver version 5.1.0 (https://github.com/npm/node-semver)
1414
5. DefinitelyTyped version 0.0.1 (https://github.com/borisyankov/DefinitelyTyped)
15-
6. language-csharp version 0.11.0 (https://github.com/atom/language-csharp)
1615

1716
%% omnisharp-roslyn NOTICES AND INFORMATION BEGINS HERE
1817
============================================================
@@ -123,42 +122,3 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
123122
THE SOFTWARE.
124123
============================================================
125124
END OF DefinitelyTyped NOTICES AND INFORMATION
126-
127-
%% language-csharp NOTICES AND INFORMATION BEGIN HERE
128-
=========================================
129-
Copyright (c) 2014 GitHub Inc.
130-
131-
Permission is hereby granted, free of charge, to any person obtaining
132-
a copy of this software and associated documentation files (the
133-
"Software"), to deal in the Software without restriction, including
134-
without limitation the rights to use, copy, modify, merge, publish,
135-
distribute, sublicense, and/or sell copies of the Software, and to
136-
permit persons to whom the Software is furnished to do so, subject to
137-
the following conditions:
138-
139-
The above copyright notice and this permission notice shall be
140-
included in all copies or substantial portions of the Software.
141-
142-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
143-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
144-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
145-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
146-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
147-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
148-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
149-
150-
151-
This package was derived from a TextMate bundle located at
152-
https://github.com/wintermi/csharp-tmbundle by Matthew Winter @wintermi and
153-
Adam Lickel @lickel and distributed under the following license, located in
154-
`README.markdown`:
155-
156-
This bundle is dual-licensed under MIT and GPL licenses.
157-
158-
- http://www.opensource.org/licenses/mit-license.php
159-
- http://www.gnu.org/licenses/gpl.html
160-
161-
Use it, change it, fork it, sell it. Do what you will, but please leave the
162-
author attribution.
163-
=========================================
164-
END OF language-csharp NOTICES AND INFORMATION

buildSyntax.ts

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import * as fs from 'fs';
2+
import * as path from 'path';
3+
import * as yaml from 'js-yaml';
4+
import * as plist from 'plist';
5+
6+
function writePlistFile(grammar: any, fileName: string) {
7+
const text = plist.build(grammar);
8+
fs.writeFileSync(fileName, text, "utf8");
9+
}
10+
11+
function readYaml(fileName: string) {
12+
const text = fs.readFileSync(fileName, "utf8");
13+
return yaml.safeLoad(text);
14+
}
15+
16+
function buildGrammar() {
17+
const tsGrammar = readYaml("syntaxes/csharp.tmLanguage.yml");
18+
19+
// Write csharp.tmLanguage
20+
writePlistFile(tsGrammar, "syntaxes/csharp.tmLanguage");
21+
}
22+
23+
buildGrammar();

package.json

+8-4
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@
2424
"main": "./out/src/main",
2525
"scripts": {
2626
"vscode:prepublish": "tsc -p ./",
27-
"compile": "tsc -p ./ && gulp tslint",
27+
"compile": "tsc -p ./ && gulp tslint && node ./out/buildSyntax.js",
2828
"watch": "tsc -watch -p ./",
29-
"test": "node ./node_modules/vscode/bin/test",
29+
"test": "node ./node_modules/vscode/bin/test && mocha --timeout 15000 --ui bdd ./out/test/syntaxes/*.test.syntax.js",
30+
"build-syntax": "node ./out/buildSyntax.js",
3031
"test-syntax": "mocha --timeout 15000 --ui bdd ./out/test/syntaxes/*.test.syntax.js",
3132
"postinstall": "node ./node_modules/vscode/bin/install"
3233
},
@@ -46,6 +47,7 @@
4647
"devDependencies": {
4748
"@types/chai": "^3.4.34",
4849
"@types/fs-extra": "0.0.35",
50+
"@types/js-yaml": "^3.5.29",
4951
"@types/mkdirp": "^0.3.29",
5052
"@types/mocha": "^2.2.32",
5153
"@types/node": "^6.0.40",
@@ -56,7 +58,9 @@
5658
"gulp": "^3.9.1",
5759
"gulp-mocha": "^2.1.3",
5860
"gulp-tslint": "^4.3.0",
61+
"js-yaml": "^3.7.0",
5962
"mocha": "^2.3.3",
63+
"plist": "^2.0.1",
6064
"tslint": "^3.15.1",
6165
"tslint-microsoft-contrib": "^2.0.12",
6266
"typescript": "^2.0.3",
@@ -390,7 +394,7 @@
390394
{
391395
"language": "csharp",
392396
"scopeName": "source.cs",
393-
"path": "./syntaxes/csharp.json"
397+
"path": "./syntaxes/csharp.tmLanguage"
394398
}
395399
],
396400
"jsonValidation": [
@@ -1144,4 +1148,4 @@
11441148
}
11451149
]
11461150
}
1147-
}
1151+
}

0 commit comments

Comments
 (0)