-
Notifications
You must be signed in to change notification settings - Fork 349
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
feat(autoedit): Support image rendering for complex diffs #6545
base: main
Are you sure you want to change the base?
Changes from all commits
59c6e73
ea66c35
fb578d5
702bb10
ce61ff7
4147c4c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
!dist/*.exe | ||
!dist/*.wasm | ||
!dist/*.node | ||
!dist/*.ttf | ||
|
||
!resources/* | ||
!walkthroughs/*.md | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { copyFileSync, existsSync, mkdirSync } from 'node:fs' | ||
import path from 'node:path' | ||
|
||
const DIST_DIRECTORY = path.join(__dirname, '../dist') | ||
const FONT_PATH = path.join(__dirname, '../resources/DejaVuSansMono.ttf') | ||
|
||
export async function main(): Promise<void> { | ||
try { | ||
copyFonts() | ||
console.log('Fonts were successfully copied to dist directory') | ||
} catch (error) { | ||
console.error('Error copying fonts:', error) | ||
process.exit(1) | ||
} | ||
} | ||
|
||
void main() | ||
|
||
function copyFonts(): void { | ||
const hasDistDir = existsSync(DIST_DIRECTORY) | ||
|
||
if (!hasDistDir) { | ||
mkdirSync(DIST_DIRECTORY) | ||
} | ||
|
||
copyFileSync(FONT_PATH, path.join(DIST_DIRECTORY, 'DejaVuSansMono.ttf')) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ import { promises as fs } from 'node:fs' | |
import { appendFileSync } from 'node:fs' | ||
|
||
const SIZE_LIMITS = { | ||
extension: 15 * 1024 * 1024, // 15MB | ||
webview: 10 * 1024 * 1024, // 10MB | ||
extension: 20 * 1024 * 1024, // 20MB | ||
webview: 15 * 1024 * 1024, // 15MB | ||
} | ||
Comment on lines
4
to
7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kinda annoying, but Shiki bumps us above these boundaries. I'm not too worried about this, there's actually a lot more we could do to reduce our bundle size (e.g. properly minify the code), but we're not doing right now. I did use the fine grained bundle to reduce this as much as possible, but alas still above the limits... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since auto-edit only works for extensions, curious if we should avoid including shiki for webview, or does the dependencies have to be common between both extension and webview |
||
|
||
function prettyPrintMB(bytes: number): string { | ||
|
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.
Is this generated by the auto-edit e2e tests ?
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.
It's generated by the new unit tests, we're using
jest-image-snapshot
which lets us compare the canvas output and ensure we don't regress in the image rendering.Images are produced like this and commited to the repo: