text: Improve panic messages with more information (#42072)
Release Notes: - N/A *or* Added/Fixed/Improved ...
This commit is contained in:
@@ -477,11 +477,12 @@ fn language_supported(language: &Arc<Language>, cx: &mut App) -> bool {
|
||||
fn get_language(editor: WeakEntity<Editor>, cx: &mut App) -> Option<Arc<Language>> {
|
||||
editor
|
||||
.update(cx, |editor, cx| {
|
||||
let selection = editor
|
||||
.selections
|
||||
.newest::<usize>(&editor.display_snapshot(cx));
|
||||
let buffer = editor.buffer().read(cx).snapshot(cx);
|
||||
buffer.language_at(selection.head()).cloned()
|
||||
let display_snapshot = editor.display_snapshot(cx);
|
||||
let selection = editor.selections.newest::<usize>(&display_snapshot);
|
||||
display_snapshot
|
||||
.buffer_snapshot()
|
||||
.language_at(selection.head())
|
||||
.cloned()
|
||||
})
|
||||
.ok()
|
||||
.flatten()
|
||||
|
||||
Reference in New Issue
Block a user