Repository navigation
Open Files - #2
Merged
Merged
Conversation
rafaelfaustini
commented
Apr 4, 2026
Owner
- Open files
- Unit tests (Path assemble logic from FileExplorer was decoupled from UI allowing us to have unit tests)
- Feature integration test
We want to be able to open a file, the test will fail since we didn't implement the feature yet
Simple implementation until test passes
By mistake I was putting .extension in the extension mocks, when I should've put just the extension
There were non UI logic in the FileExplorer component, related to path assembly used for the navigation. Therefore, in the refactor process the logic was separated into functions in a new util. With this logic decoupled of the UI, unit tests were made to cover edge cases with less cost of integration tests
There was a problem hiding this comment.
Pull request overview
Adds an “open file” capability to the File Explorer by wiring a new Tauri command and decoupling path construction into a reusable utility, with accompanying unit and integration tests.
Changes:
- Introduces
pathUtilshelpers for assembling folder/file paths and adds unit tests for the path assembly logic. - Updates
FileExplorerto open files on double-click via a new Tauriopen_filecommand. - Extends the Tauri backend with a
filecommand module and adjusts directory listing behavior; updates dependency range/lockfiles.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Updates lock entry for @tauri-apps/plugin-opener. |
| package.json | Switches @tauri-apps/plugin-opener version range to ~2. |
| src/utils/pathUtils.ts | Adds shared path assembly utilities for folders/files. |
| src/utils/pathUtils.test.ts | Adds unit tests for pathUtils. |
| src/setupTests.ts | Minor test setup cleanup. |
| src/components/FileExplorer/FileExplorer.tsx | Uses pathUtils and invokes open_file on file double-click. |
| src/components/FileExplorer/FileExplorer.test.tsx | Updates extension fixtures and adds a file-open double-click test. |
| src-tauri/src/lib.rs | Registers the new open_file command (removes unused greet). |
| src-tauri/src/commands/mod.rs | Exposes the new file module. |
| src-tauri/src/commands/file.rs | Implements open_file using tauri-plugin-opener. |
| src-tauri/src/commands/directory.rs | Changes name extraction to file_stem() in directory listings. |
Comments suppressed due to low confidence (1)
src-tauri/src/commands/directory.rs:37
path.file_stem()is used for all entries, including directories. For folder names containing dots (e.g.,my.folder),file_stemwill truncate the name tomyand treatfolderas an extension, which will make the UI show an incorrect folder name. Consider usingfile_name()whenmetadata.is_dir()is true (or always usefile_name()and only computeextensionfor files).
let name = path.file_stem()
.map(|n| n.to_string_lossy().into_owned())
.unwrap_or_else(|| "Unknown".to_string());
let extension = path.extension()
.map(|e| e.to_string_lossy().into_owned())
.unwrap_or_default();
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1. Removed unused imports in pathUtils tests 2. package-log.json was regenerated via npm install to avoid inconsistency with package.json 3. When double clicking a folder/file, the name was being selected giving a non button behaviour, the user-select needed some fallbacks in css
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.