Highlight Changes Between Simplification Passes by rcosta358 · Pull Request #97 · liquid-java/vscode-liquidjava · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions client/src/webview/script.ts
50 changes: 49 additions & 1 deletion client/src/webview/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,8 @@ export function getStyles(): string {
align-items: flex-start;
gap: 0.5rem;
min-width: 0;
padding: 0.0625rem 0.25rem;
border-radius: 3px;
}
.vc-line-content {
flex: 0 1 auto;
Expand All @@ -389,6 +391,52 @@ export function getStyles(): string {
.vc-node:hover {
background: none;
}
.vc-change-line .vc-node {
border-radius: 2px;
animation: vc-change-line-fade 1.4s ease-out;
}
.vc-change-fragment {
border-radius: 2px;
animation: vc-change-fragment-fade 1.4s ease-out;
}
@keyframes vc-change-line-fade {
0% {
background-color: rgba(255, 255, 96, 0.68);
box-shadow: 0 0 0 1px rgba(255, 255, 0, 0.38);
}
18% {
background-color: rgba(255, 255, 0, 0.4);
box-shadow: 0 0 0 1px rgba(255, 255, 0, 0.2);
}
100% {
background-color: transparent;
box-shadow: none;
}
}
@keyframes vc-change-fragment-fade {
0% {
background-color: rgba(255, 255, 96, 0.68);
box-shadow: 0 0 0 1px rgba(255, 255, 0, 0.38);
}
18% {
background-color: rgba(255, 255, 0, 0.4);
box-shadow: 0 0 0 1px rgba(255, 255, 0, 0.2);
}
100% {
background-color: transparent;
box-shadow: none;
}
}
@media (prefers-reduced-motion: reduce) {
.vc-change-line .vc-node {
background-color: rgba(255, 255, 0, 0.3);
animation: none;
}
.vc-change-fragment {
background-color: rgba(255, 255, 0, 0.3);
animation: none;
}
}
.vc-binder {
color: var(--vscode-descriptionForeground);
}
Expand Down Expand Up @@ -420,8 +468,8 @@ export function getStyles(): string {
}
.vc-step-btn:hover {
font-weight: bold;
background-color: transparent;
opacity: 1;
background-color: transparent;
}
.vc-step-btn:disabled {
cursor: default;
Expand Down
5 changes: 2 additions & 3 deletions client/src/webview/views/context/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { LJVariable } from "../../../types/context";
import { RefinementMismatchError } from "../../../types/diagnostics";
import { renderHighlightedInlineExpression } from "../../highlighting";
import { escapeHtml, getSimpleName } from "../../utils";
import { renderToggleSection, renderHighlightButton, renderDiagnosticRevealButton } from "../sections";
import { renderToggleSection, renderVariableHighlightButton, renderDiagnosticRevealButton } from "../sections";

export function renderContextVariables(variables: LJVariable[], isExpanded: boolean, errorAtCursor?: RefinementMismatchError): string {
const relevantNames = new Set(Object.keys(errorAtCursor?.translationTable || {}));
Expand All @@ -24,11 +24,10 @@ export function renderContextVariables(variables: LJVariable[], isExpanded: bool
</thead>
<tbody>
${variables.map(variable => {
const displayName = getSimpleName(variable.name);
const isRelevant = relevantNames.has(variable.name);
return /*html*/`
<tr class="${isRelevant ? 'context-variable-relevant' : ''}">
<td>${renderHighlightButton(variable.position!, displayName)}</td>
<td>${renderVariableHighlightButton(variable)}</td>
<td><code>${renderHighlightedInlineExpression(variable.refinement)}</code></td>
</tr>
`}).join('')}
Expand Down
196 changes: 196 additions & 0 deletions client/src/webview/views/diagnostics/vc-changes.ts
Loading