Skip to content

feat: Clickable links, hover tooltips, switch env, auto interpreter#69

Merged
DJSaunders1997 merged 1 commit intomasterfrom
feature/v1.2-new-features
Apr 12, 2026
Merged

feat: Clickable links, hover tooltips, switch env, auto interpreter#69
DJSaunders1997 merged 1 commit intomasterfrom
feature/v1.2-new-features

Conversation

@DJSaunders1997
Copy link
Copy Markdown
Owner

Summary

  • Clickable package links in YAML — conda deps → anaconda.org, pip deps → PyPI
  • Hover tooltips on package names — description + latest version from PyPI
  • Switch Environment command — quick pick all conda envs, activate from palette
  • Auto-set Python interpreter from detected conda env
  • Active env + Python version in status bar, click to switch
  • New condaWingman.autoSetInterpreter setting

Test plan

  • Open a conda YAML file — package names are clickable links
  • Hover over a package name — tooltip shows description + version
  • Run "Conda Wingman: Switch Environment" — lists all conda envs
  • Status bar shows env name + Python version when YAML is open

🤖 Generated with Claude Code

…to-set, env status bar

- Clickable package links in YAML: conda deps → anaconda.org, pip deps → PyPI
- Hover tooltips on package names showing description + latest version from PyPI
- Switch Environment command: quick pick of all conda envs from `conda env list`
- Auto-set Python interpreter from detected conda env
- Active env name + Python version in status bar, click to switch
- New condaWingman.autoSetInterpreter setting
- Export getEnvNameFromYAML from utils.js

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@DJSaunders1997 DJSaunders1997 merged commit 8d3d2e8 into master Apr 12, 2026
4 checks passed
Comment thread CHANGELOG.md

## [1.1.0] - 2026-04

### Added
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code additions look good, but here are some suggestions for improvement and potential bug risks:

  1. Input Validation: Ensure that input from the user (such as package names) is validated to prevent security vulnerabilities like injection attacks.

  2. Error Handling: Implement robust error handling mechanisms to gracefully handle unexpected issues, preventing crashes or data loss.

  3. Testing: Add comprehensive unit tests to cover new functionality thoroughly, ensuring that changes work as expected and don't break existing features.

  4. Documentation: Update documentation within the codebase to reflect the new features, describing usage, configurations, and potential limitations.

  5. Performance Optimization: Monitor performance impact of new features, optimizing code if any slowdowns are noticed, especially in hover tooltips that may load external data.

  6. Versioning: Follow consistent versioning practices to maintain clarity on changes made between versions and ensure compatibility with dependency requirements.

Overall, the new features seem beneficial for user experience, but attention to these suggestions can enhance reliability and usability.

