Skip to content

Implement file watcher for hot-reloading and command execution #4

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

Merged
merged 5 commits into from
Jun 20, 2024

Conversation

mnismt
Copy link
Owner

@mnismt mnismt commented Jun 20, 2024

What happened 👀

  • Issue: None

This PR aims to implement the file watcher so Cody++ can hot-reload (watch) the changes of the cody.json file and allow users to open the command item by clicking on it, thereby improving the user experience. The main changes include:

  • Adding a file watcher to the CustomCommandService that watches the .vscode/cody.json file for changes, creates, and deletes.
  • Implementing a disposeFileWatcher method to dispose of the file watcher when the extension is deactivated.
  • Updating the deactivate function in extension.ts to call the disposeFileWatcher method when the extension is deactivated.
  • Adding a command property to the CommandTreeItem interface to enable executing custom commands from the tree view.
  • Updating the getTreeItem method to include the command property, which sets the title, command, and arguments for each custom command.

Insight 📝

The rationale behind these changes is to enhance the functionality and user experience of Cody++. By implementing a file watcher, the extension can dynamically reload changes to the cody.json file without requiring a manual reload, making it more efficient and user-friendly.

Additionally, allowing users to execute commands directly from the tree view improves the overall usability of the extension, making it more intuitive and interactive.

Proof Of Work 📹

codypp-filewatcher.mp4

mnismt added 5 commits June 20, 2024 14:13
- Imports `path` and `vscode` modules
- Adds a `getCodyJsonPath` function that returns the path to the `.vscode/cody.json` file
- Adds a file watcher to the `CustomCommandService` that watches the `.vscode/cody.json` file for changes, creates, and deletes
- Implements a `disposeFileWatcher` method to dispose of the file watcher when the extension is deactivated
- Updates the `deactivate` function in `extension.ts` to call the `disposeFileWatcher` method when the extension is deactivated
- Adds a `command` property to the `CommandTreeItem` interface to enable executing custom commands from the tree view
- Updates the `getTreeItem` method to include the `command` property, which sets the `title`, `command`, and `arguments` for each custom command
- Adds a new `write-pull-request` command configuration to the `.vscode/cody.json` file
@mnismt mnismt added the feature New feature or request label Jun 20, 2024
@mnismt mnismt self-assigned this Jun 20, 2024
@mnismt mnismt merged commit 7773fcf into main Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant