Skip to content

Conversation

@alexandruradovici
Copy link

@alexandruradovici alexandruradovici commented Dec 28, 2025

This pull requests adds the CTRL+ENTER and SHIFT+ENTER key bindings in preview that opens a scratch buffer showing the full compiler error.

This is an alternative to #13571

Motivation

When displaying the errors from the LSP, at least in the case of Rust, it is sometimes useful to see the full compiler error. This pull request modifies the Diagnostics Picker's by adding the CTRL+ENTER and SHIFT+ENTER key binding that opens a scratch buffer to display the actual compiler error (if available).

Key Binding Description
CTRL+ENTER Jumps to the error location and opens the full compiler error in a new scratch buffer
SHIFT+ENTER Jumps to the error location and opens the full compiler error in a new horizontal split scratch buffer

For now, the error is displayed without coloring. Using color requires more work.

I tested this PR only in the context of Rust, but I assume other LSPs might do the same.

New Buffer

Screenshot 2025-12-28 at 14 10 04

New Horizontal Buffer

Screenshot 2025-12-28 at 14 10 19

Still needs

  • This pull request still needs a documentation update before merge.

Additional Notes

Editor API

I had to. modify the Editor API and make the Editor::new_file_from_document function public to open a scratch buffer with text. Without this, I can open a new empty scratch buffer and apply a transaction, but it will show up in the undo history and will not allow the user to close is without using buffer-close! or q! which are the second command when typing.

The code doing this is now commented, it seems that document.reset_modified(); has no effect.

Picker API

This pull request adds the ability to attach notes to pickers. It uses this to attach the full compiler error as a note. The picker does not really care about the note contents, it just display the notes when CTRL+ENTER or SHIFT+ENTER are pressed.

Another solution would have been to either:

  • add a new callback function for notes
  • add another parameter to the callback function to inform the caller that the user has pressed CTRL+ENTER or SHIFT+ENTER
  • add another variants to Action like Notes and HorizontalNotes

@alexandruradovici alexandruradovici changed the title Display the full (rust) compiler error picker preview Display the full (rust) compiler error in a scratch buffer Dec 28, 2025
@alexandruradovici alexandruradovici changed the title Display the full (rust) compiler error in a scratch buffer Display the full (rust) compiler error Dec 28, 2025
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.

1 participant