Skip to content

Commit 9f10ffb

Browse files
billtiminestarks
andauthored
Add spinner and fix histogram spacing (#2245)
Used the VS Code loading spinner when busy https://github.com/user-attachments/assets/6c5c2dc4-7dbc-4eb4-8419-37df56878034 Also fixed the spacing at the bottom of this histogram: Before <img width="468" alt="image" src="https://github.com/user-attachments/assets/b336f171-e2f2-4128-aa28-90e0a6aa69e1" /> After <img width="469" alt="image" src="https://github.com/user-attachments/assets/14829faf-ddd9-4b12-9d76-cba6ff17859e" /> Also added the 'bash' language in code highlighting, as sometimes commands or plain text try to use this language (and the console was showing warnings if it wasn't registered). --------- Co-authored-by: Mine Starks <[email protected]>
1 parent fa22ddc commit 9f10ffb

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

vscode/src/copilot/webview/copilot.css

+8-4
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,13 @@ h1 {
3838
}
3939

4040
.status-indicator {
41-
height: 30px;
42-
font-weight: bold;
43-
text-align: right;
44-
font-size: smaller;
41+
display: flex;
42+
justify-content: flex-end;
43+
flex-wrap: wrap;
44+
align-content: center;
45+
height: 28px;
46+
font-style: italic;
47+
font-size: 0.9em;
4548
}
4649

4750
.input-textarea {
@@ -165,6 +168,7 @@ pre code {
165168

166169
.histogram-container {
167170
width: 100%;
171+
margin-bottom: 10px;
168172
}
169173

170174
/* If not specified it defaults to the 'pre code' default monospace font */

vscode/src/copilot/webview/copilot.tsx

+15-8
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import hljs from "highlight.js/lib/core";
2020
import CopyButtonPlugin from "highlightjs-copy";
2121
import "highlightjs-copy/styles/highlightjs-copy.css";
2222
import python from "highlight.js/lib/languages/python";
23+
import bash from "highlight.js/lib/languages/bash"; // Used sometimes for plain text
2324
import markdownIt from "markdown-it";
2425
import { useEffect, useRef } from "preact/hooks";
2526
import { Histogram, Markdown, setRenderer } from "qsharp-lang/ux";
@@ -34,9 +35,10 @@ import { WebviewApi } from "vscode-webview";
3435

3536
const vscodeApi: WebviewApi<ChatElement[]> = acquireVsCodeApi();
3637

37-
// Only include the Python and Q# languages so as not
38+
// Only include a small set of languages so as not
3839
// to bloat the code
3940
hljs.registerLanguage("python", python);
41+
hljs.registerLanguage("bash", bash);
4042
hljs.registerLanguage("qsharp", hlsjQsharp);
4143
hljs.addPlugin(new CopyButtonPlugin());
4244
const md = markdownIt("commonmark");
@@ -162,13 +164,18 @@ function ChatHistory({ model }: { model: ChatViewModel }) {
162164
function StatusIndicator({ status }: { status: Status }) {
163165
return (
164166
<div className="status-indicator">
165-
{status.status === "waitingAssistantResponse"
166-
? "🕒"
167-
: status.status === "executingTool"
168-
? "🕒 " + status.toolName
169-
: status.status === "assistantConnectionError"
170-
? "There was an error communicating with Azure Quantum Copilot. Please check your Internet connection and try again."
171-
: ""}
167+
{status.status === "waitingAssistantResponse" ? (
168+
<span class="codicon codicon-loading codicon-modifier-spin"></span>
169+
) : status.status === "executingTool" ? (
170+
<>
171+
<span>{status.toolName}&nbsp;</span>
172+
<span class="codicon codicon-loading codicon-modifier-spin"></span>
173+
</>
174+
) : status.status === "assistantConnectionError" ? (
175+
"There was an error communicating with Azure Quantum Copilot. Please check your Internet connection and try again."
176+
) : (
177+
""
178+
)}
172179
</div>
173180
);
174181
}

0 commit comments

Comments
 (0)