Skip to content

Commit

Permalink
Cosimstudio rework error reporting (#192)
Browse files Browse the repository at this point in the history
* Add Prettier config and format entire workspace

* Replace console.error with extension logger from and update logger mock

* Improve error reporting in Maestro integration

* Update TODOS to reflect changes

* Update TODOS

Fix incorrect reference to icon in package.json

* Disable extensions when running extension host

* Replace all uses of node fs with vscode.workspace.fs

* Fix bug where a succesful simulation was displayed as failed

* Lint on construction of linter and whenever active editor changes

* Update CHANGELOG and bump patch version

* Global format

* Fix of invalid URI being passed to Maestro on Windows

* Fixed linting causality rule did not apply to inputs

* Move unreleased changelog to version 0.1.2

* Make prettier default formatter

* Clean up Maestro error messages

---------

Co-authored-by: Markus Ellyton <[email protected]>
  • Loading branch information
prasadtalasila and MarkusEllyton authored Oct 25, 2024
1 parent fc435e5 commit 508d7a0
Show file tree
Hide file tree
Showing 41 changed files with 10,198 additions and 9,885 deletions.
44 changes: 21 additions & 23 deletions .devcontainer/basic/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
{
"name": "Basic Dev",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
// "image": "mcr.microsoft.com/devcontainers/typescript-node:1-22-bookworm",
"build": {
"dockerfile": "../Dockerfile",
"target": "cosim_basic"
},
"name": "Basic Dev",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
// "image": "mcr.microsoft.com/devcontainers/typescript-node:1-22-bookworm",
"build": {
"dockerfile": "../Dockerfile",
"target": "cosim_basic"
},

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {},
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "java -version"
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "java -version"

// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"connor4312.esbuild-problem-matchers"
]
}
}
// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": ["connor4312.esbuild-problem-matchers"]
}
}

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
45 changes: 21 additions & 24 deletions .devcontainer/example_workspace/cosim.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
{
"fmus": {
"{msd1}": "fmus/MassSpringDamper1.fmu",
"fmus": {
"{msd1}": "fmus/MassSpringDamper1.fmu",
"{msd2}": "fmus/MassSpringDamper2.fmu"
},
"connections": {
},
"connections": {
"{msd1}.msd1i.x1": ["{msd2}.msd2i.x1"],
"{msd1}.msd1i.v1": ["{msd2}.msd2i.v1"]
},
"logVariables": {
"{msd2}.msd2i": [
"x2",
"v2"
]
},
"parameters": {
"{msd2}.msd2i.c2": 1.0,
"{msd2}.msd2i.cc": 1.0,
"{msd2}.msd2i.d2": 1.0,
"{msd2}.msd2i.dc": 1.0,
"{msd2}.msd2i.m2": 1.0
},
"algorithm": {
"type": "fixed-step",
"size": 0.001
},
"loggingOn": false,
"overrideLogLevel": "INFO"
}
"logVariables": {
"{msd2}.msd2i": ["x2", "v2"]
},
"parameters": {
"{msd2}.msd2i.c2": 1.0,
"{msd2}.msd2i.cc": 1.0,
"{msd2}.msd2i.d2": 1.0,
"{msd2}.msd2i.dc": 1.0,
"{msd2}.msd2i.m2": 1.0
},
"algorithm": {
"type": "fixed-step",
"size": 0.001
},
"loggingOn": false,
"overrideLogLevel": "INFO"
}
58 changes: 28 additions & 30 deletions .devcontainer/full/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,37 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
{
"name": "Full Dev w. Maestro",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
// "image": "mcr.microsoft.com/devcontainers/typescript-node:1-22-bookworm",
"build": {
"dockerfile": "../Dockerfile",
"target": "cosim_with_maestro"
},
"containerEnv": {
"MAESTRO_WEBAPI_PATH": "/home/node/maestro_home/maestro-webapi.jar"
},
"name": "Full Dev w. Maestro",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
// "image": "mcr.microsoft.com/devcontainers/typescript-node:1-22-bookworm",
"build": {
"dockerfile": "../Dockerfile",
"target": "cosim_with_maestro"
},
"containerEnv": {
"MAESTRO_WEBAPI_PATH": "/home/node/maestro_home/maestro-webapi.jar"
},

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/java:1": {
"java": "test"
}
},
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/java:1": {
"java": "test"
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "java -version",
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "java -version",

// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"connor4312.esbuild-problem-matchers"
]
}
}
// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": ["connor4312.esbuild-problem-matchers"]
}
}

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* text=auto
* text=auto eol=lf
2 changes: 1 addition & 1 deletion .mocha.unit.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"spec": "./dist/test/**/*.unit.test.js"
}
}
10 changes: 3 additions & 7 deletions .nycrc.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"all": true,
"include": [
"src/**/*.ts", "dist/ext/**/*.js"
],
"exclude": [
"test/**/*.ts", "dist/test/**/*.js"
],
"include": ["src/**/*.ts", "dist/ext/**/*.js"],
"exclude": ["test/**/*.ts", "dist/test/**/*.js"],
"exclude-node-modules": true
}
}
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules/
dist/
coverage/
.nyc_output/
*.vsix
*.md
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 4,
"semi": false,
"singleQuote": true
}
20 changes: 10 additions & 10 deletions .vscode-test.mjs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { defineConfig } from "@vscode/test-cli";
import { fileURLToPath } from "url";
import { dirname, join } from "path";
import { defineConfig } from '@vscode/test-cli'
import { fileURLToPath } from 'url'
import { dirname, join } from 'path'

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)

export default defineConfig({
tests: [
{
files: "dist/test/**/*.spec.js",
files: 'dist/test/**/*.spec.js',
extensionDevelopmentPath: __dirname,
srcDir: "dist/ext"
}
srcDir: 'dist/ext',
},
],
coverage: {
includeAll: true,
exclude: [join(__dirname, "dist/test")]
exclude: [join(__dirname, 'dist/test')],
},
});
})
6 changes: 2 additions & 4 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"recommendations": [
"ms-vscode-remote.remote-containers"
]
}
"recommendations": ["ms-vscode-remote.remote-containers"]
}
52 changes: 25 additions & 27 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,29 @@
// 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}"
],
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Run Extension with Maestro",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "esbuild-watch and maestro-up"
}
]
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--disable-extensions"
],
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Run Extension with Maestro",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--disable-extensions"
],
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"preLaunchTask": "esbuild-watch and maestro-up"
}
]
}
12 changes: 11 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,15 @@
"out": true // set this to false to include "out" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off"
"typescript.tsc.autoDetect": "off",
"editor.formatOnSave": true,
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
}
13 changes: 5 additions & 8 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"type": "npm",
"script": "maestro-up",
"presentation": {
"reveal": "never",
"reveal": "never"
},
"isBackground": true,
"problemMatcher": {
Expand All @@ -41,14 +41,11 @@
"endsPattern": "Starting ProtocolHandler"
}
},
"label": "npm: maestro-up",
"label": "npm: maestro-up"
},
{
"label": "esbuild-watch and maestro-up",
"dependsOn": [
"npm: esbuild:watch",
"npm: maestro-up"
]
},
"dependsOn": ["npm: esbuild:watch", "npm: maestro-up"]
}
]
}
}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),

## [Unreleased]

## [0.1.2] - 2024-10-03

### Fixed

- Linting: causality rule did not apply to inputs.
- Linting: references to valid FMU files were detected as invalid on Windows.
- Simulation: running a simulation on Windows would cause an error as the paths to the FMUs were invalid.

### Changed

- All error reporting and information about a running simulation has been moved to the output channel rather than a notification.

## [0.1.1] - 2024-08-30

Expand Down
Loading

0 comments on commit 508d7a0

Please sign in to comment.