-
Notifications
You must be signed in to change notification settings - Fork 5
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 #2 from matheuslenke/develop
Feat: Extension with Code Actions, exporting, importing and tests
- Loading branch information
Showing
131 changed files
with
20,913 additions
and
6,277 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,12 @@ | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
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 @@ | ||
node_modules |
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 |
---|---|---|
@@ -1,13 +1,62 @@ | ||
{ | ||
"root": true, | ||
"env": { | ||
"es2021": true, | ||
"node": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"overrides": [ | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"ecmaVersion": "latest", | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"ignorePatterns": [ | ||
"**/{node_modules,lib,bin}" | ||
], | ||
"rules": { | ||
"indent": [ | ||
"error", | ||
2 | ||
], | ||
"linebreak-style": [ | ||
"error", | ||
"unix" | ||
], | ||
"quotes": [ | ||
"error", | ||
"double" | ||
], | ||
"semi": [ | ||
"error", | ||
"always" | ||
], | ||
// List of [@typescript-eslint rules](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#supported-rules) | ||
"@typescript-eslint/adjacent-overload-signatures": "error", // grouping same method names | ||
"@typescript-eslint/array-type": ["error", { // string[] instead of Array<string> | ||
"default": "array-simple" | ||
}], | ||
"@typescript-eslint/ban-types": "error", // bans types like String in favor of string | ||
"@typescript-eslint/no-inferrable-types": "off", // don't blame decls like "index: number = 0", esp. in api signatures! | ||
"@typescript-eslint/indent": "off", // consistent indentation | ||
"@typescript-eslint/no-explicit-any": "off", // don't use :any type | ||
"@typescript-eslint/no-misused-new": "error", // no constructors for interfaces or new for classes | ||
"@typescript-eslint/no-namespace": "off", // disallow the use of custom TypeScript modules and namespaces | ||
"@typescript-eslint/no-non-null-assertion": "off", // allow ! operator | ||
"@typescript-eslint/no-parameter-properties": "error", // no property definitions in class constructors | ||
"@typescript-eslint/no-unused-vars": ["warn", { // disallow Unused Variables | ||
"argsIgnorePattern": "^_" | ||
}], | ||
"@typescript-eslint/no-var-requires": "error", // use import instead of require | ||
"@typescript-eslint/prefer-for-of": "error", // prefer for-of loop over arrays | ||
"@typescript-eslint/prefer-namespace-keyword": "error", // prefer namespace over module in TypeScript | ||
"@typescript-eslint/triple-slash-reference": "error", // ban /// <reference />, prefer imports | ||
"@typescript-eslint/type-annotation-spacing": "error" // consistent space around colon ':' | ||
} | ||
} |
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 |
---|---|---|
|
@@ -6,4 +6,9 @@ lib/ | |
coverage | ||
*.tsbuildinfo | ||
|
||
*.vsix | ||
*.vsix | ||
|
||
**/generated/*.tonto | ||
**/generated/*.json | ||
|
||
.yarn |
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
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 |
---|---|---|
@@ -1,33 +1,71 @@ | ||
//@ts-check | ||
const watch = process.argv.includes('--watch'); | ||
const minify = process.argv.includes('--minify'); | ||
const success = watch ? 'Watch build succeeded' : 'Build succeeded'; | ||
const watch = process.argv.includes("--watch"); | ||
const minify = process.argv.includes("--minify"); | ||
const successExtension = watch | ||
? "Watch build Extension succeeded" | ||
: "Build Extension succeeded"; | ||
const successCli = watch ? "Watch build CLI succeeded" : "Build CLI succeeded"; | ||
|
||
function getTime() { | ||
const date = new Date(); | ||
return `[${`${padZeroes(date.getHours())}:${padZeroes(date.getMinutes())}:${padZeroes(date.getSeconds())}`}] `; | ||
return `[${`${padZeroes(date.getHours())}:${padZeroes( | ||
date.getMinutes() | ||
)}:${padZeroes(date.getSeconds())}`}] `; | ||
} | ||
|
||
function padZeroes(i) { | ||
return i.toString().padStart(2, '0'); | ||
return i.toString().padStart(2, "0"); | ||
} | ||
|
||
require('esbuild').build({ | ||
const esbuild = require("esbuild"); | ||
|
||
/** | ||
* This is the entry point for building the Extension | ||
*/ | ||
esbuild | ||
.build({ | ||
// Two entry points, one for the extension, one for the language server | ||
entryPoints: ['src/extension.ts', 'src/language-server/main.ts'], | ||
outdir: 'out', | ||
bundle: true, | ||
loader: { '.ts': 'ts' }, | ||
external: ['vscode'], // the vscode-module is created on-the-fly and must be excluded. | ||
platform: 'node', // VSCode extensions run in a node process | ||
sourcemap: true, | ||
watch: watch ? { | ||
onRebuild(error) { | ||
if (error) console.error(`${getTime()}Watch build failed`) | ||
else console.log(`${getTime()}${success}`) | ||
} | ||
} : false, | ||
minify | ||
}) | ||
.then(() => console.log(`${getTime()}${success}`)) | ||
.catch(() => process.exit(1)); | ||
entryPoints: ["src/extension.ts", "src/language-server/main.ts"], | ||
outdir: "out", | ||
bundle: true, | ||
external: ["vscode"], // the vscode-module is created on-the-fly and must be excluded. | ||
platform: "node", // VSCode extensions run in a node process | ||
sourcemap: !minify, | ||
watch: watch | ||
? { | ||
onRebuild(error) { | ||
if (error) console.error("Watch build failed"); | ||
else console.log(successExtension); | ||
}, | ||
} | ||
: false, | ||
minify, | ||
}) | ||
.then(() => console.log(`${getTime()}${successExtension}`)) | ||
.catch(() => process.exit(1)); | ||
|
||
/** | ||
* This is the entry point for building the CLI | ||
*/ | ||
esbuild | ||
.build({ | ||
entryPoints: ["src/cli/index.ts"], | ||
outdir: "out/cli", | ||
bundle: true, | ||
loader: { ".ts": "ts" }, | ||
external: ["vscode"], // the vscode-module is created on-the-fly and must be excluded. | ||
platform: "node", // VSCode extensions run in a node process | ||
sourcemap: true, | ||
minifyIdentifiers: false, | ||
watch: watch | ||
? { | ||
onRebuild(error) { | ||
if (error) console.error(`${getTime()}Watch build failed`); | ||
else console.log(`${getTime()}${successCli}`); | ||
}, | ||
} | ||
: false, | ||
minify, | ||
}) | ||
.then(() => console.log(`${getTime()}${successCli}`)) | ||
.catch(() => process.exit(1)); |
File renamed without changes.
38 changes: 12 additions & 26 deletions
38
examples/basic-examples/Marriage.tonto → examples/basicExamples/Marriage.tonto
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 |
---|---|---|
@@ -1,48 +1,34 @@ | ||
module MarriageModule { | ||
kind Person | ||
|
||
relator SocialRelator | ||
category SocialRelator of relators | ||
relator SocialRelatorType specializes SocialRelator | ||
kind MarriageDuty | ||
kind MarriageRight specializes Marriage | ||
|
||
role Spouse specializes Person { | ||
-- isBoundBy -- Marriage inverseOf involvesSpouse | ||
} | ||
|
||
relator Marriage (instanceOf SocialRelatorType) specializes SocialRelator | ||
ref Marriage -- involvesSpouse -- [2..*] Spouse | ||
ref Marriage <>-- [1..*] MarriageDuty | ||
|
||
ref Marriage -- [2..*] Spouse | ||
ref Marriage <>-- [1..*] MarriageDuty | ||
ref Marriage <>-- [1..*] MarriageRight | ||
relation Marriage -- involvesSpouse -- [2..*] Spouse | ||
relation Marriage <>-- [1..*] MarriageDuty | ||
relation Marriage -- [2..*] Spouse | ||
relation Marriage <>-- [1..*] MarriageDuty | ||
relation Marriage <>-- [1..*] MarriageRight | ||
// relation Person (pai {const}) [1] -- temFilhos -- [*] Person (filho) | ||
} | ||
|
||
module MarriageModuleCopy { | ||
kind Person | ||
|
||
relator SocialRelator | ||
relator SocialRelatorType specializes SocialRelator | ||
|
||
role Spouse specializes Person { | ||
[1..*] -- isBoundBy --[2] Marriage inverseOf involvesSpouse | ||
} | ||
|
||
kind MarriageDuty | ||
kind MarriageRight | ||
|
||
|
||
relator Marriage specializes SocialRelatorType | ||
|
||
ref Marriage -- involvesSpouse -- [2..*] Spouse | ||
ref Marriage <>-- [1..*] MarriageDuty | ||
|
||
ref Marriage -- [2..*] Spouse | ||
ref Marriage <>-- [1..*] MarriageDuty | ||
ref Marriage <>-- [1..*] MarriageRight | ||
relation Marriage -- involvesSpouse -- [2..*] Spouse | ||
relation Marriage <>-- [1..*] MarriageDuty | ||
relation Marriage -- [2..*] Spouse | ||
relation Marriage <>-- [1..*] MarriageDuty | ||
relation Marriage <>-- [1..*] MarriageRight | ||
} | ||
|
||
module Teste { | ||
|
||
} |
File renamed without changes.
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,8 @@ | ||
module School { | ||
kind Pessoa | ||
kind Organizacao | ||
subkind Escola specializes Organizacao | ||
role Estudante specializes Pessoa | ||
relation Organizacao -- temMembro -- Pessoa | ||
relation Estudante -- estudaEm -- Escola | ||
} |
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
Oops, something went wrong.