Skip to content

Commit a2e02bc

Browse files
committed
Minor Fixes
1 parent f27b93e commit a2e02bc

5 files changed

Lines changed: 10 additions & 12 deletions

File tree

client/src/webview/diagram.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ let startY = 0;
2121
* @param sm
2222
* @returns Mermaid diagram string
2323
*/
24-
export function createMermaidDiagram(sm: LJStateMachine, orientation: "LR" | "TB"): string {
24+
export function createMermaidDiagram(sm: LJStateMachine | undefined, orientation: "LR" | "TB"): string {
2525
if (!sm) return '';
2626

2727
const lines: string[] = [];

client/src/webview/script.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { Range } from "../types/context";
77
import type { LJStateMachine } from "../types/fsm";
88
import type { NavTab } from "./views/sections";
99
import { renderDiagnosticsView } from "./views/diagnostics/diagnostics";
10-
import { LJContext } from "../types/context";
10+
import type { LJContext } from "../types/context";
1111
import { ContextSectionState, renderContextView } from "./views/context/context";
1212

1313
/**

client/src/webview/views/context/context.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { LJContext } from "../../../types/context";
2-
import { LJDiagnostic, RefinementMismatchError } from "../../../types/diagnostics";
1+
import type { LJContext } from "../../../types/context";
2+
import type { RefinementMismatchError } from "../../../types/diagnostics";
33
import { renderMainHeader } from "../sections";
44
import { renderContextAliases } from "./aliases";
55
import { renderContextGhosts } from "./ghosts";
@@ -11,12 +11,10 @@ export type ContextSectionState = {
1111
vars: boolean;
1212
}
1313

14-
export function renderContextView(context: LJContext, currentFile: string, sectionState: ContextSectionState, errorAtCursor?: RefinementMismatchError): string {
15-
if (!context || !currentFile) return "";
16-
17-
const allVars = context.allVars || [];
18-
const ghosts = context.ghosts?.filter(ghost => ghost.file === currentFile) || [];
19-
const aliases = context.aliases || [];
14+
export function renderContextView(context: LJContext | undefined, currentFile: string | undefined, sectionState: ContextSectionState, errorAtCursor?: RefinementMismatchError): string {
15+
const allVars = context?.allVars || [];
16+
const ghosts = context?.ghosts?.filter(ghost => ghost.file === currentFile) || [];
17+
const aliases = context?.aliases || [];
2018
const total = allVars.length + ghosts.length + aliases.length;
2119
return /*html*/`
2220
<div>

client/src/webview/views/diagnostics/diagnostics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { renderWarnings } from "./warnings";
66
export function renderDiagnosticsView(
77
diagnostics: LJDiagnostic[],
88
showAll: boolean,
9-
currentFile: string,
9+
currentFile: string | undefined,
1010
expandedErrors: Set<number>,
1111
): string {
1212
const fileDiagnostics = diagnostics.filter(diagnostic => diagnostic.file?.toLowerCase() === currentFile?.toLowerCase() || !diagnostic.file);

client/src/webview/views/fsm/fsm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { LJStateMachine } from "../../../types/fsm";
22
import { renderMainHeader } from "../sections";
33

4-
export function renderStateMachineView(sm: LJStateMachine, diagram: string, orientation: "LR" | "TB"): string {
4+
export function renderStateMachineView(sm: LJStateMachine | undefined, diagram: string, orientation: "LR" | "TB"): string {
55
return /*html*/`
66
<div>
77
${renderMainHeader("", 'fsm')}

0 commit comments

Comments
 (0)