Skip to content

Commit

Permalink
yeoman - Create tasks.json to generate grammar files (#928)
Browse files Browse the repository at this point in the history
Create tasks.json to generate grammar files #926
  • Loading branch information
dhuebner authored Feb 15, 2023
1 parent 24760e8 commit 194c47d
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/generator-langium/langium-template/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build <%= language-id %>",
"command": "npm run langium:generate && npm run build",
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Langium: Generate grammar and build the <%= language-id %> language",
"icon": {
"color": "terminal.ansiGreen",
"id": "server-process"
}
}
]
}
26 changes: 26 additions & 0 deletions packages/generator-langium/test/yeoman-generator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ describe('Check yeoman generator works', () => {
.then((result) => {
result.assertFile(['hello-world/package.json']);
result.assertFileContent('hello-world/package.json', PACKAGE_JSON_EXPECTATION);
result.assertFile(['hello-world/.vscode/tasks.json']);
result.assertFileContent('hello-world/.vscode/tasks.json', TASKS_JSON_EXPECTATION);
});
context.cleanup(); // clean-up
}, 120_000);
Expand Down Expand Up @@ -97,3 +99,27 @@ normalizeEOL(`{
"typescript": "~4.9.5"
}
}`);

const TASKS_JSON_EXPECTATION =
normalizeEOL(`{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build hello-world",
"command": "npm run langium:generate && npm run build",
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Langium: Generate grammar and build the hello-world language",
"icon": {
"color": "terminal.ansiGreen",
"id": "server-process"
}
}
]
}
`);

0 comments on commit 194c47d

Please sign in to comment.