Skip to content

Added visual loading indicator for vscode extension - #817

Merged
will-lamerton merged 24 commits into
Nano-Collective:mainfrom
Kartik-2239:visual-loader
Aug 13, 2026
Merged

will-lamerton merged 24 commits into
Nano-Collective:mainfrom
Kartik-2239:visual-loader

Conversation

@Kartik-2239

@Kartik-2239 Kartik-2239 commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

… loader for extension

Description

This PR adds a small visual loading indicator for the chat ui in vscode extension in the ui (#804 ), it adds a wrapper div and uses css animation. It appears on sending a message and disappears right before the first chunk of response or stopping or error.

Screen.Recording.2026-08-07.at.5.10.27.PM.mov

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Changeset

  • Added a changeset (pnpm changeset) describing this change for the changelog

Docs-only or internal chores need no changeset (or run pnpm changeset --empty to note that intentionally).

Testing

Automated Tests

  • New features include passing tests in .spec.ts/tsx files
  • All existing tests pass (pnpm test:all completes successfully)
  • Tests cover both success and error scenarios

It only uses the DOM so no tests added.

Manual Testing

  • Tested with Ollama
  • Tested with OpenRouter
  • Tested with OpenAI-compatible API
  • Tested MCP integration (if applicable)

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (if needed)
  • No breaking changes (or clearly documented)
  • Appropriate logging added using structured logging (see CONTRIBUTING.md)

Copilot AI lite review requested due to automatic review settings August 7, 2026 12:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a lightweight “thinking”/loading indicator to the VS Code extension webview chat UI so users get immediate feedback after submitting a message while waiting for the agent to respond.

Changes:

  • Introduces a new visualLoader element that is appended after sending a user message.
  • Adds startVisualLoader() to render a 3-dot animated indicator.
  • Removes the loader when the first agent text chunk is appended.
Suppressed comments (1)

plugins/vscode/media/chat-panel.js:335

  • The visual loader is only removed in appendChunk(). If the backend emits non-text updates first (e.g. tool_call, tool_call_update, plan, agent_thought_chunk) or if the user cancels before the first text chunk arrives, the loader can remain visible indefinitely (and can appear above tool cards / thought UI).

To match the PR/issue description (“removed instantly when the first text token or tool call is received, or on stop/error”), consider extracting a stopVisualLoader() helper and calling it from the non-text update handlers (e.g. handleToolCallUpdate, handlePlanUpdate, agent_thought_chunk) and when processing stops/cancels (e.g. setProcessing(false) / cancellation path).

	function appendChunk(textChunk) {
		// Remove welcome message and loader if present
		const welcome = document.querySelector('.welcome-message');
		if (welcome) welcome.remove();
		const loader = document.getElementById('session-loader');
		if (loader) loader.remove();
		if (visualLoader) {
			visualLoader.remove();
			visualLoader = null;
		}

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

Comment on lines +310 to +324
function startVisualLoader() {
const wrapper = document.createElement('div');
wrapper.className = "group flex flex-row gap-1 min-w-0 shrink-0 self-start items-start max-w-full";
const delays = [-0.3, -0.15, 0.0];
for (let i = 0; i < 3; i++) {
const dot = document.createElement('div');
dot.className = `h-1 w-1 rounded-full bg-white animate-bounce`;
dot.style.animationTimingFunction = 'ease-in-out';
dot.style.animationDelay = `${delays[i]*5}s`
wrapper.appendChild(dot);
}
visualLoader = wrapper;
messagesContainer.appendChild(wrapper);
scrollToBottom();
}
@akramcodez

Copy link
Copy Markdown
Member

Hey @Kartik-2239, thanks for the this! It looks good, but we're aiming for something a bit more unique that feels like NanoCoder. As mentioned in the issue, we'd prefer a loading animation built around the NC logo or branding rather than a comman one. That would make the experience feel more recognizable and consistent with NanoCoder's identity.

@Kartik-2239

Kartik-2239 commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor Author

Oh alright i was actually a little confused by it because i didn't know how exactly to implement a loading animation around the logo, should i use an svg? or something like that?
nevermind i got it

@Kartik-2239

Copy link
Copy Markdown
Contributor Author

Hey @akramcodez,
I made some changes and tried to make it use the given icon.svg with a pulse effect.
I would like to get your feedback if I should make any more changes.
Thanks

nanocoder-loading-spinner.mov

@akramcodez

Copy link
Copy Markdown
Member

Thanks, @Kartik-2239! Everything looks perfect. Could you just add a changeset? Other than that, everything looks good to me.

@Kartik-2239

Copy link
Copy Markdown
Contributor Author

Done, thanks

akramcodez
akramcodez previously approved these changes Aug 8, 2026

@akramcodez akramcodez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM again great work @Kartik-2239

@will-lamerton

Copy link
Copy Markdown
Member

Hey @Kartik-2239 - thanks for this, the loader is a nice addition and the video looks great. A few things to fix before merge:

1. CSP regression. The new img-src {{cspSource}} is a second img-src directive, and CSP ignores every duplicate after the first, so the original 'self' data: https: vscode-webview-resource: list is dropped. The chat panel renders attachments from data URIs (chat-panel.js:359, :387, :642), so image previews and the modal break. Please merge {{cspSource}} into the single existing img-src rather than adding a second one.

2. The loader is only removed in appendChunk. That covers the first agent text chunk, but not the stop button (:245), prompt_response/done with no text (:1003), errors delivered via appendMessage, or case 'clear' (which leaves visualLoader pointing at a detached node). Easiest fix is a stopVisualLoader() helper called from setProcessing(false) as well.

3. Double loaders when queueing. startVisualLoader() is called outside the if (!isProcessing) guard at :470, so sending a second message mid-turn appends another wrapper and orphans the first. Either move it inside the guard or clear any existing loader first.

Suggestion: consider inlining the icon into the ICONS map like every other icon in this file instead of fetching icon.svg at runtime. That removes the need for the connect-src change (and most of the CSP edit), the duplicated fetch, and the race between the top-level fetch and the fallback inside startVisualLoader.

Smaller notes:

  • media/chat-panel.css is a checked-in Tailwind build and doesn't contain animate-pulse, gap-1.5, or the [&_svg]:w-6/h-6 variants yet, so the pulse is invisible until someone runs pnpm run build. Worth regenerating it in this PR.
  • The loader is appended to messagesContainer, so tool cards and thought boxes land below it and it ends up stranded mid-transcript until the first text chunk.
  • startVisualLoader(); at :470 is space-indented, and there's a }else{ plus a missing semicolon in the new function. Biome skips plugins/, so these need fixing by hand.
  • Changeset is minor; comparable VS Code UI features have shipped as patch (see add-vscode-copy-button.md). Also small typo: "nancoder".

… nanocoder and better handling of visual loader
@Kartik-2239

Copy link
Copy Markdown
Contributor Author

Hey @will-lamerton, thanks for going through the changes.
I have made the necessary changes accordingly.

  • regenerated the css
  • removed connect-src and img-src (duplicate)
  • starting and stopping of visualLoader according to the given review fixes.
  • and fixed the changeset

@akramcodez

Copy link
Copy Markdown
Member

Hey @Kartik-2239, this PR still has conflicts. Can you fix them?

@Kartik-2239

Copy link
Copy Markdown
Contributor Author

Hey @akramcodez i fixed the conflicts. It was the css since it was regenerated, i didn't see it before sorry for that

@akramcodez

Copy link
Copy Markdown
Member

Thanks for the updates @Kartik-2239! Almost everything is looking perfect.

There's just one tiny detail left from Will's review: in startVisualLoader(), the loader wrapper is still being appended directly to messagesContainer. This causes tool cards and thought boxes to render below the loader when they arrive before the text, leaving the loader stranded mid-transcript.

Could you update it so it gets appended to the active turn element instead (or similar) so it stays at the bottom? Let me know if you need any help with that!

@Kartik-2239

Kartik-2239 commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Hey @akramcodez,
The original issue said the spinner should disappear once first chunk is printed or a tool call is made.
And i implemented this, it doesn't look that good.

I did this by appending the same loader (saved as visualLoader) at the end of handleAcpUpdate so it pushes the spinner at the end after every update.

Screen.Recording.2026-08-11.at.11.08.10.PM.mov

@will-lamerton

Copy link
Copy Markdown
Member

Hey @Kartik-2239 - love this. I think the only thing I don't like is that the NC logo stays showing as text and tools stream. I think as you said, once the first token streams, the loading indicator should disappear. What do you think?

- Implemented a new method to rename sessions in the ACP client and updated the corresponding webview provider to handle rename requests.
- Enhanced session data structure to include an `updatedAt` timestamp for better session management.
- Modified the chat panel to display relative time for the last session update.
- Updated session management logic to prevent auto-derived titles from overwriting user-defined titles.
- Added UI elements for editing session titles in the chat panel, including input handling for renaming sessions.
arpan7sarkar and others added 14 commits August 12, 2026 18:02
… dependency in this repo, already the established pattern in 5+ other spec files (streaming-reasoning.spec.tsx etc.). Verified it passes both with and without FORCE_COLOR set.
- styled-select-input.spec.tsx: strip ANSI codes before matching output.
  CI sets FORCE_COLOR=1, so Ink renders real color codes and the "> "
  indicator regex no longer matches the start of the line
- user-input.spec.tsx: add missing unmount() to 18 tests that rendered
  and never tore down. AVA runs a file's tests concurrently, so these
  piled up and starved later tests under CI's more limited CPU
@will-lamerton

Copy link
Copy Markdown
Member

Looking great. Thanks for this work @Kartik-2239 - feel free to add yourself as a contributor to our website via a PR which I will approve :)

https://nanocollective.org/contributors
https://github.com/Nano-Collective/organisation

@will-lamerton
will-lamerton merged commit cfec1a8 into Nano-Collective:main Aug 13, 2026
1 check passed
AryanNandanwar pushed a commit to AryanNandanwar/nanocoder that referenced this pull request Aug 13, 2026
)

