-
Notifications
You must be signed in to change notification settings - Fork 91
feat: check pending commit changes (surface sync) #861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
JulioSergioFS
merged 1 commit into
development
from
feat/check-commit-hanges-before-merge
Jun 9, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
src/frontend/components/_features/[workspace]/editor/diff-viewer/file-diff-view.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| /** | ||
| * FileDiffView — single entry point for rendering a before/after diff of one | ||
| * project file. Routes graphical POUs (.ld/.fbd) to the GraphicalDiffViewer | ||
| * and everything else to Monaco's DiffEditor. Shared by the history page and | ||
| * the source-control diff tab so both surfaces render diffs identically. | ||
| */ | ||
|
|
||
| import { DiffEditor } from '@monaco-editor/react' | ||
|
|
||
| import { GraphicalDiffViewer, isGraphicalFile } from './graphical-diff-viewer' | ||
|
|
||
| export { isGraphicalFile } | ||
|
|
||
| /** Map a file path to the Monaco language id used for syntax highlighting. */ | ||
| export function getLanguageFromPath(path: string): string { | ||
| const ext = path.split('.').pop()?.toLowerCase() | ||
| switch (ext) { | ||
| case 'json': | ||
| return 'json' | ||
| case 'st': | ||
| case 'il': | ||
| case 'sfc': | ||
| return 'st' | ||
| case 'py': | ||
| return 'python' | ||
| case 'c': | ||
| return 'c' | ||
| case 'cpp': | ||
| return 'cpp' | ||
| default: | ||
| return 'plaintext' | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * For graphical files (.ld/.fbd) shown in the textual diff, the embedded JSON | ||
| * flow blob is noise — collapse it to a placeholder so the textual diff stays | ||
| * focused on the variable declarations. Non-graphical files pass through | ||
| * untouched. (Graphical files normally route to GraphicalDiffViewer, but this | ||
| * keeps the helper safe if it is ever used on the textual side.) | ||
| */ | ||
| export function formatContentForDisplay(path: string, content: string): string { | ||
| const ext = path.split('.').pop()?.toLowerCase() | ||
| if (ext !== 'ld' && ext !== 'fbd') return content | ||
|
|
||
| const endMatch = content.match(/\b(END_PROGRAM|END_FUNCTION_BLOCK|END_FUNCTION)\b/i) | ||
| if (!endMatch || endMatch.index === undefined) return content | ||
|
|
||
| const endKeyword = endMatch[0] | ||
| const beforeEnd = content.slice(0, endMatch.index) | ||
|
|
||
| const endVarIdx = beforeEnd.lastIndexOf('END_VAR') | ||
| if (endVarIdx === -1) return content | ||
|
|
||
| const declaration = beforeEnd.slice(0, endVarIdx + 'END_VAR'.length) | ||
| return `${declaration}\n\n(* ${ext.toUpperCase()} graphical data omitted *)\n\n${endKeyword}` | ||
| } | ||
|
|
||
| type FileDiffViewProps = { | ||
| filePath: string | ||
| /** Original (e.g. HEAD / previous-commit) content. Empty string for added files. */ | ||
| original: string | ||
| /** Current (e.g. working-tree / commit) content. Empty string for deleted files. */ | ||
| current: string | ||
| isDark: boolean | ||
| } | ||
|
|
||
| export function FileDiffView({ filePath, original, current, isDark }: FileDiffViewProps) { | ||
| if (isGraphicalFile(filePath)) { | ||
| return ( | ||
| <GraphicalDiffViewer originalContent={original} currentContent={current} filePath={filePath} isDark={isDark} /> | ||
| ) | ||
| } | ||
|
|
||
| return ( | ||
| <DiffEditor | ||
| original={formatContentForDisplay(filePath, original)} | ||
| modified={formatContentForDisplay(filePath, current)} | ||
| language={getLanguageFromPath(filePath)} | ||
| theme={isDark ? 'vs-dark' : 'vs'} | ||
| options={{ | ||
| readOnly: true, | ||
| minimap: { enabled: false }, | ||
| fontSize: 12, | ||
| scrollBeyondLastLine: false, | ||
| domReadOnly: true, | ||
| renderSideBySide: true, | ||
| originalEditable: false, | ||
| }} | ||
| /> | ||
| ) | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Case-sensitivity inconsistency in
END_VARsearch.The regex on line 46 uses the
/iflag for case-insensitive matching ofEND_PROGRAM/END_FUNCTION_BLOCK/END_FUNCTION, but line 52 useslastIndexOf('END_VAR')which is case-sensitive. IEC 61131-3 ST language is case-insensitive, so files withend_varorEnd_Varwould fail to collapse the graphical blob.🔧 Proposed fix for case-insensitive matching
🤖 Prompt for AI Agents