-
-
Notifications
You must be signed in to change notification settings - Fork 327
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
add CopyText and AutoCompleteText to some results in the sys plugin #3114
Conversation
This comment has been minimized.
This comment has been minimized.
Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX. |
📝 Walkthrough📝 WalkthroughWalkthroughThe changes in this pull request involve modifications to the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant FlowLauncher
participant Commands
User->>FlowLauncher: Request action (e.g., Open Recycle Bin)
FlowLauncher->>Commands: Execute Commands method
Commands->>Commands: Define logPath, userDataPath, recycleBinFolder
Commands->>FlowLauncher: Return Result with CopyText and AutoCompleteText
FlowLauncher->>User: Display results
Possibly related PRs
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (5)Plugins/Flow.Launcher.Plugin.Sys/Main.cs (5)
Extracting these paths into variables reduces duplication and makes the code more maintainable.
The implementation correctly uses the shell command for both copying and opening the recycle bin, which aligns with the discussed requirements in the PR. Also applies to: 304-304
Adding copy and autocomplete functionality for the documentation URL improves user experience by providing quick access to the documentation.
The implementation correctly allows copying and autocompleting the userdata path. However, it would be good to verify that the path exists before showing this result. Also applies to: 423-423
The implementation correctly allows copying and autocompleting the log path. However, it would be good to verify that the path exists before showing this result. ✅ Verification successfulLet me gather more information about how the log path is used in the codebase. Let me check one more thing about the log directory creation and validation. LGTM! The log directory is properly managed by the system. The log path used in the Sys plugin is safe to use as it's the same path that's automatically created and managed by Flow.Launcher's logging system (Log.cs). The 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Check if the log path pattern exists in the codebase
# and if there are any error handling patterns around it
# Check for path existence checks
rg -A 3 "DataLocation\.DataDirectory\(\).+Logs.+Constant\.Version"
# Check for any error handling patterns
ast-grep --pattern 'if (!File.Exists($_)) { $$$ }'
Length of output: 538 Script: #!/bin/bash
# Check the broader context of how logPath is used
rg -B 5 -A 10 "var logPath = Path\.Combine\(DataLocation\.DataDirectory\(\), \"Logs\", Constant\.Version\)"
# Check if Directory.Exists is used instead of File.Exists
ast-grep --pattern 'if (!Directory.Exists($_)) { $$$ }'
# Check if there's any directory creation logic
ast-grep --pattern 'Directory.CreateDirectory($_)'
Length of output: 2477 Script: #!/bin/bash
# Check how the log directory is initialized and validated
rg -B 5 -A 10 "CurrentLogDirectory"
# Check if there's any log directory validation in the Sys plugin
rg -B 3 -A 3 "Directory\.(Exists|CreateDirectory)" Plugins/Flow.Launcher.Plugin.Sys/
Length of output: 4059 Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
Plugins/Flow.Launcher.Plugin.Sys/Main.cs (2)
300-305
: Consider adding error handling for the Process.Start callThe changes look good, but the Process.Start call should include error handling to gracefully handle cases where the recycle bin cannot be opened.
Action = c => { - { - System.Diagnostics.Process.Start("explorer", recycleBinFolder); - } + try + { + System.Diagnostics.Process.Start("explorer", recycleBinFolder); + } + catch (Exception ex) + { + context.API.ShowMsg("Error", $"Failed to open recycle bin: {ex.Message}"); + } return true; }
420-424
: LGTM! Consider adding tests for the new functionalityThe changes look good, but since this code is untested, consider adding unit tests to verify:
- The CopyText and AutoCompleteText properties are correctly set
- The directory paths are correctly resolved
Would you like me to help create unit tests for these changes?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
Plugins/Flow.Launcher.Plugin.Sys/Main.cs
(5 hunks)
🔇 Additional comments (4)
Plugins/Flow.Launcher.Plugin.Sys/Main.cs (4)
136-138
: LGTM! Good refactoring to reduce duplication
The introduction of these variables improves code maintainability by centralizing path definitions that are used multiple times throughout the method.
394-395
: LGTM! Good use of version-specific log path
The properties are correctly set to the version-specific log path, which helps users easily copy or auto-complete the correct log directory path.
407-408
: LGTM! Documentation URL properly exposed
The properties are correctly set to the documentation URL constant, enabling easy access to Flow Launcher's documentation.
Line range hint 136-424
: Consider implementing a comprehensive testing strategy
While the changes look good and follow a consistent pattern, a testing strategy should be implemented to ensure reliability. Consider:
- Unit tests for path resolution
- Integration tests for the new CopyText and AutoCompleteText functionality
- End-to-end tests for the complete user workflow
This will help ensure the new features work as expected across different environments and versions.
This comment has been minimized.
This comment has been minimized.
Ok, I managed to test it through appveyor, and it seems like everything works except copying the log location and userdata folder. |
I think we should add a way to opt out of this behavior. Right now it always tries to copy files. Maybe add another property to Result? Something like |
What do you mean? It copies query text if it's highlighted, or else the text passed from plugin. Which behaviour are you referring to? |
The part of the code where if the text from the plugin is a valid path, flow will copy the file/dir it points to instead of the path |
|
Oh, that does seem to work. I guess that means this PR works as it should |
Have you tested the copy and autocomplete works for Recycle bin command? |
Oh, I completely forgot about that one. Yes, it does work.
It does autocomplete and copy the text |
I see 3 main options:
I personally like 3 the most since I'm just not sure which change I should make |
I also think option 3 is the best, but I'd like to hear others' opinion. |
I applied the third option for now, I can change it if needed though. |
@check-spelling-bot Report🔴 Please reviewSee the 📂 files view, the 📜action log, or 📝 job summary for details.
See ❌ Event descriptions for more information. If the flagged items are 🤯 false positivesIf items relate to a ...
|
Option 3 sounds good too. |
Adds the
CopyText
andAutoCompleteText
keys to theOpen recycle bin
,Open Flow Launcher's log location
, andOpen the location where Flow Launcher's settings are stored
results.DisclaimerThis code is untested (idk how to test it)Elven helped me figure out how to test it through AppVeyor