Skip to content

Commit 8a4ae57

Browse files
authored
Convert syntax file to Typescript (#20)
Convert syntax file to Typescript
2 parents ba18577 + c9a4a36 commit 8a4ae57

13 files changed

+1529
-1292
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Autogenerated synax files
2+
syntax/syntaxes/Scala.tmLanguage.json
3+
4+
syntax/node_modules

syntax/.vscode/launch.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22
{
33
"version": "0.1.0",
44
"configurations": [
5+
{
6+
"type": "extensionHost",
7+
"request": "launch",
8+
"name": "Build && Launch",
9+
"runtimeExecutable": "${execPath}",
10+
"args": [
11+
"--extensionDevelopmentPath=${workspaceFolder}"
12+
],
13+
"preLaunchTask": "Generate Scala language file"
14+
},
15+
516
{
617
"name": "Launch Extension",
718
"type": "extensionHost",

syntax/.vscode/tasks.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "Generate Scala language file",
8+
"type": "shell",
9+
"command": "npx ts-node src/typescript/GenerateTmLanguageFile.ts > ./syntaxes/Scala.tmLanguage.json",
10+
"group": {
11+
"kind": "build",
12+
"isDefault": true
13+
}
14+
}
15+
]
16+
}

syntax/.vscodeignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.vscode/**
2+
.vscode-test/**
3+
.gitignore
4+
tests/**
5+
src/**
6+
node_modules
7+
.gitkeep

syntax/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,23 @@ Extension providing Scala syntax.
1010

1111
No requirements.
1212

13+
## Development
14+
15+
The source language file is located at `src/typescript/Scala.tmlanguage.ts`. The output tmLanguage file `syntaxes/Scala.tmLanguage.json` is marked as ignored in git and shouldn't be commited.
16+
17+
To generate the ouput file either use build command or run:
18+
19+
```bash
20+
npm install
21+
```
22+
23+
The output file is validated against the json schema before being written.
24+
25+
1326
## Based on
1427
* Plugin: https://github.com/daltonjorge/vscode-scala
1528
* Template: https://github.com/sellmerfud/scala.tmbundle (https://github.com/mads-hartmann/scala.tmbundle)
29+
* Textmate json schema: https://github.com/Septh/tmlanguage/blob/master/tmLanguage.schema.json
1630

1731
## License
1832
[MIT](LICENSE)

syntax/package-lock.json

Lines changed: 130 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

syntax/package.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"icon": "images/smooth-spiral.png",
1717
"categories": [
18-
"Languages"
18+
"Programming Languages"
1919
],
2020
"contributes": {
2121
"languages": [
@@ -37,8 +37,19 @@
3737
{
3838
"language": "scala",
3939
"scopeName": "source.scala",
40-
"path": "./syntaxes/Scala.tmLanguage"
40+
"path": "./syntaxes/Scala.tmLanguage.json"
4141
}
4242
]
43+
},
44+
"devDependencies": {
45+
"@types/node": "^11.11.4",
46+
"ajv": "^6.10.0",
47+
"ts-node": "^8.0.2",
48+
"tsc": "^1.20150623.0",
49+
"typescript": "^3.3.3"
50+
},
51+
"scripts": {
52+
"vscode:prepublish": "test -f ./syntaxes/Scala.tmLanguage.json",
53+
"prepare": "npx ts-node src/typescript/GenerateTmLanguageFile.ts > ./syntaxes/Scala.tmLanguage.json"
4354
}
4455
}

0 commit comments

Comments
 (0)