Comment thread CLAUDE.md
├── codeLens.js (hover tooltips with PyPI package info)
├── config.js (reads condaWingman.* settings)
└── utils.js (sendCommandToTerminal, YAML helpers, activeFileIsYAML)
```
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are some suggestions based on the provided code patch:

  1. Code Structure:

    • The addition of new files such as interpreter.js, documentLinks.js, and codeLens.js seems appropriate for better organization and separation of concerns.
  2. Functionality Expansion:

    • Adding a new command handler for switch in commands.js is a good improvement to enhance functionality.
    • Implementing clickable package links in YAML through documentLinks.js and hover tooltips with PyPI package info using codeLens.js seem like useful features.
  3. Consistency:

    • Ensure consistency in naming conventions, coding styles, and documentation across all files for better maintainability.
  4. Error Handling:

    • Make sure to handle errors appropriately, especially when performing tasks like finding the Conda environment Python path in interpreter.js.
  5. Testing:

    • It would be beneficial to include unit tests to cover the new features and any modifications made to ensure that they work correctly and do not introduce regressions.
  6. Documentation:

    • Add comments or update the README to reflect the new features added and give usage instructions if needed.

Overall, the changes and additions seem valuable for enhancing the extension's functionality. Pay attention to error handling, maintain consistent coding standards, and consider testing to ensure the reliability and robustness of the extension.

Comment thread README.md
| `condaWingman.autoSetInterpreter` | `true` | Auto-set workspace Python interpreter from conda env |

## Release Notes

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review:

  1. Addition of New Features:

    • Addition of the "Switch Environment" functionality is clear and well-described.
    • Clickable package links, hover tooltips, and displaying active environment in the status bar seem like useful features.
  2. Potential Improvements:

    • Consider adding error handling for scenarios where the selected conda environment may not be valid.
    • Ensure that clickable package links work as intended for all cases.
    • Double-check that activating various environments works seamlessly without any conflicts.
  3. Auto-Set Python Interpreter:

    • The auto-set Python interpreter feature could potentially conflict with existing interpreter configurations. Properly handle cases where conflicts arise.
    • Provide a way to disable this feature if users prefer manual control over the interpreter setting.
  4. Settings Table:

    • Ensure that the descriptions in the settings table are concise and clear for users to understand their purpose easily.
  5. Testing:

    • Thoroughly test the new features and settings in different scenarios to ensure they function correctly in all situations.
  6. Documentation:

    • Update documentation to reflect these new features and settings for user reference.
  7. Release Notes:

    • Update the release notes with details about the added features and changes for clarity.

Overall, the code patch appears to introduce valuable enhancements. However, attention should be given to potential edge cases, conflicts, and user preferences regarding the auto-setting of the Python interpreter.

Comment thread package.json
"description": "Automatically set the workspace Python interpreter when a conda environment is detected."
}
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review:

Bug Risks:

  1. Potential Command Error: Ensure that the switchEnvironment command functionality is correctly implemented as there could be risks associated with environment switching logic.

Improvements:

  1. Document Changes: Update the README or documentation to reflect the new features added in version 1.2.0, such as switching environments and any other enhancements.

  2. Code Comments: Add or review existing comments for complex or critical logic to improve readability and understanding for maintainability.

  3. Testing: Consider adding unit tests to cover new functionality introduced. Test cases for switching environments ensure stability.

  4. Error Handling: Implement error handling for edge cases, particularly during environment switching activities, to avoid unexpected crashes.

  5. User Confirmation: For potentially risky operations like environment deletion or switching, consider adding user confirmation prompts to prevent accidental actions.

  6. Performance Optimization: If the extension has performance bottlenecks, profiling and optimizing it could enhance user experience.

  7. Security Audit: If the extension interacts with external resources, ensure that inputs are properly sanitized and validated to prevent security vulnerabilities.

  8. Feedback Mechanism: Consider adding a feedback mechanism to allow users to report bugs or provide suggestions directly from within the extension.

Overall, the changes appear straightforward, but thorough testing and consideration of potential edge cases and user experience improvements are recommended.

Comment thread src/commands.js
writeRequirementsFile,
deleteCondaEnv,
switchEnvironment,
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review:

  1. Imports:

    • Ensure that all necessary imports are present at the top of the file for better clarity and organization.
  2. Error Handling in switchEnvironment Function:

    • When catching errors after running execSync("conda env list --json", ...), it's good to provide more specific error messages for different types of potential failures for better debugging.
  3. User Messaging:

    • Provide a bit more context within the error messages shown to users for better understanding of what went wrong.
  4. Timeout in execSync:

    • Consider handling timeout errors explicitly if they occur during the execution of the command using execSync.
  5. Interpreter Path Retrieval:

    • Ensure thorough testing for cases where getCondaInterpreterPath(selected.label) might return null.
  6. Promise Handling:

    • Ensure proper error handling for promises in setWorkspacePythonInterpreter(interpreterPath).catch(() => {});. Logging errors or displaying them could be helpful for the developer.
  7. Dependency Isolation:

    • Verify if the functions being called inside this script (sendCommandToTerminal, getConfig, getCondaInterpreterPath, setWorkspacePythonInterpreter) handle edge cases appropriately to prevent unexpected behavior.
  8. Code Structure:

    • The order of function definitions seems logical, starting with buildCondaYAML and ending with switchEnvironment.

Bug Risks and Improvements:

  • Error Handling Improvement: Enhance error handling by providing more specific error messages and ensuring consistent error handling throughout the codebase.

  • Security Note: Be cautious with execSync which runs shell commands. Check input validation to avoid any potential security vulnerabilities like command injection.

  • Testing: Thoroughly test the switchEnvironment function with different scenarios such as empty environments, timeout cases, etc., to ensure it behaves as expected in all conditions.

  • Documentation: Consider adding comments and/or JSDoc style documentation to the functions for better code readability and understanding.

  • Linting and Formatting: Run a linter/formatter on the codebase to ensure consistent coding standards are applied.

  • Unit Testing: Implement unit tests for critical functions to ensure their correctness and improve code quality.

By addressing these points, you can enhance the robustness, reliability, and maintainability of the codebase.

Comment thread src/config.js
autoSetInterpreter: cfg.get('autoSetInterpreter', true),
};
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code patch seems to be a simple modification to an existing function in a Visual Studio Code (VSCode) extension related to Conda environments. Here are some observations and suggestions for improvement:

  1. Bug Risk:

    • No obvious bugs are introduced by this change as long as the configuration keys 'showStatusBarItems' and 'autoSetInterpreter' are correctly defined in the CondaWingman extension's package.json or default settings.
  2. Improvements:

    • Variable naming: The variable cfg can be renamed to something more descriptive like config for better readability.
    • Error Handling: Consider adding error handling in case vscode.workspace.getConfiguration('condaWingman') fails to get the CondaWingman configuration.
    • Documentation: Adding comments above the function explaining its purpose and the configuration options being returned could be helpful for future maintenance.
  3. Scope for Expansion:

    • Depending on the functionality and future plans, you might want to extend this to handle other configurations or settings as needed.
  4. Code Efficiency:

    • Make sure that accessing configuration settings doesn't incur performance penalties, especially if these settings are queried frequently or in critical paths.
  5. Consistency:

    • Ensure consistency in coding style with the rest of the project to maintain readability.

Overall, the code change seems fine if it aligns with the intended functionality. Just pay attention to error handling and code documentation for clarity and maintainability.

Comment thread src/documentLinks.js
);
}

module.exports = { registerDocumentLinks, findCondaDepPositions };
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review and Suggestions:

  1. Exception Handling:

    • Be more specific in catching exceptions, e.g., catching YAMLException for yaml.load().
    • Consider logging or handling the exception to provide better feedback to users.
  2. Performance Optimization:

    • For large YAML files, parsing the entire document may be slow. Consider optimizing for performance.
  3. Regex Patterns:

    • Regular expressions can be improved for matching package names to handle more complex cases like special characters.
  4. Error Handling:

    • Provide meaningful error messages for potential issues like malformed YAML or incorrect file formats.
  5. Documentation:

    • Include inline code documentation explaining function purposes, parameters, and return values where necessary.
    • Add comments for complex logic to enhance code readability.
  6. Unit Testing:

    • Write unit tests to cover various scenarios, ensuring the functionality works as expected.
  7. Security:

    • Ensure input validation is robust to prevent injection attacks using user-provided YAML content.
  8. Dependency Updates:

    • Regularly update dependencies like js-yaml, vscode, etc., to keep up with security patches and improvements.
  9. Performance Enhancement:

    • Consider using asynchronous operations to prevent UI freezes while processing large YAML files.
  10. Refactoring:

    • Splitting the logic into smaller functions might improve readability and maintainability.
  11. Environment Variable for Base URLs:

    • Instead of hardcoding the base URLs, consider using environment variables for flexibility.

Overall, the code looks robust and provides a valuable feature for linking package names in YAML files. Enhancements can further improve its performance, reliability, and user experience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant