Conversation
Add functionality to load all modules in the `lua/dorm/mod` directory. * **`lua/dorm/mod/init.lua`** - Add `Mod.load_modules` function to load all modules in the `lua/dorm/mod` directory. - Use `vim.loop.fs_scandir` to iterate over the files in the directory. - Call `Mod.load_module` for each file that matches the pattern `module.lua`. * **`lua/dorm/init.lua`** - Call `Mod.load_modules` in the `dorm.setup` function to load all modules. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/clpi/dorm.lua?shareId=XXXX-XXXX-XXXX-XXXX).
Reviewer's Guide by SourceryThis PR implements module loading functionality by adding a new Sequence diagram for module loading processsequenceDiagram
participant User
participant dorm
participant Mod
participant vim.loop
User->>dorm: Call setup(cfg)
dorm->>Mod: Call load_modules()
Mod->>vim.loop: fs_scandir("lua/dorm/mod")
alt Directory exists
loop For each file in directory
Mod->>vim.loop: fs_scandir_next(handle)
alt File matches pattern "module.lua"
Mod->>Mod: load_module(module_name)
end
end
end
Class diagram for Mod module changesclassDiagram
class Mod {
+send_event(recipient, event)
+load_modules()
}
note for Mod "Added load_modules function to load all modules in the directory"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @clpi - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider adding error handling in
Mod.load_modules()to gracefully handle module loading failures without breaking the entire plugin
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| function Mod.load_modules() | ||
| local dir = "lua/dorm/mod" | ||
| local handle = vim.loop.fs_scandir(dir) | ||
| if not handle then |
There was a problem hiding this comment.
suggestion (bug_risk): Consider logging an error when directory scanning fails
Silent failures can make debugging difficult. Consider logging an error message when fs_scandir fails to help with troubleshooting.
if not handle then
vim.notify("Failed to scan directory: " .. dir, vim.log.levels.ERROR)
return
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.
Add functionality to load all modules in the
lua/dorm/moddirectory.lua/dorm/mod/init.luaMod.load_modulesfunction to load all modules in thelua/dorm/moddirectory.vim.loop.fs_scandirto iterate over the files in the directory.Mod.load_modulefor each file that matches the patternmodule.lua.lua/dorm/init.luaMod.load_modulesin thedorm.setupfunction to load all modules.For more details, open the Copilot Workspace session.
Summary by Sourcery
Add functionality to automatically load all modules in the 'lua/dorm/mod' directory during the setup process by introducing a new function 'Mod.load_modules' and integrating it into 'dorm.setup'.
New Features:
Enhancements: