Skip to content

Commit

Permalink
Merge pull request #11 from nanangp/wireviz0.4
Browse files Browse the repository at this point in the history
Version 1.1.0 to support Wireviz 0.4
  • Loading branch information
nanangp authored May 24, 2024
2 parents 8ace9e9 + 5e5d3f2 commit bf97c91
Show file tree
Hide file tree
Showing 10 changed files with 262 additions and 2,774 deletions.
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"connor4312.esbuild-problem-matchers"
]
}
4 changes: 2 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"script": "esbuild-watch",
"problemMatcher": "$esbuild-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## [1.1.0] - 2024-05-24
- [new] Supports WireViz 0.4.x. Will not work with 0.3 or prior.
- [new] Ability to supply some custom cmdline arg values when invoking wireviz.
- [fix] Error when generating preview in quick succession (e.g. tapping F8 multiple times).

## [1.0.1] - 2024-03-07
- [fix] Don't destroy panel when previewing files outside workspace. This should also fix #4

Expand Down
24 changes: 9 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,23 @@ A simple extension for Visual Studio Code to preview WireViz YAML files.

## Prerequisites
- Install extension from the [VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=NanangP.vscode-wireviz-preview) - or build from source.
- [WireViz](https://github.com/wireviz/WireViz) 0.3.2 or later; which requires [Python](https://www.python.org/downloads/) 3.7 or later, and [Graphviz](https://graphviz.org/download/)
- [WireViz](https://github.com/wireviz/WireViz) **0.4.0** or later; which requires [Python](https://www.python.org/downloads/) 3.7 or later, and [Graphviz](https://graphviz.org/download/)

## Running
1. Open a WireViz YAML file.
2. Use the `WireViz: Preview` button on the editor toolbar (right of tabs),
or using the default <kbd>F8</kbd> shortcut key.
4. Once the preview is open, it will refresh every time you save the file.
4. Once the preview is open, it will refresh every time you save the file.
This behaviour can be disabled by setting `"wireviz.refreshPreviewOnSave": false`.

## Configuration
The first (bolded) of the "Possible values" is the default if unspecified.
| Config UI | settings.json | Possible values | Description |
| --------- | ------------- | --------------- | ----------- |
| Refresh Preview On Save | `wireviz.refreshPreviewOnSave` | **`true`**, `false` | Automatically refreshes preview on document save. |
| Output Path | `wireviz.outputPath` | **`"output"`**, `null` | When set, generates output files in an `/output` subdirectory. When `null`, output to the same location as the input file. |
| Preview Format | `wireviz.previewFormat` | **`"svg"`**, `"png"` | Selects output file to be displayed in the preview window. |


## ⚠ Limitations
- If you have an external image in your wire harness (i.e. an `image:` node),
you need to set:
- `"wireviz.previewFormat": "png"` (the WebView in VSCode won't show images on an SVG), and
- `"wireviz.outputPath": null` (WireViz v0.3.2 [throws an error](https://github.com/wireviz/WireViz/issues/284) outputting to a path other than the source, if you use images)
Open VSCode settings, filter for `WireViz`. You'll find settings for command-line args to specify, and a couple extension-specific settings.

## Troubleshooting
- Please make sure you're running WireViz 0.4 or above. Their new command line options are incompatible with 0.3 and below.
- If you are running into issues after upgrading to WireViz 0.4, try running WireViz against your input file from the terminal:
- If it works on the terminal but not through the extension, please report it as a new issue here.
- If the terminal also throws an error, please downgrade WireViz to `0.3`, and [downgrade this extension](https://code.visualstudio.com/updates/v1_30#_install-previous-versions) to `1.0.x`, and wait until they fix it.

## Changelog
See [CHANGELOG.md](CHANGELOG.md)
Expand Down
30 changes: 26 additions & 4 deletions examples/demo02.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
metadata:

title: WireViz Demo 2
pn: WV-DEMO-02

authors:
Created:
name: D. Rojas
date: 2020-05-20
Approved:
name: D. Rojas
date: 2020-05-20

revisions:
A:
name: D. Rojas
date: 2020-10-17
changelog: WireViz 0.2 release

template:
name: din-6771
sheetsize: A3

templates: # defining templates to be used later on
- &molex_f
type: Molex KK 254
Expand All @@ -22,17 +45,16 @@ connectors:
X4:
<<: *molex_f
pinlabels: [GND, +12V, MISO, MOSI, SCK]
ferrule_crimp:
F:
style: simple
autogenerate: true
type: Crimp ferrule
subtype: 0.25 mm²
color: YE

cables:
W1:
<<: *wire_i2c
length: 0.12
length: 0.2
show_equiv: true
W2:
<<: *wire_i2c
Expand Down Expand Up @@ -64,6 +86,6 @@ connections:
- W3: [1-4]
- X4: [1,3-5]
-
- ferrule_crimp
- F.
- W4: [1,2]
- X4: [1,2]
7 changes: 3 additions & 4 deletions examples/ex04.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ cables:
category: bundle

connectors:
ferrule_crimp:
F:
style: simple
autogenerate: true
type: Crimp ferrule

connections:
-
- ferrule_crimp
- F.
- W1: [1-6]
- ferrule_crimp
- F.
Loading

0 comments on commit bf97c91

Please sign in to comment.