forked from ejfasting/language-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated crmscript-langium to now support basic types and some scopes …
…for nested. Updated vscode extension to read client_id from a file, and refactored the authenticationService to be more dependency injection pattern
- Loading branch information
Eivind Fasting
committed
Jun 3, 2024
1 parent
feaa0c3
commit c7512d9
Showing
69 changed files
with
8,329 additions
and
1,386 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,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,11 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. | ||
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp | ||
|
||
// List of extensions which should be recommended for users of this workspace. | ||
"recommendations": [ | ||
"langium.langium-vscode", | ||
"ZixuanChen.vitest-explorer", | ||
"kingwl.vscode-vitest-runner" | ||
] | ||
} |
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,36 @@ | ||
// A launch configuration that launches the extension inside a new window | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Run Extension", | ||
"type": "extensionHost", | ||
"request": "launch", | ||
"args": [ | ||
"--extensionDevelopmentPath=${workspaceFolder}", | ||
"--folder-uri=${workspaceRoot}/examples" | ||
], | ||
"sourceMaps": true, | ||
"outFiles": [ | ||
"${workspaceFolder}/out/**/*.js" | ||
] | ||
}, | ||
{ | ||
"name": "Attach to Language Server", | ||
"type": "node", | ||
"port": 6009, | ||
"request": "attach", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
], | ||
"sourceMaps": true, | ||
"outFiles": [ | ||
"${workspaceFolder}/out/**/*.js", | ||
"${workspaceFolder}/node_modules/langium" | ||
] | ||
} | ||
] | ||
} |
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,21 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Build crmscript", | ||
"command": "npm run langium:generate && npm run build", | ||
"type": "shell", | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
}, | ||
"detail": "Langium: Generate grammar and build the crmscript language", | ||
"icon": { | ||
"color": "terminal.ansiGreen", | ||
"id": "server-process" | ||
} | ||
} | ||
] | ||
} |
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,2 @@ | ||
# langium-crmscript | ||
Language definition for CRMScript using Langium |
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(); | ||
} |
19 changes: 19 additions & 0 deletions
19
packages/langium-crmscript/examples/basic.crmscript-definition
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,19 @@ | ||
/** | ||
# String | ||
|
||
Summary goes here. | ||
|
||
I just love **bold text**. | ||
|
||
```crmscript | ||
|
||
String something = "Hello"; | ||
|
||
``` | ||
|
||
*/ | ||
class String { | ||
} | ||
|
||
String temp = ""; | ||
|
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,77 @@ | ||
|
||
|
||
// ///Should be invalid | ||
// Integer invalidSetInteger = "123"; | ||
// Integer invalidSetInteger2 = true; | ||
// String invalidSetString = 123; | ||
// String invalidSetString2 = true; | ||
// Bool invalidSetBool = "123"; | ||
// Bool invalidSetBool2 = 123; | ||
// Integer invalidSumInteger = 123 + "123"; | ||
|
||
// String myStringFunction() { | ||
// return 123; | ||
// } | ||
|
||
// Integer myIntegerFunction() { | ||
// return "123"; | ||
// } | ||
// //--------------------------------------- --------------------------------------- | ||
|
||
|
||
// /////Should be valid | ||
// "123"; | ||
// 13213; | ||
// true; | ||
// Bool validEmptyBool; | ||
// Bool validSetBool = true; | ||
// String validEmptyString; | ||
// String validSetString = "123"; | ||
// String validSumString = "123" + "123"; | ||
// Integer validEmptyInteger; | ||
// Integer validSetInteger = 123; | ||
// Integer validSumInteger = 123 + 123; | ||
|
||
// for(Integer i = 0; i > 20; i++){ | ||
// Integer j = i + 20; | ||
// String bla = "123" + 20; | ||
// } | ||
|
||
// String myStringFunction() { | ||
// return "123"; | ||
// } | ||
|
||
// Integer myIntegerFunction() { | ||
// return 123; | ||
// } | ||
|
||
|
||
// try{} | ||
// catch(exception){} | ||
|
||
|
||
// /** Hover*/ | ||
// //Builtin Class | ||
// Customer c; | ||
// c.firstName = "123"; | ||
|
||
// //--------------------------------------- --------------------------------------- | ||
|
||
// //--------------------------------------- Not working correctly --------------------------------------- | ||
// //Not working correctly | ||
// String invalidSumString = 123 + "123"; // <= This should be invalid, need to look at the validation of number + string | ||
// //TODO: Implement Structs | ||
// // struct myStruct { //Hover returned from the checkStructDeclaration validation method | ||
// // String structString; | ||
// // Integer structInt; | ||
// // Customer cust; | ||
// // String getString(){ | ||
// // this.structString = "1232"; // <= this keyword is not recognized as a NamedElement (?) | ||
// // return this.customerString; // Need to validate this is possible after the line above is working | ||
// // } | ||
// // }; | ||
|
||
// String temp = "123"; | ||
// Integer int = 123; | ||
|
||
// temp. |
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
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.