You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+81-14Lines changed: 81 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,13 +29,27 @@ Enhance your SageMath coding experience in Visual Studio Code with the SageMath
29
29
30
30
## Features
31
31
32
-
-**Run SageMath Code**: Directly execute `.sage` files from the editor with a simple click.
33
-
-**Syntax Highlighting**: Enjoy enhanced syntax highlighting tailored for SageMath-specific operations and functions.
34
-
-**Integrated Terminal**: Interact with SageMath directly within VS Code's integrated terminal.
35
-
-**Automatic `.sage.py` File Cleanup**: Automatically deletes the temporary `.sage.py` file generated after running a SageMath script, keeping your workspace clean.
36
-
-**WSL Support(Fixing)**: For Windows users, run SageMath scripts inside the Windows Subsystem for Linux (WSL) for improved compatibility and performance.
37
-
38
-
*👆🏻 the Run SageMath File button, 👇🏻 Demo video*
32
+
-**Language Server Protocol (LSP) Support**: Complete LSP implementation providing advanced language features
33
+
-**Intelligent Code Completion**: Context-aware autocompletion for SageMath functions, classes, and methods
34
+
-**Hover Documentation**: Instant documentation and type information on hover
35
+
-**Syntax Highlighting**: Comprehensive syntax highlighting for SageMath-specific constructs including:
36
+
- Ring and field declarations (ZZ, QQ, RR, CC, GF, etc.)
37
+
- Polynomial rings and generators
38
+
- Mathematical functions and operators
39
+
- Linear algebra operations
40
+
- Plotting and visualization functions
41
+
- Number theory and combinatorics functions
42
+
- Cryptographic functions
43
+
- Graph theory constructs
44
+
-**Code Snippets**: Pre-built code snippets for common SageMath patterns
45
+
-**Enhanced Language Configuration**: Improved indentation, bracket matching, and auto-closing pairs
46
+
-**Script Execution**: Run SageMath files directly from the editor
47
+
-**Automatic Cleanup**: Optional removal of generated `.sage.py` files
48
+
-**WSL Support**: Enhanced Windows Subsystem for Linux compatibility
49
+
-**Diagnostics**: Real-time error detection and syntax validation
50
+
-**Server Management**: Restart language server command for troubleshooting
51
+
52
+
*The Run SageMath File button (shown above), demo video below*
@@ -59,17 +73,63 @@ Follow these steps to install the SageMath Enhanced extension:
59
73
60
74
Using the SageMath Enhanced extension is simple and intuitive, providing a seamless experience for SageMath coding within VS Code.
61
75
76
+
### Language Server Features
77
+
78
+
The extension now includes a full Language Server Protocol implementation providing:
79
+
80
+
-**Code Completion**: Press `Ctrl+Space` (or `Cmd+Space` on macOS) to trigger intelligent autocompletion
81
+
-**Hover Information**: Hover over SageMath functions to see documentation
82
+
-**Snippet Support**: Type snippet prefixes like `var`, `matrix`, `plot` and press Tab to expand
83
+
-**Real-time Diagnostics**: Get immediate feedback on syntax errors
84
+
62
85
### Opening and Running SageMath Files
63
86
64
87
1.**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.
65
-
2.**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.
88
+
2.**Running the Code**: Once a `.sage` file is open in the editor, you'll notice a **Run SageMath File** button (play icon) in the editor's title bar. Clicking this button will execute the SageMath code in the currently active `.sage` file.
66
89
3.**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.
67
90
4.**WSL Support**: If you're on Windows and have WSL installed, the extension can run SageMath scripts inside WSL for enhanced compatibility.
68
91
92
+
### Language Server Management
93
+
94
+
-**Restart Server**: Use the Command Palette (`Ctrl+Shift+P`) and search for "Restart SageMath Language Server" if you encounter any language server issues.
95
+
96
+
### Available Code Snippets
97
+
98
+
The extension includes numerous code snippets for common SageMath patterns:
99
+
100
+
-`var` - Create symbolic variables
101
+
-`matrix` - Create matrices
102
+
-`plot` - Plot functions
103
+
-`solve` - Solve equations
104
+
-`factor` - Factor expressions
105
+
-`integrate` - Compute integrals
106
+
-`diff` - Take derivatives
107
+
- And many more...
108
+
69
109
### Viewing Output
70
110
71
111
-**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.
72
112
113
+
## Configuration
114
+
115
+
The extension provides several configuration options to customize your SageMath development experience:
116
+
117
+
### Basic Settings
118
+
119
+
-`sagemathEnhanced.interpreterPath`: Path to the SageMath interpreter (default: "sage")
-`sagemathEnhanced.maxNumberOfProblems`: Maximum number of diagnostic problems shown (default: 100)
129
+
-`sagemathEnhanced.logLevel`: Language server log level (default: "info")
130
+
131
+
You can configure these settings in your VS Code settings (File > Preferences > Settings) by searching for "SageMath Enhanced".
132
+
73
133
## Requirements
74
134
75
135
-[Visual Studio Code](https://code.visualstudio.com/) version 1.76.0 or higher.
@@ -95,13 +155,20 @@ This project is licensed under the AGPL-3.0 License - see the [LICENSE](LICENSE)
95
155
96
156
## TODO (Also Known As "Need Help")
97
157
98
-
-[ ]**Code Completion**: Enhance code completion for SageMath-specific syntax.
158
+
-[x]**Code Completion**: Enhanced code completion for SageMath-specific syntax implemented via LSP.
159
+
-[x]**Syntax Highlighting**: Comprehensive syntax highlighting for SageMath operations and functions.
160
+
-[x]**Error Highlighting**: Real-time diagnostic feedback on syntax errors and computational exceptions.
161
+
-[x]**Language Server Protocol**: Full LSP implementation with hover, completion, and diagnostics.
162
+
-[x]**Code Snippets**: Pre-built snippets for common SageMath patterns.
99
163
-[ ]**Interactive Plots**: Enable rendering of interactive SageMath plots within VS Code.
100
-
-[ ]**Documentation Integration**: Provide direct access to SageMath documentation via hover tooltips.
101
-
-[ ]**Performance Optimization**: Improve startup time and responsiveness of the extension.
102
-
-[ ]**Customizable Settings**: Introduce settings to customize the extension's behavior according to user preferences.
103
-
-[ ]**Error Highlighting**: Provide immediate feedback on syntax errors and computational exceptions to streamline the coding process.
104
-
-[ ]**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.
164
+
-[ ]**Documentation Integration**: Enhanced hover tooltips with comprehensive SageMath documentation.
165
+
-[ ]**Performance Optimization**: Further improve startup time and responsiveness of the extension.
166
+
-[ ]**Advanced Diagnostics**: Deep integration with SageMath for semantic error checking.
167
+
-[ ]**Refactoring Support**: Code refactoring capabilities for SageMath symbols.
168
+
-[ ]**Debugging Support**: Step-through debugging for SageMath scripts.
169
+
-[ ]**Notebook Integration**: Support for SageMath notebooks (.ipynb with SageMath kernel).
170
+
171
+
The extension now provides a solid foundation with proper LSP architecture. Future enhancements will focus on deeper SageMath integration and advanced IDE features.
105
172
106
173
<!-- For the issues with indentation and autocomplete, if they cannot be resolved through simple configuration changes, it might indeed necessitate the assistance of a more sophisticated language server (such as implementing a Language Server Protocol server specifically for SageMath) to provide advanced support similar to what Pylance does for Python. This could involve a significant development effort, including a deep understanding of SageMath syntax and features, as well as integration with VS Code's language server APIs. -->
0 commit comments