Welcome to the Code Review Extension! This extension allows users to easily review and comment on code directly within Visual Studio Code. It is especially useful for instructors and collaborators who need to leave detailed comments or questions about specific parts of the code.
Features
1. Highlight Code and Add Comments
How to Use:
Highlight a code snippet in the editor.
Right-click and select "Highlight and Add Comment" from the context menu.
A panel will open where you can write your comment and save it.
The highlighted code will be marked with a green background.
Shortcut: You can also invoke this feature from the Command Palette by pressing Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac) and selecting "Highlight and Add Comment".
2. View All Comments
How to Use:
Open the Command Palette and select "View All Comments".
A table will appear in a panel listing all the comments, including:
The file where the comment was made.
The range of the highlighted code.
The highlighted code snippet.
The comment text.
A button to mark a comment as resolved.
Resolve Comments: Click the "Resolve" button in the table to mark a comment as resolved.
3. Ask Questions
How to Use:
Highlight a code snippet in the editor.
Right-click and select "Ask Question" from the context menu.
A panel will open where you can write your question and save it.
Shortcut: You can invoke this feature from the Command Palette by selecting "Ask Question".
4. Answer Questions
How to Use:
Open the Command Palette and select "Answer Question".
A list of questions will appear.
Select a question to answer. A panel will open where you can type your answer and save it.
View Updated Answers: Once a question is answered, the answer will be displayed in the View Questions and Answers table.
5. View Questions and Answers
How to Use:
Open the Command Palette and select "View Questions and Answers".
A table will appear listing all questions, answers, and associated code snippets.
Questions can be answered by clicking the "Answer" button in the table.
6. Add Personalized Questions
How to Use:
Highlight a code snippet in the editor.
Right-click and select "Add Personalized Question" from the context menu.
A panel will open where you can type your personalized question and save it.
How It Works:
The personalized question is saved to a personalizedQuestions.json file in the project directory.
The file is automatically added to the .gitignore file to ensure it is not pushed to GitHub.
7. View Personalized Questions
How to Use:
Open the Command Palette and select "View Personalized Questions".
A table will appear listing all personalized questions, their highlighted code snippets, and the associated files.
Installation
Open Visual Studio Code.
Go to the Extensions Marketplace (Ctrl+Shift+X or Cmd+Shift+X on Mac).
Search for Code Review Extension.
Click Install.
How It Works
Data Storage:
Comments and questions are saved as JSON files (commentsData.json and questionsData.json) in the current project directory.
Personalized questions are saved in personalizedQuestions.json in the project directory and excluded from version control via .gitignore.
Green Highlights:
Any code snippet with comments or questions will be visually highlighted with a green background, making it easy to identify.
Webview Panels:
The extension uses rich Webview panels to display comments, questions, and answers in a user-friendly table format.
Commands and Shortcuts
Command
Shortcut
Context Menu Option
Highlight and Add Comment
Ctrl+Shift+P
Yes
Ask Question
Ctrl+Shift+P
Yes
Answer Question
Ctrl+Shift+P
No
View All Comments
Ctrl+Shift+P
No
View Questions and Answers
Ctrl+Shift+P
No
Add Personalized Question
Ctrl+Shift+P
Non
View Personalized Questions
Ctrl+Shift+P
No
Contributing
If you find a bug or have an idea for an improvement, feel free to contribute!
Fork this repository.
Create a new branch (git checkout -b feature/my-feature).
Commit your changes (git commit -am 'Add some feature').
Push to the branch (git push origin feature/my-feature).