Skip to content

release 1.1.2#3

Merged
SeanDictionary merged 2 commits intomainfrom
dev
Nov 5, 2025
Merged

release 1.1.2#3
SeanDictionary merged 2 commits intomainfrom
dev

Conversation

@SeanDictionary
Copy link
Owner

[1.1.2] - 2025-11-05

Fixed

Changed

  • Using sage -python to start LSP server #2

Added

  • Add .vscode for development

@SeanDictionary SeanDictionary merged commit b36bc66 into main Nov 5, 2025
1 check passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes LSP initialization issues and updates the project structure. The main purpose is to resolve GitHub issues #1 and #2, specifically using sage -python to start the LSP server and fixing venv creation logic.

Key changes:

  • Modified LSP venv creation to use sage -python from the conda environment instead of system Python
  • Fixed LSP startup flow to handle venv creation failures properly
  • Reorganized documentation files from readmes/ to docs/ directory

Reviewed Changes

Copilot reviewed 8 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/server/requirements.txt Changed pygls version constraint from >=1.3.1 to exact version ==1.3.1
src/extension.ts Refactored LSP initialization logic: moved functions after command setup, added conda environment path requirement for venv creation, fixed cleanup using rmSync, improved error handling
package-lock.json Updated lockfile format from v3 to v1, bumped version to 1.1.1, updated dependencies (@types/node, @types/vscode, undici-types, semver)
docs/SemanticHighlighting-zh-CN.md Added Chinese documentation for known semantic highlighting bugs
docs/SemanticHighlighting-en.md Added English documentation for known semantic highlighting bugs
docs/README-zh-CN.md Added Chinese README with project overview and installation instructions
docs/CONTRIBUTING.md Added build instructions for contributors
README.md Updated documentation paths from readmes/ to docs/
CHANGELOG.md Added version 1.1.2 changelog entry documenting fixes and changes
.vscode/tasks.json Added VSCode tasks configuration for development
.vscode/settings.json Added VSCode workspace settings
.vscode/launch.json Added VSCode debug launch configuration
.gitignore Removed .vscode from gitignore to include development configurations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +133 to +141
function createEnvLSP(envLSPpath: string, requirementsPath: string): Promise<void> {
return new Promise((resolve, reject) => {
const pythonCommand = process.platform === 'win32' ? 'python' : 'python3';
const condaEnvPath = vscode.workspace.getConfiguration('sagemath-for-vscode.sage').get<string>('condaEnvPath');
while (!condaEnvPath) {
vscode.commands.executeCommand('sagemath-for-vscode.selectCondaEnv');
}
console.log(`Using Conda Env Path: ${condaEnvPath}`);

Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

This while loop creates an infinite blocking loop. executeCommand is asynchronous and doesn't wait for user input. The loop will spin indefinitely without allowing the user to select an environment. Consider using an await with proper async handling or prompting the user and rejecting the promise if no environment is selected.

Suggested change
function createEnvLSP(envLSPpath: string, requirementsPath: string): Promise<void> {
return new Promise((resolve, reject) => {
const pythonCommand = process.platform === 'win32' ? 'python' : 'python3';
const condaEnvPath = vscode.workspace.getConfiguration('sagemath-for-vscode.sage').get<string>('condaEnvPath');
while (!condaEnvPath) {
vscode.commands.executeCommand('sagemath-for-vscode.selectCondaEnv');
}
console.log(`Using Conda Env Path: ${condaEnvPath}`);
async function createEnvLSP(envLSPpath: string, requirementsPath: string): Promise<void> {
const pythonCommand = process.platform === 'win32' ? 'python' : 'python3';
let condaEnvPath = vscode.workspace.getConfiguration('sagemath-for-vscode.sage').get<string>('condaEnvPath');
if (!condaEnvPath) {
await vscode.commands.executeCommand('sagemath-for-vscode.selectCondaEnv');
condaEnvPath = vscode.workspace.getConfiguration('sagemath-for-vscode.sage').get<string>('condaEnvPath');
if (!condaEnvPath) {
throw new Error('No Conda environment selected.');
}
}
console.log(`Using Conda Env Path: ${condaEnvPath}`);
return new Promise((resolve, reject) => {

Copilot uses AI. Check for mistakes.
// If LSP enabled
const useLSP = vscode.workspace.getConfiguration('sagemath-for-vscode.LSP').get<boolean>('useSageMathLSP', true);
if (!useLSP) {
vscode.window.showInformationMessage('SageMath Language Server is disabled. Please enable it in settings and restart extnsion to use LSP features.');
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

Corrected spelling of 'extnsion' to 'extension'.

Suggested change
vscode.window.showInformationMessage('SageMath Language Server is disabled. Please enable it in settings and restart extnsion to use LSP features.');
vscode.window.showInformationMessage('SageMath Language Server is disabled. Please enable it in settings and restart extension to use LSP features.');

Copilot uses AI. Check for mistakes.
await createEnvLSP(envLSPpath, requirementsPath);
vscode.window.showInformationMessage('✅ Python venv created.');
} catch (err) {
vscode.window.showErrorMessage(`❌ Failed to creat Python venv: \n${err}`);
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

Corrected spelling of 'creat' to 'create'.

Suggested change
vscode.window.showErrorMessage(`❌ Failed to creat Python venv: \n${err}`);
vscode.window.showErrorMessage(`❌ Failed to create Python venv: \n${err}`);

Copilot uses AI. Check for mistakes.
}

const envs: { name: string; path: string }[] = [{ "name": "Global Environment", "path": "" }];
const globalEnv = { "name": "Global Environment", "path": "" };
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

The globalEnv variable is defined but never used. It appears to have been removed from the environments array but the variable declaration remains. Either remove this unused variable or add it back to the envs array if it was removed by mistake.

Suggested change
const globalEnv = { "name": "Global Environment", "path": "" };

Copilot uses AI. Check for mistakes.
}
console.log(`Using Conda Env Path: ${condaEnvPath}`);

exec(`${condaEnvPath}/bin/sage -python -m venv ${envLSPpath}`, (error, stdout, stderr) => {
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

The condaEnvPath and envLSPpath variables are used directly in a shell command without proper escaping or validation. If these paths contain spaces or special shell characters, the command could fail or behave unexpectedly. Consider using proper shell escaping or passing arguments in array form if the exec API supports it.

Copilot uses AI. Check for mistakes.
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.

Bug pygls2.0.0 Incompatible

2 participants