Skip to content

Commit

Permalink
fix for backwards compatibility with sbe
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephAbbey committed Sep 4, 2023
1 parent 9870369 commit ff746f5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion scratch-vhdl-vscode/sbe.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@
"entity",
"signals",
"constants",
"aliases"
"aliases",
"libraries"
],
"additionalProperties": false
}
Expand Down
2 changes: 1 addition & 1 deletion scratch-vhdl-vscode/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export type WebviewToBackMessageResponse = (
export interface Entity {
name?: string;
entity: Record<string, [string, string]>;
signals: Record<string, [string, string]>;
signals: Record<string, string | [string, string]>;
constants: Record<string, [string, string]>;
aliases: Record<string, string>;
command?: string;
Expand Down
8 changes: 6 additions & 2 deletions scratch-vhdl-vscode/src/webview/VHDLGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,12 @@ export function generate(
'\n signal ' +
n +
' : ' +
signals[n][0] +
(signals[n][1] ? ' := ' + signals[n][1] : '') +
(signals[n] instanceof Array
? signals[n][0] +
(signals[n][1] && signals[n][1] != ''
? ' := ' + signals[n][1]
: '')
: signals[n]) +
';'
)
.join('');
Expand Down
4 changes: 3 additions & 1 deletion scratch-vhdl-vscode/src/webview/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,9 @@ Blockly.ContextMenuRegistry.registry.register({
editable(
grid,
['Name', 'Type', 'Initial'],
Object.entries(entity.signals).map(([x, y]) => [x, ...y])
Object.entries(entity.signals).map(([x, y]) =>
y instanceof Array ? [x, ...y] : [x, y, '']
)
);
modal.addEventListener('close', () => {
modal.remove();
Expand Down

0 comments on commit ff746f5

Please sign in to comment.