feat(workspace): add text editing and image previews

This commit is contained in:
2026-10-15 23:10:13 +08:00
parent d380e18db0
commit a8ba3d74dc
19 changed files with 1188 additions and 7 deletions
+20
View File
@@ -0,0 +1,20 @@
import { expect, it } from 'vitest';
import { fileLanguage, maxTextBytes } from './fileEditor';
it('sets the text limit to exactly one MiB', () => {
expect(maxTextBytes).toBe(1024 * 1024);
});
it.each([
['nested/CONFIG.YAML', 'yaml'], ['config.yml', 'yaml'],
['settings.jsonc', 'json'], ['app.tsx', 'typescript'], ['app.mjs', 'javascript'],
['README.md', 'markdown'], ['script.sh', 'shell'], ['main.py', 'python'],
['main.go', 'go'], ['main.rs', 'rust'], ['index.html', 'html'],
['theme.css', 'css'], ['theme.scss', 'scss'], ['data.xml', 'xml'],
['schema.sql', 'sql'], ['settings.toml', 'ini'], ['service.conf', 'ini'],
['Main.java', 'java'], ['main.c', 'c'], ['include.h', 'c'], ['main.cpp', 'cpp'],
['build/Dockerfile', 'dockerfile'], ['secrets/.env', 'ini'], ['secrets/.env.local', 'ini'],
['README', 'plaintext'], ['data.unknown', 'plaintext'], ['folder.yaml/plain', 'plaintext'],
])('selects a language for %s', (path, language) => {
expect(fileLanguage(path)).toBe(language);
});