-
Notifications
You must be signed in to change notification settings - Fork 250
feat: Add VS Code Language Model API integration (#80) #102
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
ultmaster
merged 24 commits into
microsoft:main
from
ankit-apk:feature/vscode-lm-api-integration
Sep 2, 2025
Merged
Changes from 7 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
d7be26f
feat: Add VS Code Language Model API integration (#80)
ankit-apk 21405f6
refactor: Address PR feedback for VS Code LM API integration
ankit-apk 1fead53
cleanup: Remove unused files after merging changes
ankit-apk c63fe7f
fix: Register VS Code LM commands and fix compilation issues
ankit-apk a89a3e5
chore: Update .gitignore to exclude test artifacts
ankit-apk 5409c08
docs: Update PR description with test results and review feedback
ankit-apk 5e6e33a
refactor: address PR feedback - simplify implementation
ankit-apk 1232c08
fix: update code review example to pass tests
ankit-apk 58d3c14
refactor: address all PR review feedback
ankit-apk cb42de1
refactor: address all PR review feedback
ankit-apk 8a4d65b
Merge branch 'feature/vscode-lm-api-integration' of https://github.co…
ankit-apk 7bd1a65
Merge upstream/main - resolve conflicts in VS Code LM API integration
ankit-apk 9d46562
merge upstream/main
ultmaster c6b019a
revert bump version
ultmaster fb71b55
refactor vscode command
ultmaster 16741ef
Add comments
ultmaster fa49518
fix command bugs
ultmaster 458e505
fix example
ultmaster 6e05d27
restore tags and version
ultmaster b26db04
restore tags and version
ultmaster 1ad65d8
Merge branch 'feature/vscode-lm-api-integration' of https://github.co…
ultmaster 7097dbb
fix tests
ultmaster 743b6e6
revert
ultmaster 9cfdf9f
minor fix
ultmaster File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <!-- POML example for simple code review --> | ||
| <poml> | ||
| <role>You are an experienced code reviewer.</role> | ||
|
|
||
| <task>Review the provided Python code and suggest improvements.</task> | ||
|
|
||
| <!-- Include the sample code file --> | ||
| <document src="assets/108_sample_code.py" /> | ||
|
|
||
| <output-format> | ||
| Provide a concise code review with key suggestions for improvement. | ||
| </output-format> | ||
| </poml> | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| import sqlite3 | ||
| import hashlib | ||
| from flask import Flask, request, render_template_string | ||
|
|
||
| app = Flask(__name__) | ||
|
|
||
| # Database connection | ||
| def get_db(): | ||
| conn = sqlite3.connect('users.db') | ||
| return conn | ||
|
|
||
| @app.route('/login', methods=['POST']) | ||
| def login(): | ||
| username = request.form['username'] | ||
| password = request.form['password'] | ||
|
|
||
| # Security issue: SQL injection vulnerability | ||
| query = f"SELECT * FROM users WHERE username = '{username}' AND password = '{password}'" | ||
|
|
||
| conn = get_db() | ||
| cursor = conn.cursor() | ||
| cursor.execute(query) | ||
| user = cursor.fetchone() | ||
|
|
||
| if user: | ||
| # Security issue: password stored in plain text | ||
| return f"Welcome {username}!" | ||
| else: | ||
| return "Invalid credentials" | ||
|
|
||
| @app.route('/search') | ||
| def search(): | ||
| query = request.args.get('q', '') | ||
|
|
||
| # Security issue: XSS vulnerability | ||
| template = f"<h1>Search Results for: {query}</h1>" | ||
| return render_template_string(template) | ||
|
|
||
| @app.route('/admin') | ||
| def admin_panel(): | ||
| # Security issue: No authentication check | ||
| conn = get_db() | ||
| cursor = conn.cursor() | ||
| cursor.execute("SELECT * FROM users") | ||
| users = cursor.fetchall() | ||
|
|
||
| # Performance issue: Loading all users at once | ||
| return str(users) | ||
|
|
||
| def process_data(data): | ||
| result = [] | ||
| # Performance issue: Inefficient nested loops | ||
| for i in range(len(data)): | ||
| for j in range(len(data)): | ||
| if data[i] == data[j] and i != j: | ||
| result.append(data[i]) | ||
| return result | ||
|
|
||
| class UserManager: | ||
| def __init__(self): | ||
| self.users = [] | ||
|
|
||
| def add_user(self, name, email, password): | ||
| # Maintainability issue: No input validation | ||
| user = { | ||
| 'name': name, | ||
| 'email': email, | ||
| 'password': password # Security issue: storing plain password | ||
| } | ||
| self.users.append(user) | ||
|
|
||
| def find_user(self, email): | ||
| # Performance issue: Linear search | ||
| for user in self.users: | ||
| if user['email'] == email: | ||
| return user | ||
| return None | ||
|
|
||
| if __name__ == '__main__': | ||
| # Security issue: Debug mode in production | ||
| app.run(debug=True, host='0.0.0.0') |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| ===== human ===== | ||
|
|
||
| You are an experienced code reviewer specializing in security, performance, and best practices. | ||
|
|
||
| Review the provided Python code for security vulnerabilities and improvement opportunities. | ||
|
|
||
| ```python | ||
| import sqlite3 | ||
| import hashlib | ||
| from flask import Flask, request, render_template_string | ||
|
|
||
| app = Flask(__name__) | ||
|
|
||
| # Database connection | ||
| def get_db(): | ||
| conn = sqlite3.connect('users.db') | ||
| return conn | ||
|
|
||
| @app.route('/login', methods=['POST']) | ||
| def login(): | ||
| username = request.form['username'] | ||
| password = request.form['password'] | ||
|
|
||
| # Security issue: SQL injection vulnerability | ||
| query = f"SELECT * FROM users WHERE username = '{username}' AND password = '{password}'" | ||
|
|
||
| conn = get_db() | ||
| cursor = conn.cursor() | ||
| cursor.execute(query) | ||
| user = cursor.fetchone() | ||
|
|
||
| if user: | ||
| # Security issue: password stored in plain text | ||
| return f"Welcome {username}!" | ||
| else: | ||
| return "Invalid credentials" | ||
|
|
||
| @app.route('/search') | ||
| def search(): | ||
| query = request.args.get('q', '') | ||
|
|
||
| # Security issue: XSS vulnerability | ||
| template = f"<h1>Search Results for: {query}</h1>" | ||
| return render_template_string(template) | ||
|
|
||
| @app.route('/admin') | ||
| def admin_panel(): | ||
| # Security issue: No authentication check | ||
| conn = get_db() | ||
| cursor = conn.cursor() | ||
| cursor.execute("SELECT * FROM users") | ||
| users = cursor.fetchall() | ||
|
|
||
| # Performance issue: Loading all users at once | ||
| return str(users) | ||
|
|
||
| def process_data(data): | ||
| result = [] | ||
| # Performance issue: Inefficient nested loops | ||
| for i in range(len(data)): | ||
| for j in range(len(data)): | ||
| if data[i] == data[j] and i != j: | ||
| result.append(data[i]) | ||
| return result | ||
|
|
||
| class UserManager: | ||
| def __init__(self): | ||
| self.users = [] | ||
|
|
||
| def add_user(self, name, email, password): | ||
| # Maintainability issue: No input validation | ||
| user = { | ||
| 'name': name, | ||
| 'email': email, | ||
| 'password': password # Security issue: storing plain password | ||
| } | ||
| self.users.append(user) | ||
|
|
||
| def find_user(self, email): | ||
| # Performance issue: Linear search | ||
| for user in self.users: | ||
| if user['email'] == email: | ||
| return user | ||
| return None | ||
|
|
||
| if __name__ == '__main__': | ||
| # Security issue: Debug mode in production | ||
| app.run(debug=True, host='0.0.0.0') | ||
| ``` | ||
|
|
||
| Focus on: | ||
| - SQL injection and XSS vulnerabilities | ||
| - Authentication and authorization issues | ||
| - Performance bottlenecks | ||
| - Code maintainability | ||
|
|
||
| Provide a structured code review with: | ||
| 1. Critical security issues | ||
| 2. Performance improvements | ||
| 3. Best practice recommendations | ||
| 4. Positive observations |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.