-
-
Notifications
You must be signed in to change notification settings - Fork 228
Reload content of output view when VS Code is reloaded #2868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for calva-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Close #2827
There was a problem hiding this 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 ensures that the output view’s content is correctly reloaded when VS Code is reloaded, preserving the scroll position and reinitializing copy buttons. Key changes include:
- Registering a webview serializer to persist and restore the output view state.
- Updating message keys from :content to more specific names (like :code-theme and :output) and renaming the webview panel identifier.
- Revising tests and configuration files to reflect the new implementation.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/extension.ts | Imports and calls the new registerOutputViewWebviewSerializer function. |
src/cljs-lib/test/calva/repl/webview/core_test.cljs | Updates expected keys in messages and error texts in tests. |
src/cljs-lib/src/calva/repl/webview/ui.cljs | Adjusts DOM interaction functions, scroll behavior, and theming; adds new helper functions. |
src/cljs-lib/src/calva/repl/webview/core.cljs | Centralizes webview panel initialization and message dispatch with updated keys. |
shadow-cljs.edn, package.json, CHANGELOG.md | Reflect registry and configuration changes for the updated output view. |
Comments suppressed due to low confidence (2)
src/cljs-lib/src/calva/repl/webview/core.cljs:176
- The webview panel identifier has been changed from 'calva:repl-output' to 'calva.output-view'. Ensure that this naming change is consistently updated throughout the project and in any related documentation.
"calva.output-view"
src/cljs-lib/src/calva/repl/webview/core.cljs:234
- The message key has been updated from ':content' to ':output'. Please verify that all message handlers and corresponding tests are updated to reflect this change consistently.
:output message})
(js/scrollTo x y)) | ||
|
||
(defn restore-copy-buttons | ||
"Re-initializes copy buttons from CopyButtonPlugin (highlightjs-copy - highlight.js plugin) so they they look |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a duplicate word ('they they') in the docstring for restore-copy-buttons. Please remove the duplicated word for clarity.
"Re-initializes copy buttons from CopyButtonPlugin (highlightjs-copy - highlight.js plugin) so they they look | |
"Re-initializes copy buttons from CopyButtonPlugin (highlightjs-copy - highlight.js plugin) so they look |
Copilot uses AI. Check for mistakes.
@@ -61,7 +61,8 @@ | |||
"workspaceContains:**/project.clj", | |||
"workspaceContains:**/shadow-cljs.edn", | |||
"workspaceContains:**/deps.edn", | |||
"onDebugResolve:type" | |||
"onDebugResolve:type", | |||
"onWebviewPanel:calva.output-view" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this? Not saying we don't, just wondering why =)
What has changed?
getState
andsetState
API is used, which will also provides a foundation for persisting contents between closing and reopening the output view without reloading VS Code. This work will be done in another PR.Fixes #2827
Todo
"after:highlightElement"
function that highlightjs will call after highlighting an element.hljs-copy-container
and then ran highlightAll.Uncaught TypeError: Cannot read properties of undefined (reading '__vscode_post_message__')
My Calva PR Checklist
I have:
dev
branch. (Or have specific reasons to target some other branch.)published
. (Sorry for the nagging.)[Unreleased]
entry inCHANGELOG.md
, linking the issue(s) that the PR is addressing.[ ] Figured if anything about the fix warrants tests on Mac/Linux/Windows/Remote/Whatever, and either tested it there if so, or mentioned it in the PR.[ ] Added to or updated docs in this branch, if appropriatenpm run prettier-format
)npm run eslint
before creating your PR, or runnpm run eslint-watch
to eslint as you go).