From 742788efa3c0ad2b24898c8034328da242859991 Mon Sep 17 00:00:00 2001 From: max Date: Tue, 8 Sep 2026 18:53:22 +0200 Subject: [PATCH] Opaque panel header and toolbar; explain empty results The theme's table header colour is a translucent tint, so rows scrolling underneath made the column bar unreadable. Paint it over the solid editor background. An empty search now asks the .NET Solution Launcher which projects the language server loaded and says so, with a reload button, instead of a bare "No references found". Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_0169iPWwKHZoBTNN9qwXiwqk --- README.md | 7 +++++++ media/panel.css | 9 ++++++++- src/extension.ts | 41 ++++++++++++++++++++++++++++++++++++++++- 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e91efd4..f5b922f 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,13 @@ nothing waits on it. The panel gets the same token *types* but paints them from webview is not given the theme’s token colours. Set `coloredReferences.semanticTokens` to `false` for grammar-only colouring; results spanning more than 40 files skip it. +## When nothing is found + +"No references" can mean the language server never indexed the project. If the +*.NET Solution Launcher* extension is installed, an empty result asks it which projects +DotRush has loaded and says so — "the language server has not loaded MyGame.Runtime" — +with a *Reload Workspace* button, instead of a plain "No references found". + ## Settings - `coloredReferences.view` — which view `Find All References (Colored)` opens: `document` (default) or `panel` diff --git a/media/panel.css b/media/panel.css index c4d6d61..1d9c06d 100644 --- a/media/panel.css +++ b/media/panel.css @@ -40,6 +40,8 @@ body { padding: 4px 8px; border-bottom: 1px solid var(--vscode-panel-border, transparent); flex: 0 0 auto; + /* Solid: rows scroll underneath, and a see-through bar over code is unreadable. */ + background: var(--vscode-editor-background); } #summary { @@ -112,7 +114,12 @@ body { display: grid; grid-template-columns: var(--grid); height: var(--header-height); - background: var(--vscode-keybindingTable-headerBackground, var(--vscode-editor-background)); + /* The theme's header colour is usually a translucent tint, so it is painted over the + solid editor background; otherwise rows scrolling underneath show through it. */ + background-color: var(--vscode-editor-background); + background-image: linear-gradient( + var(--vscode-keybindingTable-headerBackground, transparent), + var(--vscode-keybindingTable-headerBackground, transparent)); border-bottom: 1px solid var(--vscode-panel-border, var(--vscode-editorWidget-border)); user-select: none; } diff --git a/src/extension.ts b/src/extension.ts index 3acdd59..2e26ac6 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -276,12 +276,51 @@ interface SearchTarget { view?: View; } +/** Shape of the launcher's `dotnetSolution.languageServerStatus` answer. */ +interface LanguageServerStatus { + loaded: string[]; + missing: string[]; + foreign: string[]; + unavailable: boolean; +} + +/** + * "No references" means one of two things: there are none, or the language server never + * indexed the project. The .NET Solution Launcher, when installed, knows which projects + * DotRush reported loaded; ask it so the second case is not mistaken for the first. + */ +async function explainEmptyResult(symbol: string): Promise { + let status: LanguageServerStatus | undefined; + try { + const commands = await vscode.commands.getCommands(true); + if (commands.includes('dotnetSolution.languageServerStatus')) { + status = await vscode.commands.executeCommand('dotnetSolution.languageServerStatus'); + } + } catch { + status = undefined; + } + if (!status || status.unavailable || (status.missing.length === 0 && status.foreign.length === 0)) { + vscode.window.setStatusBarMessage(`No references found for '${symbol}'`, 4000); + return; + } + const why = status.missing.length + ? `the language server has not loaded ${status.missing.join(', ')}` + : `the language server loaded projects outside this solution (${status.foreign.join(', ')})`; + const choice = await vscode.window.showWarningMessage( + `No references found for '${symbol}' — ${why}.`, 'Reload Workspace', 'Show Status'); + if (choice === 'Reload Workspace') { + await vscode.commands.executeCommand('dotnetSolution.languageServerReload'); + } else if (choice === 'Show Status') { + await vscode.commands.executeCommand('dotnetSolution.languageServerMenu'); + } +} + async function runSearch( origin: Origin, languageId: string, symbol: string, target: SearchTarget = {}, ): Promise { const locations = await findReferences(origin, symbol); if (locations.length === 0) { - vscode.window.setStatusBarMessage(`No references found for '${symbol}'`, 4000); + await explainEmptyResult(symbol); return; }