-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from ace-design/langium
Overriding CI to propeare for CI makeover + streamlining releasing process. Not ideal, but decent tradeoff.
- Loading branch information
Showing
35 changed files
with
7,914 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"rules": { | ||
} | ||
} |
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,33 @@ | ||
name: generate grammar and build the jpipe language | ||
on: | ||
push: | ||
paths: | ||
- 'langium/**' | ||
jobs: | ||
create-server-file: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
- name: Complete Installs | ||
run: | | ||
npm install | ||
npm install -g @vscode/vsce | ||
rm vsce | ||
ln -s ./node_modules/@vscode/vsce/vsce ./vsce | ||
- name: Build language | ||
run: /bin/bash '-c' 'npm run langium:generate && npm run build' | ||
- name: Package vsix | ||
run: | | ||
mkdir -p build | ||
./vsce package --out build | ||
- name: Upload Artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: vsix file | ||
path: build/*.vsix | ||
|
||
|
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,11 @@ | ||
.vscode/* | ||
!.vscode/extensions.json | ||
!.vscode/launch.json | ||
!.vscode/tasks.json | ||
node_modules/ | ||
out/ | ||
src/language/generated/ | ||
static/bundle/ | ||
static/monaco-editor-workers/ | ||
static/worker/ | ||
syntaxes/ |
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,4 @@ | ||
.vscode/** | ||
.vscode-test/** | ||
.gitignore | ||
langium-quickstart.md |
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,4 @@ | ||
#!/usr/bin/env node | ||
|
||
import main from '../out/cli/main.js'; | ||
main(); |
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,54 @@ | ||
//@ts-check | ||
import * as esbuild from 'esbuild'; | ||
|
||
const watch = process.argv.includes('--watch'); | ||
const minify = process.argv.includes('--minify'); | ||
|
||
const success = watch ? 'Watch build succeeded' : 'Build succeeded'; | ||
|
||
function getTime() { | ||
const date = new Date(); | ||
return `[${`${padZeroes(date.getHours())}:${padZeroes(date.getMinutes())}:${padZeroes(date.getSeconds())}`}] `; | ||
} | ||
|
||
function padZeroes(i) { | ||
return i.toString().padStart(2, '0'); | ||
} | ||
|
||
const plugins = [{ | ||
name: 'watch-plugin', | ||
setup(build) { | ||
build.onEnd(result => { | ||
if (result.errors.length === 0) { | ||
console.log(getTime() + success); | ||
} | ||
}); | ||
}, | ||
}]; | ||
|
||
const ctx = await esbuild.context({ | ||
// Entry points for the vscode extension and the language server | ||
entryPoints: ['src/extension/main.ts', 'src/language/main.ts'], | ||
outdir: 'out', | ||
bundle: true, | ||
target: "ES2017", | ||
// VSCode's extension host is still using cjs, so we need to transform the code | ||
format: 'cjs', | ||
// To prevent confusing node, we explicitly use the `.cjs` extension | ||
outExtension: { | ||
'.js': '.cjs' | ||
}, | ||
loader: { '.ts': 'ts' }, | ||
external: ['vscode'], | ||
platform: 'node', | ||
sourcemap: !minify, | ||
minify, | ||
plugins | ||
}); | ||
|
||
if (watch) { | ||
await ctx.watch(); | ||
} else { | ||
await ctx.rebuild(); | ||
ctx.dispose(); | ||
} |
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,12 @@ | ||
{ | ||
"projectName": "Jpipe", | ||
"languages": [{ | ||
"id": "jpipe", | ||
"grammar": "src/language/jpipe.langium", | ||
"fileExtensions": [".jd"], | ||
"textMate": { | ||
"out": "syntaxes/jpipe.tmLanguage.json" | ||
} | ||
}], | ||
"out": "src/language/generated" | ||
} |
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,40 @@ | ||
# Welcome to your Langium VS Code Extension | ||
|
||
## What's in the folder | ||
|
||
This folder contains all necessary files for your language extension. | ||
* `package.json` - the manifest file in which you declare your language support. | ||
* `language-configuration.json` - the language configuration used in the VS Code editor, defining the tokens that are used for comments and brackets. | ||
* `src/extension/main.ts` - the main code of the extension, which is responsible for launching a language server and client. | ||
* `src/language/jpipe.langium` - the grammar definition of your language. | ||
* `src/language/main.ts` - the entry point of the language server process. | ||
* `src/language/jpipe-module.ts` - the dependency injection module of your language implementation. Use this to register overridden and added services. | ||
* `src/language/jpipe-validator.ts` - an example validator. You should change it to reflect the semantics of your language. | ||
* `src/cli/main.ts` - the entry point of the command line interface (CLI) of your language. | ||
* `src/cli/generator.ts` - the code generator used by the CLI to write output files from DSL documents. | ||
* `src/cli/cli-util.ts` - utility code for the CLI. | ||
|
||
## Get up and running straight away | ||
|
||
* Run `npm run langium:generate` to generate TypeScript code from the grammar definition. | ||
* Run `npm run build` to compile all TypeScript code. | ||
* Press `F5` to open a new window with your extension loaded. | ||
* Create a new file with a file name suffix matching your language. | ||
* Verify that syntax highlighting, validation, completion etc. are working as expected. | ||
* Run `node ./bin/cli` to see options for the CLI; `node ./bin/cli generate <file>` generates code for a given DSL file. | ||
|
||
## Make changes | ||
|
||
* Run `npm run watch` to have the TypeScript compiler run automatically after every change of the source files. | ||
* Run `npm run langium:watch` to have the Langium generator run automatically after every change of the grammar declaration. | ||
* You can relaunch the extension from the debug toolbar after making changes to the files listed above. | ||
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes. | ||
|
||
## Install your extension | ||
|
||
* To start using your extension with VS Code, copy it into the `<user home>/.vscode/extensions` folder and restart Code. | ||
* To share your extension with the world, read the [VS Code documentation](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) about publishing an extension. | ||
|
||
## To Go Further | ||
|
||
Documentation about the Langium framework is available at https://langium.org |
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,30 @@ | ||
{ | ||
"comments": { | ||
// symbol used for single line comment. Remove this entry if your language does not support line comments | ||
"lineComment": "//", | ||
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments | ||
"blockComment": [ "/*", "*/" ] | ||
}, | ||
// symbols used as brackets | ||
"brackets": [ | ||
["{", "}"], | ||
["[", "]"], | ||
["(", ")"] | ||
], | ||
// symbols that are auto closed when typing | ||
"autoClosingPairs": [ | ||
["{", "}"], | ||
["[", "]"], | ||
["(", ")"], | ||
["\"", "\""], | ||
["'", "'"] | ||
], | ||
// symbols that can be used to surround a selection | ||
"surroundingPairs": [ | ||
["{", "}"], | ||
["[", "]"], | ||
["(", ")"], | ||
["\"", "\""], | ||
["'", "'"] | ||
] | ||
} |
Oops, something went wrong.