* added a variable for visual loader and a function to start the visual loader for extension

* nancoder svg pulse effect as a visual loading indicator in vscode extension

* nancoder svg pulse effect as a visual loading indicator in vscode extension

* added a changeset for visual loading indicator

* regenerated css, removed connect-src and duplicate img-src and inline nanocoder and better handling of visual loader

* feat: add session renaming functionality and update session metadata

- Implemented a new method to rename sessions in the ACP client and updated the corresponding webview provider to handle rename requests.
- Enhanced session data structure to include an `updatedAt` timestamp for better session management.
- Modified the chat panel to display relative time for the last session update.
- Updated session management logic to prevent auto-derived titles from overwriting user-defined titles.
- Added UI elements for editing session titles in the chat panel, including input handling for renaming sessions.

* docs: added the changgset for vs code session renaming

* - Fix: strip ANSI codes before matching, using strip-ansi — already a dependency in this repo, already the established pattern in 5+ other spec files (streaming-reasoning.spec.tsx etc.). Verified it passes both with and without FORCE_COLOR set.

* fix: unrelated test flakiness in CI (color codes + unmounted renders)

- styled-select-input.spec.tsx: strip ANSI codes before matching output.
  CI sets FORCE_COLOR=1, so Ink renders real color codes and the "> "
  indicator regex no longer matches the start of the line
- user-input.spec.tsx: add missing unmount() to 18 tests that rendered
  and never tore down. AVA runs a file's tests concurrently, so these
  piled up and starved later tests under CI's more limited CPU

* Update status badges [skip ci]

* fix: summarize oversized git diffs

* fix: refine oversized git diffs

* chore: trigger CI re-run

* Update status badges [skip ci]

* visual loader stays at bottom and disappear on first text chunk

* rebuilt css

* syntax error fix

* had messed up conflicts in last merge

* add baack openPath and showError

---------

Co-authored-by: arpan <[email protected]>
Co-authored-by: GitHub Action <[email protected]>
Co-authored-by: RealBhupesh <[email protected]>
Co-authored-by: addyCooks <[email protected]>
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.

8 participants