Skip to content

Commit

Permalink
Merge pull request #13 from matheuslenke/feature/T12-create-tonto-theme
Browse files Browse the repository at this point in the history
[T12] Feature: create tonto theme
  • Loading branch information
matheuslenke authored May 4, 2024
2 parents 1e59668 + ef37d91 commit 3e288f5
Show file tree
Hide file tree
Showing 56 changed files with 3,536 additions and 928 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
],
"rules": {
"indent": "off",
"@typescript-eslint/indent": ["error"],
"@typescript-eslint/indent": ["off", {}],
"linebreak-style": [
"error",
"unix"
Expand Down
14 changes: 13 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,16 @@ coverage

packages/tonto-vscode/data/tonto-tmLanguage.json

**/tonto_dependencies
**/tonto_dependencies

.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/
7 changes: 1 addition & 6 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,7 @@
"skipFiles": [
"<node_internals>/**"
],
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/packages/tonto/lib/**/*.js",
"${workspaceFolder}/packages/tonto/lib/cli/**/*.js",
"${workspaceFolder}/packages/tonto-vscode/out/**/*.js"
]
"sourceMaps": true
},
{
"name": "Attach to CLI",
Expand Down
10 changes: 10 additions & 0 deletions examples/newGeneration/tokens.tonto
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package CheckGeneralizationConsistency
kind Person
role Doctor specializes Person

relation Doctor -- treats -- Person

genset GeneralizationSet {
general Person
specifics Doctor.treats
}
1,092 changes: 802 additions & 290 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"private": true,
"engineStrict": true,
"description": "Tonto is a DSL for creating OntoUML models",
"version": "0.3.0",
"version": "0.3.4",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
71 changes: 0 additions & 71 deletions packages/tonto-vscode/data/tonto.tmLanguage.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/tonto-vscode/esbuild.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const ctx = await esbuild.context({
loader: { ".ts": "ts" },
external: ["vscode"],
platform: "node",
sourcemap: !minify,
sourcemap: true,
minify,
plugins
});
Expand Down
30 changes: 25 additions & 5 deletions packages/tonto-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Tonto",
"publisher": "Lenke",
"description": "Tonto is a DSL for creating OntoUML models",
"version": "0.3.2",
"version": "0.3.4",
"license": "MIT",
"icon": "data/images/TontoIcon.png",
"type": "module",
Expand All @@ -21,6 +21,18 @@
],
"main": "./out/extension/main.cjs",
"contributes": {
"themes": [
{
"label": "Tonto Light",
"uiTheme": "vs",
"path": "./src/themes/Tonto-color-theme.json"
},
{
"label": "Tonto Dark",
"uiTheme": "vs",
"path": "./src/themes/Tonto-dark-color-theme.json"
}
],
"languages": [
{
"id": "tonto",
Expand All @@ -38,7 +50,7 @@
{
"language": "tonto",
"scopeName": "source.tonto",
"path": "./data/tonto.tmLanguage.json"
"path": "./syntaxes/tonto.tmLanguage.json"
}
],
"commands": [
Expand Down Expand Up @@ -148,22 +160,30 @@
"clean": "rimraf out",
"lint": "eslint src --ext ts",
"lint:fix": "eslint src --ext ts --fix",
"build": "node ./esbuild.mjs",
"build": "tsc -b tsconfig.json && node ./esbuild.mjs",
"build:worker": "esbuild --minify ./out/language/main-browser.cjs --bundle --format=iife --outfile=./public/tonto-server-worker.js",
"build:monarch": "tsc -b tsconfig.monarch.json",
"build:web": "npm run build && npm run prepare:public && npm run build:worker && node scripts/copy-monaco-assets.mjs",
"watch": "node ./esbuild.mjs --watch",
"coverage": "vitest run --coverage",
"langium:generate": "langium generate",
"langium:watch": "langium generate --watch",
"publish:npm": "npm publish --access public"
"publish:npm": "npm publish --access public",
"prepare:public": "node scripts/prepare-public.mjs"
},
"dependencies": {
"chalk": "^5.3.0",
"commander": "^11.0.0",
"langium": "^3.0.0",
"monaco-editor": "npm:@codingame/monaco-editor-treemended@1.83.16",
"monaco-editor-workers": "^0.45.0",
"monaco-editor-wrapper": "^4.0.2",
"monaco-languageclient": "^8.1.1",
"node-fetch-native": "^1.6.2",
"nomnoml": "^1.6.2",
"prettier": "^3.2.5",
"rimraf": "^4.1.2",
"tonto-cli": "0.3.1",
"tonto-cli": "file:../tonto",
"tonto-package-manager": "~0.2.9",
"uuid": "^9.0.1",
"vscode-languageclient": "^9.0.1",
Expand Down
20 changes: 20 additions & 0 deletions packages/tonto-vscode/scripts/bundle.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import getEditorServiceOverride from "@codingame/monaco-vscode-editor-service-override";
import getKeybindingsServiceOverride from "@codingame/monaco-vscode-keybindings-service-override";
import { MonacoEditorLanguageClientWrapper } from "monaco-editor-wrapper";
import { addMonacoStyles } from "monaco-editor-wrapper/styles";
import { useOpenEditorStub } from "monaco-languageclient";

export const defineUserServices = () => {
return {
userServices: {
...getEditorServiceOverride(useOpenEditorStub),
...getKeybindingsServiceOverride()
},
debugLogging: true
};
};
export {
MonacoEditorLanguageClientWrapper, addMonacoStyles, getEditorServiceOverride,
getKeybindingsServiceOverride
};

19 changes: 19 additions & 0 deletions packages/tonto-vscode/scripts/copy-monaco-assets.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import shell from "shelljs";

// copy workers to public
shell.mkdir("-p", "./public/monaco-editor-workers/workers");
shell.cp(
"-fr",
"./node_modules/monaco-editor-workers/dist/index.js",
"./public/monaco-editor-workers/index.js"
);
shell.cp(
"-fr",
"./node_modules/monaco-editor-workers/dist/workers/editorWorker-es.js",
"./public/monaco-editor-workers/workers/editorWorker-es.js"
);
shell.cp(
"-fr",
"./node_modules/monaco-editor-workers/dist/workers/editorWorker-iife.js",
"./public/monaco-editor-workers/workers/editorWorker-iife.js"
);
16 changes: 16 additions & 0 deletions packages/tonto-vscode/scripts/prepare-public.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import * as esbuild from "esbuild";
import shell from "shelljs";

// setup & copy over css & html to public
shell.mkdir("-p", "./public");
shell.cp("-fr", "./src/static/*.css", "./public/");
shell.cp("-fr", "./src/static/*.html", "./public");

// bundle minilogo.ts, and also copy to public
await esbuild.build({
entryPoints: ["./src/static/minilogo.ts"],
minify: true,
sourcemap: true,
bundle: true,
outfile: "./public/minilogo.js",
});
1 change: 0 additions & 1 deletion packages/tonto-vscode/src/extension/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ let outputChannel: vscode.OutputChannel;

// This function is called when the extension is activated.
export function activate(context: vscode.ExtensionContext): void {

outputChannel = vscode.window.createOutputChannel("Tonto: Validation output");
TontoLibraryFileSystemProvider.register(context);
client = startLanguageClient(context);
Expand Down
6 changes: 5 additions & 1 deletion packages/tonto-vscode/src/language/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ import { PartialLangiumSharedServices, startLanguageServer } from "langium/lsp";
import { NodeFileSystem } from "langium/node";
import { TontoSharedServices, createTontoServices } from "tonto-cli";
import { ProposedFeatures, createConnection } from "vscode-languageserver/node.js";
import { TontoLanguageServer } from "../../../tonto/src/language/lsp/tonto-language-server.js";
import { TontoGrammarWorkspaceManager } from "./tonto-workspace-manager.js";

// Create a connection to the client
const connection = createConnection(ProposedFeatures.all);

export const TontoSharedModule: Module<TontoSharedServices, PartialLangiumSharedServices> = {
workspace: {
WorkspaceManager: (services) => new TontoGrammarWorkspaceManager(services)
WorkspaceManager: (services) => new TontoGrammarWorkspaceManager(services),
},
lsp: {
LanguageServer: (services) => new TontoLanguageServer(services)
}
};

Expand Down
Loading

0 comments on commit 3e288f5

Please sign in to comment.