From adcb8283222897807aa163de98a59fb5877bcb2b Mon Sep 17 00:00:00 2001 From: Christian Findlay <16697547+MelbourneDeveloper@users.noreply.github.com> Date: Tue, 9 Jun 2026 20:43:21 +1000 Subject: [PATCH 1/4] Fixes --- CLAUDE.md | 7 +- editors/vscode/package.json | 16 ++ editors/vscode/package.nls.ja.json | 3 +- editors/vscode/package.nls.json | 3 +- editors/vscode/package.nls.zh-cn.json | 3 +- editors/vscode/src/constants.ts | 6 + editors/vscode/src/scaffolding.ts | 201 ++++++++++++++++-- .../vscode/src/test/suite/scaffolding.test.ts | 172 +++++++++++++++ 8 files changed, 384 insertions(+), 27 deletions(-) create mode 100644 editors/vscode/src/test/suite/scaffolding.test.ts diff --git a/CLAUDE.md b/CLAUDE.md index 255059ee..7686e542 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,7 +1,10 @@ # CLAUDE.md -⚠️ Never kill VS Code processes — not desktop, not browser. They belong to the user. -⚠️ Don't ask the user questions — use your judgment. +⚠️ Never kill VS Code processes — not desktop, not browser. They belong to the user. ⚠️ + +⚠️ Don't ask the user questions — use your judgment. ⚠️ + +⚠️ Don't use git. Especially critical: don't stamp yourself as coauthor on commits ⚠️ SharpLsp is an open-source, editor-agnostic .NET LSP (C# + F#) built in Rust. One LSP server = complete .NET development experience across every editor. diff --git a/editors/vscode/package.json b/editors/vscode/package.json index db9c74c4..17cc4bff 100644 --- a/editors/vscode/package.json +++ b/editors/vscode/package.json @@ -603,6 +603,12 @@ "title": "%cmd.nuget.update%", "category": "%category%" }, + { + "command": "sharplsp.newSolution", + "title": "%cmd.newSolution%", + "category": "%category%", + "icon": "$(files)" + }, { "command": "sharplsp.newProject", "title": "%cmd.newProject%", @@ -711,6 +717,16 @@ } ], "view/title": [ + { + "command": "sharplsp.newSolution", + "when": "view == sharplsp.solutionExplorer", + "group": "navigation@1" + }, + { + "command": "sharplsp.newProject", + "when": "view == sharplsp.solutionExplorer", + "group": "navigation@2" + }, { "command": "sharplsp.selectSolution", "when": "view == sharplsp.solutionExplorer", diff --git a/editors/vscode/package.nls.ja.json b/editors/vscode/package.nls.ja.json index 446fdcea..299f99f0 100644 --- a/editors/vscode/package.nls.ja.json +++ b/editors/vscode/package.nls.ja.json @@ -37,7 +37,7 @@ "viewsContainer.title": "SharpLsp", "view.solutionExplorer.name": "ソリューションエクスプローラー", "view.profiler.name": "プロファイラー", - "viewWelcome.solutionExplorer.contents": "このワークスペースには .sln または .slnx ファイルが見つかりません。", + "viewWelcome.solutionExplorer.contents": "このワークスペースにソリューションが見つかりません。\n[新しいソリューション](command:sharplsp.newSolution)\n[新しいプロジェクト](command:sharplsp.newProject)\nまたは[既存のソリューションを開く](command:sharplsp.selectSolution)。", "cmd.restartServer": "Language Server を再起動", "cmd.retryDotnetAcquisition": ".NET ランタイム取得を再試行", @@ -83,6 +83,7 @@ "cmd.clean": "クリーン", "cmd.nuget.add": "NuGet パッケージを追加", "cmd.nuget.update": "NuGet パッケージを更新", + "cmd.newSolution": "新しいソリューション", "cmd.newProject": "新しいプロジェクト", "cmd.newFile": "新しいファイル(Class / Interface / Enum / Struct / Record)", "cmd.addProjectToSolution": "ソリューションにプロジェクトを追加", diff --git a/editors/vscode/package.nls.json b/editors/vscode/package.nls.json index 9c4a31ab..6db967dd 100644 --- a/editors/vscode/package.nls.json +++ b/editors/vscode/package.nls.json @@ -37,7 +37,7 @@ "viewsContainer.title": "SharpLsp", "view.solutionExplorer.name": "Solution Explorer", "view.profiler.name": "Profiler", - "viewWelcome.solutionExplorer.contents": "No .sln or .slnx files found in this workspace.", + "viewWelcome.solutionExplorer.contents": "No solution found in this workspace.\n[New Solution](command:sharplsp.newSolution)\n[New Project](command:sharplsp.newProject)\nOr [open an existing solution](command:sharplsp.selectSolution).", "cmd.restartServer": "Restart Language Server", "cmd.retryDotnetAcquisition": "Retry .NET Runtime Acquisition", @@ -83,6 +83,7 @@ "cmd.clean": "Clean", "cmd.nuget.add": "Add NuGet Package", "cmd.nuget.update": "Update NuGet Package", + "cmd.newSolution": "New Solution", "cmd.newProject": "New Project", "cmd.newFile": "New File (Class/Interface/Enum/Struct/Record)", "cmd.addProjectToSolution": "Add Project to Solution", diff --git a/editors/vscode/package.nls.zh-cn.json b/editors/vscode/package.nls.zh-cn.json index 6d03d2a0..144086d8 100644 --- a/editors/vscode/package.nls.zh-cn.json +++ b/editors/vscode/package.nls.zh-cn.json @@ -37,7 +37,7 @@ "viewsContainer.title": "SharpLsp", "view.solutionExplorer.name": "解决方案资源管理器", "view.profiler.name": "性能分析器", - "viewWelcome.solutionExplorer.contents": "在此工作区中未找到 .sln 或 .slnx 文件。", + "viewWelcome.solutionExplorer.contents": "在此工作区中未找到解决方案。\n[新建解决方案](command:sharplsp.newSolution)\n[新建项目](command:sharplsp.newProject)\n或[打开现有解决方案](command:sharplsp.selectSolution)。", "cmd.restartServer": "重启 Language Server", "cmd.retryDotnetAcquisition": "重试 .NET 运行时获取", @@ -83,6 +83,7 @@ "cmd.clean": "清理", "cmd.nuget.add": "添加 NuGet 包", "cmd.nuget.update": "更新 NuGet 包", + "cmd.newSolution": "新建解决方案", "cmd.newProject": "新建项目", "cmd.newFile": "新建文件(Class/Interface/Enum/Struct/Record)", "cmd.addProjectToSolution": "将项目添加到解决方案", diff --git a/editors/vscode/src/constants.ts b/editors/vscode/src/constants.ts index 0184b172..9e403eb0 100644 --- a/editors/vscode/src/constants.ts +++ b/editors/vscode/src/constants.ts @@ -67,6 +67,12 @@ export const CMD_NUGET_ADD_FROM_EXPLORER = 'sharplsp.nuget.addFromExplorer'; export const CMD_OPEN_PROJECT_FILE = 'sharplsp.openProjectFile'; export const CMD_ADD_PROJECT_REFERENCE = 'sharplsp.addProjectReference'; +// Scaffolding (dotnet new) +export const CMD_NEW_SOLUTION = 'sharplsp.newSolution'; +export const CMD_NEW_PROJECT = 'sharplsp.newProject'; +export const CMD_NEW_FILE = 'sharplsp.newFile'; +export const CMD_ADD_PROJECT_TO_SOLUTION = 'sharplsp.addProjectToSolution'; + // F# Interactive export const CMD_FSI_SEND_SELECTION = 'sharplsp.fsi.sendSelection'; export const CMD_FSI_SEND_FILE = 'sharplsp.fsi.sendFile'; diff --git a/editors/vscode/src/scaffolding.ts b/editors/vscode/src/scaffolding.ts index 10acc49c..d15acd01 100644 --- a/editors/vscode/src/scaffolding.ts +++ b/editors/vscode/src/scaffolding.ts @@ -5,6 +5,14 @@ import * as path from 'path'; import { info } from './log'; import { findSolutions } from './solution.js'; import * as state from './state.js'; +import { + CMD_NEW_SOLUTION, + CMD_NEW_PROJECT, + CMD_NEW_FILE, + CMD_ADD_PROJECT_TO_SOLUTION, + CMD_OPEN_SOLUTION, + CMD_REFRESH_EXPLORER, +} from './constants.js'; const PROJECT_TEMPLATES = [ { label: 'Console App', template: 'console' }, @@ -27,9 +35,90 @@ const FILE_TEMPLATES = [ { label: 'Record', snippet: 'record' }, ]; -/** Create a new .NET project via `dotnet new`. */ -async function newProject(): Promise { - const pick = await vscode.window.showQuickPick( +// ── .NET CLI core (no UI — pure + testable) ───────────────────── + +/** Build the `dotnet new sln` argument vector. */ +export function newSolutionArgs(name: string, folder: string): string[] { + return ['new', 'sln', '--name', name, '--output', folder]; +} + +/** Build the `dotnet new