Skip to content

Commit f3aca62

Browse files
committed
Convert syntax file to Typescript, add utils to work with ts file, update docs
1 parent ba18577 commit f3aca62

13 files changed

+1531
-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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.vscode/**
2+
.vscode-test/**
3+
.gitignore
4+
tests/**
5+
src/**

syntax/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,25 @@ 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+
npm build
22+
npx ts-node src/typescript/GenerateTmLanguageFile.ts > ./syntaxes/Scala.tmLanguage.json
23+
```
24+
25+
The output file is validated against the json schema before being written.
26+
27+
1328
## Based on
1429
* Plugin: https://github.com/daltonjorge/vscode-scala
1530
* Template: https://github.com/sellmerfud/scala.tmbundle (https://github.com/mads-hartmann/scala.tmbundle)
31+
* Textmate json schema: https://github.com/Septh/tmlanguage/blob/master/tmLanguage.schema.json
1632

1733
## License
1834
[MIT](LICENSE)

syntax/package-lock.json

Lines changed: 136 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: 9 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,15 @@
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"
4350
}
4451
}

0 commit comments

Comments
 (0)