SageMath Enhanced for VS Code
English | 中文
Enhance your SageMath coding experience in Visual Studio Code with the SageMath Enhanced extension. This extension provides advanced features and integrations, making it easier and more efficient to work with SageMath in VS Code.
Features
- Run SageMath Code: Directly execute
.sage
files from the editor with a simple click.
- Syntax Highlighting: Enjoy enhanced syntax highlighting tailored for SageMath-specific operations and functions.
- Integrated Terminal: Interact with SageMath directly within VS Code's integrated terminal.
- Automatic
.sage.py
File Cleanup: Automatically deletes the temporary .sage.py
file generated after running a SageMath script, keeping your workspace clean.
- WSL Support(Fixing): For Windows users, run SageMath scripts inside the Windows Subsystem for Linux (WSL) for improved compatibility and performance.
👆🏻 the Run SageMath File button, 👇🏻 Demo video
https://github.com/n-WN/sagemath-vscode-enhanced/assets/30841158/2a8d5cea-8c21-4886-8e18-b48893691fe4
Quick Start
- Installation: Install the SageMath Enhanced extension from the VS Code Marketplace.
- Opening Sage Files: Open any
.sage
file or create a new one in VS Code.
- Running Code: Use the command palette (
Ctrl+Shift+P
/ Cmd+Shift+P
) and type Run SageMath File
to execute your script.
- Viewing Output: Check the integrated terminal for your script's output and any error messages.
Installation
Follow these steps to install the SageMath Enhanced extension:
- Launch VS Code.
- Press
Ctrl+P
(Cmd+P
on macOS) to open the Quick Open dialog.
- Type
ext install sagemath-enhanced
and press Enter.
- Find the SageMath Enhanced extension in the search results and click the
Install
button.
Usage
Using the SageMath Enhanced extension is simple and intuitive, providing a seamless experience for SageMath coding within VS Code.
Opening and Running SageMath Files
- Opening a Sage File: Open your
.sage
file in VS Code, or create a new one by selecting File > New File
and saving it with the .sage
extension.
- Running the Code: Once a
.sage
file is open in the editor, you'll notice a Run SageMath File button (▶️ icon) in the editor's title bar. Clicking this button will execute the SageMath code in the currently active .sage
file.
- Automatic Cleanup: If enabled in the extension settings, the temporary
.sage.py
file generated during execution will be automatically deleted after the script finishes running.
- WSL Support: If you're on Windows and have WSL installed, the extension can run SageMath scripts inside WSL for enhanced compatibility.
Viewing Output
- Integrated Terminal: The output from your SageMath script, along with any errors or warnings, will be displayed in VS Code's integrated terminal. This allows for easy debugging and interaction with your code.
Requirements
Contributing
We welcome contributions to the SageMath Enhanced extension. Here's how you can contribute:
- Fork the repository on GitHub. You can find the repository at sagemath-vscode-enhanced.
- Create a new branch for your feature (
git checkout -b feature/YourFeature
).
- Commit your changes (
git commit -am 'Add some YourFeature'
).
- Push to the branch (
git push origin feature/YourFeature
).
- Create a new Pull Request on GitHub against the
sagemath-vscode-enhanced
repository.
Support and Feedback
If you encounter any issues or have suggestions for improvements, please file an issue on the GitHub repository.
License
This project is licensed under the AGPL-3.0 License - see the LICENSE file for details.
TODO (Also Known As "Need Help")
- [ ] Code Completion: Enhance code completion for SageMath-specific syntax.
- [ ] Interactive Plots: Enable rendering of interactive SageMath plots within VS Code.
- [ ] Documentation Integration: Provide direct access to SageMath documentation via hover tooltips.
- [ ] Performance Optimization: Improve startup time and responsiveness of the extension.
- [ ] Customizable Settings: Introduce settings to customize the extension's behavior according to user preferences.
- [ ] Error Highlighting: Provide immediate feedback on syntax errors and computational exceptions to streamline the coding process.
- [ ] Indentation and Autocomplete: Currently, there might be issues with indentation shortcuts and the inability to autocomplete brackets and quotes. These advanced editing features might require the implementation or integration of a language server.
Acknowledgements
- Special thanks to the SageMath community for their invaluable resources and support.