Skip to content

Commit 1b38dd1

Browse files
committed
Support extended text file extensions
- Add .md, .markdown, .rst for documentation files - Add .toml, .ini, .conf, .cfg, .config for config files - Add .tsv, .ndjson, .jsonl for data files - Add .sh, .bash, .ps1 for script files - Add .properties, .env for environment files - Organize file dialog filters by category - Rename LOG_EXTENSIONS to TEXT_EXTENSIONS for clarity
1 parent d9260d1 commit 1b38dd1

1 file changed

Lines changed: 21 additions & 5 deletions

File tree

src/main/index.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,10 @@ ipcMain.handle(IPC.OPEN_FILE_DIALOG, async () => {
281281
const result = await dialog.showOpenDialog(mainWindow!, {
282282
properties: ['openFile'],
283283
filters: [
284-
{ name: 'Log Files', extensions: ['log', 'txt', 'json', 'out', 'err'] },
284+
{ name: 'Log Files', extensions: ['log', 'txt', 'out', 'err'] },
285+
{ name: 'Text Files', extensions: ['md', 'markdown', 'rst', 'text'] },
286+
{ name: 'Data Files', extensions: ['json', 'xml', 'yaml', 'yml', 'csv', 'tsv', 'toml'] },
287+
{ name: 'Config Files', extensions: ['ini', 'conf', 'cfg', 'config', 'properties', 'env'] },
285288
{ name: 'All Files', extensions: ['*'] },
286289
],
287290
});
@@ -297,8 +300,21 @@ ipcMain.handle(IPC.OPEN_FOLDER_DIALOG, async () => {
297300
return result.canceled ? null : result.filePaths[0];
298301
});
299302

300-
// Log file extensions to show in folder tree
301-
const LOG_EXTENSIONS = new Set(['.log', '.txt', '.json', '.out', '.err', '.csv', '.xml', '.yaml', '.yml']);
303+
// Text file extensions to show in folder tree - expanded to support many formats
304+
const TEXT_EXTENSIONS = new Set([
305+
// Log files
306+
'.log', '.out', '.err',
307+
// Text files
308+
'.txt', '.text', '.md', '.markdown', '.rst',
309+
// Config files
310+
'.json', '.xml', '.yaml', '.yml', '.toml', '.ini', '.conf', '.cfg', '.config',
311+
// Data files
312+
'.csv', '.tsv', '.ndjson', '.jsonl',
313+
// Code/script files (often contain logs or can be viewed as text)
314+
'.sh', '.bash', '.zsh', '.ps1', '.bat', '.cmd',
315+
// Other common text formats
316+
'.properties', '.env', '.gitignore', '.dockerignore',
317+
]);
302318

303319
ipcMain.handle(IPC.READ_FOLDER, async (_, folderPath: string) => {
304320
try {
@@ -313,8 +329,8 @@ ipcMain.handle(IPC.READ_FOLDER, async (_, folderPath: string) => {
313329

314330
if (entry.isFile()) {
315331
const ext = path.extname(entry.name).toLowerCase();
316-
// Only include log-like files
317-
if (LOG_EXTENSIONS.has(ext) || ext === '') {
332+
// Include text-based files or files without extension
333+
if (TEXT_EXTENSIONS.has(ext) || ext === '') {
318334
try {
319335
const stat = await fs.promises.stat(fullPath);
320336
files.push({

0 commit comments

Comments
 (0)