Fix clicking on file links in editor (#25117)

Closes #18641
Contributes: #13194

Release Notes:

- Open LSP documentation file links in Zed not the system opener
- Render completion documentation markdown consistently with
documentation markdown
This commit is contained in:
Conrad Irwin 2025-02-18 22:54:35 -07:00 committed by GitHub
parent ebbc6a9752
commit 1678e3cbf1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 353 additions and 352 deletions

View file

@ -99,9 +99,9 @@ use itertools::Itertools;
use language::{
language_settings::{self, all_language_settings, language_settings, InlayHintSettings},
markdown, point_from_lsp, AutoindentMode, BracketPair, Buffer, Capability, CharKind, CodeLabel,
CompletionDocumentation, CursorShape, Diagnostic, DiskState, EditPredictionsMode, EditPreview,
HighlightedText, IndentKind, IndentSize, Language, OffsetRangeExt, Point, Selection,
SelectionGoal, TextObject, TransactionId, TreeSitterOptions,
CursorShape, Diagnostic, DiskState, EditPredictionsMode, EditPreview, HighlightedText,
IndentKind, IndentSize, Language, OffsetRangeExt, Point, Selection, SelectionGoal, TextObject,
TransactionId, TreeSitterOptions,
};
use language::{point_to_lsp, BufferRow, CharClassifier, Runnable, RunnableRange};
use linked_editing_ranges::refresh_linked_ranges;
@ -132,7 +132,7 @@ use multi_buffer::{
ToOffsetUtf16,
};
use project::{
lsp_store::{FormatTrigger, LspFormatTarget, OpenLspBufferHandle},
lsp_store::{CompletionDocumentation, FormatTrigger, LspFormatTarget, OpenLspBufferHandle},
project_settings::{GitGutterSetting, ProjectSettings},
CodeAction, Completion, CompletionIntent, DocumentHighlight, InlayHint, Location, LocationLink,
PrepareRenameResponse, Project, ProjectItem, ProjectTransaction, TaskSourceKind,
@ -6221,19 +6221,14 @@ impl Editor {
}
fn render_context_menu_aside(
&self,
style: &EditorStyle,
&mut self,
max_size: Size<Pixels>,
window: &mut Window,
cx: &mut Context<Editor>,
) -> Option<AnyElement> {
self.context_menu.borrow().as_ref().and_then(|menu| {
self.context_menu.borrow_mut().as_mut().and_then(|menu| {
if menu.visible() {
menu.render_aside(
style,
max_size,
self.workspace.as_ref().map(|(w, _)| w.clone()),
cx,
)
menu.render_aside(self, max_size, window, cx)
} else {
None
}
@ -14926,8 +14921,14 @@ impl Editor {
if !self.hover_state.focused(window, cx) {
hide_hover(self, cx);
}
self.hide_context_menu(window, cx);
if !self
.context_menu
.borrow()
.as_ref()
.is_some_and(|context_menu| context_menu.focused(window, cx))
{
self.hide_context_menu(window, cx);
}
self.discard_inline_completion(false, cx);
cx.emit(EditorEvent::Blurred);
cx.notify();
@ -15674,7 +15675,7 @@ fn snippet_completions(
documentation: snippet
.description
.clone()
.map(CompletionDocumentation::SingleLine),
.map(|description| CompletionDocumentation::SingleLine(description.into())),
lsp_completion: lsp::CompletionItem {
label: snippet.prefix.first().unwrap().clone(),
kind: Some(CompletionItemKind::SNIPPET),