Skip to content
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

Preview improvements #793

Merged
merged 10 commits into from
Apr 28, 2024
Merged

Conversation

alcarney
Copy link
Member

@alcarney alcarney commented Apr 27, 2024

The PR contains a collection of improvements to previews in both the language server and the VSCode extension

  • The server will once again, automatically trigger a build if needed (Closes Server should build project before generating preview, if necessary #783)
  • The server will automatically react to changes in esbonio.preview.* options
  • If the client supports it, the server will send window/showDocument requests when previewing a file
  • The VSCode extension will now show a "No Content Found" message containing troubleshooting steps in the preview window, when appropriate
  • The VSCode extension now adds a button to the toolbar for markdown files that opens the preview pane

Following a similar pattern to the `SphinxClient`, we can make the
`WebviewServer` awaitable and accept its configuration in the init
method.

This then makes it easy to teardown and recreate "in the background"
when the configuration is changed, with code that requires it
automatically restarting the server by awaiting it.
Following a similar pattern to the `SphinxClient`, we can make the
`PreviewServer` awaitable and accept its configuration in the init
method.

This then makes it easy to teardown and recreate "in the background"
when the configuration is changed, with code that requires it
automatically restarting the server by awaiting it.
As well as being closer to the LSP specification, this allows the
server to request the client change the document that is being shown -
such as when the server port has been changed.
This allows the extension to intercept `window/showDocument` requests
and update the preview pane accordingly
That way changes to options like `showLineMarkers` also reload the webview
Whereas the reStructuredText part of the extension could copy the
patterns for previews established by VSCode's markdown support, doing
so for markdown files would (surprise, surprise!) create conflicts.

So, the toolbar button and command names have been "re-branded" to
make them distinct from the built-in markdown ones. The
reStructuredText part of the extension keeps its existing
keybindings (for now?) and no keybindings have been set for the
markdown side.

Open for suggestions as to what a good default keybinding could be :)

Ref: swyddfa#780
@alcarney alcarney merged commit 76f8316 into swyddfa:develop Apr 28, 2024
13 of 14 checks passed
@alcarney alcarney deleted the preview-improvements branch April 28, 2024 17:01
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.

Server should build project before generating preview, if necessary
1 participant