History

Solve 50+ `cargo doc` warnings (#24071)

Release Notes: - N/A

João Marcos committed 1 year ago

Commit 5bd7eaa1 parent 39d45bc35 files · +99 −89Browse files

Unified · Split

35 files
  1. crates/anthropic/src/anthropic.rs +2 −2
  2. crates/anthropic/src/supported_countries.rs +1 −1
  3. crates/assistant_context_editor/src/slash_command.rs +4 −2
  4. crates/assistant_settings/src/assistant_settings.rs +1 −1
  5. crates/editor/src/code_context_menus.rs +15 −10
  6. crates/editor/src/editor.rs +7 −4
  7. crates/google_ai/src/supported_countries.rs +1 −1
  8. crates/gpui/src/app.rs +1 −1
  9. crates/gpui/src/color.rs +5 −5
  10. crates/gpui/src/gpui.rs +2 −2
  11. crates/gpui/src/platform/linux/platform.rs +1 −1
  12. crates/gpui/src/shared_string.rs +1 −1
  13. crates/gpui_macros/src/gpui_macros.rs +2 −2
  14. crates/http_client/src/async_body.rs +1 −1
  15. crates/language/src/buffer.rs +7 −8
  16. crates/multi_buffer/src/multi_buffer.rs +3 −3
  17. crates/open_ai/src/supported_countries.rs +1 −1
  18. crates/project/src/lsp_store.rs +6 −6
  19. crates/project/src/project.rs +4 −4
  20. crates/release_channel/src/lib.rs +0 −5
  21. crates/reqwest_client/src/reqwest_client.rs +1 −1
  22. crates/settings/src/settings_store.rs +6 −5
  23. crates/sum_tree/src/sum_tree.rs +1 −1
  24. crates/terminal/src/terminal.rs +2 −2
  25. crates/theme/src/settings.rs +1 −1
  26. crates/ui/src/components/button/button.rs +2 −2
  27. crates/ui/src/components/content_group.rs +3 −3
  28. crates/ui/src/components/image.rs +1 −1
  29. crates/ui/src/components/navigable.rs +4 −2
  30. crates/ui/src/components/radio.rs +2 −0
  31. crates/ui/src/styles/elevation.rs +1 −1
  32. crates/ui/src/styles/typography.rs +1 −1
  33. crates/ui/src/traits/styled_ext.rs +6 −6
  34. crates/ui/src/ui.rs +1 −2
  35. crates/ui/src/utils/with_rem_size.rs +2 −0
crates/anthropic/src/anthropic.rs+2−2
@@ -250,7 +250,7 @@ pub async fn stream_completion( · 249 unmodified lines
250 .map(|output| output.0)250 .map(|output| output.0)
251}251}
252 252
253/// https://docs.anthropic.com/en/api/rate-limits#response-headers253/// <https://docs.anthropic.com/en/api/rate-limits#response-headers>
254#[derive(Debug)]254#[derive(Debug)]
255pub struct RateLimitInfo {255pub struct RateLimitInfo {
256 pub requests_limit: usize,256 pub requests_limit: usize,
@@ -626,7 +626,7 @@ pub struct ApiError { · 369 unmodified lines
626}626}
627 627
628/// An Anthropic API error code.628/// An Anthropic API error code.
629/// https://docs.anthropic.com/en/api/errors#http-errors629/// <https://docs.anthropic.com/en/api/errors#http-errors>
630#[derive(Debug, PartialEq, Eq, Clone, Copy, EnumString)]630#[derive(Debug, PartialEq, Eq, Clone, Copy, EnumString)]
631#[strum(serialize_all = "snake_case")]631#[strum(serialize_all = "snake_case")]
632pub enum ApiErrorCode {632pub enum ApiErrorCode {
crates/anthropic/src/supported_countries.rs+1−1
@@ -3,7 +3,7 @@ use std::sync::LazyLock; · 2 unmodified lines
3 3
4/// Returns whether the given country code is supported by Anthropic.4/// Returns whether the given country code is supported by Anthropic.
5///5///
6/// https://www.anthropic.com/supported-countries6/// <https://www.anthropic.com/supported-countries>
7pub fn is_supported_country(country_code: &str) -> bool {7pub fn is_supported_country(country_code: &str) -> bool {
8 SUPPORTED_COUNTRIES.contains(&country_code)8 SUPPORTED_COUNTRIES.contains(&country_code)
9}9}
crates/assistant_context_editor/src/slash_command.rs+4−2
@@ -5,7 +5,7 @@ use assistant_slash_command::{AfterCompletion, SlashCommandLine, SlashCommandWor · 4 unmodified lines
5use editor::{CompletionProvider, Editor};5use editor::{CompletionProvider, Editor};
6use fuzzy::{match_strings, StringMatchCandidate};6use fuzzy::{match_strings, StringMatchCandidate};
7use gpui::{App, Context, Entity, Task, WeakEntity, Window};7use gpui::{App, Context, Entity, Task, WeakEntity, Window};
8use language::{Anchor, Buffer, Documentation, LanguageServerId, ToPoint};8use language::{Anchor, Buffer, CompletionDocumentation, LanguageServerId, ToPoint};
9use parking_lot::Mutex;9use parking_lot::Mutex;
10use project::CompletionIntent;10use project::CompletionIntent;
11use rope::Point;11use rope::Point;
@@ -120,7 +120,9 @@ impl SlashCommandCompletionProvider { · 108 unmodified lines
120 });120 });
121 Some(project::Completion {121 Some(project::Completion {
122 old_range: name_range.clone(),122 old_range: name_range.clone(),
123 documentation: Some(Documentation::SingleLine(command.description())),123 documentation: Some(CompletionDocumentation::SingleLine(
124 command.description(),
125 )),
124 new_text,126 new_text,
125 label: command.label(cx),127 label: command.label(cx),
126 server_id: LanguageServerId(0),128 server_id: LanguageServerId(0),
crates/assistant_settings/src/assistant_settings.rs+1−1
@@ -434,7 +434,7 @@ pub struct LegacyAssistantSettingsContent { · 433 unmodified lines
434 pub default_open_ai_model: Option<OpenAiModel>,434 pub default_open_ai_model: Option<OpenAiModel>,
435 /// OpenAI API base URL to use when creating new chats.435 /// OpenAI API base URL to use when creating new chats.
436 ///436 ///
437 /// Default: https://api.openai.com/v1437 /// Default: <https://api.openai.com/v1>
438 pub openai_api_url: Option<String>,438 pub openai_api_url: Option<String>,
439}439}
440 440
crates/editor/src/code_context_menus.rs+15−10
@@ -5,7 +5,7 @@ use gpui::{ · 4 unmodified lines
5 Size, StrikethroughStyle, StyledText, UniformListScrollHandle, WeakEntity,5 Size, StrikethroughStyle, StyledText, UniformListScrollHandle, WeakEntity,
6};6};
7use language::Buffer;7use language::Buffer;
8use language::{CodeLabel, Documentation};8use language::{CodeLabel, CompletionDocumentation};
9use lsp::LanguageServerId;9use lsp::LanguageServerId;
10use multi_buffer::{Anchor, ExcerptId};10use multi_buffer::{Anchor, ExcerptId};
11use ordered_float::OrderedFloat;11use ordered_float::OrderedFloat;
@@ -474,7 +474,7 @@ impl CompletionsMenu { · 462 unmodified lines
474 let documentation = &completion.documentation;474 let documentation = &completion.documentation;
475 475
476 let mut len = completion.label.text.chars().count();476 let mut len = completion.label.text.chars().count();
477 if let Some(Documentation::SingleLine(text)) = documentation {477 if let Some(CompletionDocumentation::SingleLine(text)) = documentation {
478 if show_completion_documentation {478 if show_completion_documentation {
479 len += text.chars().count();479 len += text.chars().count();
480 }480 }
@@ -558,7 +558,9 @@ impl CompletionsMenu { · 77 unmodified lines
558 StyledText::new(completion.label.text.clone())558 StyledText::new(completion.label.text.clone())
559 .with_highlights(&style.text, highlights);559 .with_highlights(&style.text, highlights);
560 let documentation_label =560 let documentation_label =
561 if let Some(Documentation::SingleLine(text)) = documentation {561 if let Some(CompletionDocumentation::SingleLine(text)) =
562 documentation
563 {
562 if text.trim().is_empty() {564 if text.trim().is_empty() {
563 None565 None
564 } else {566 } else {
@@ -710,20 +712,23 @@ impl CompletionsMenu { · 145 unmodified lines
710 .documentation712 .documentation
711 .as_ref()?713 .as_ref()?
712 {714 {
713 Documentation::MultiLinePlainText(text) => {715 CompletionDocumentation::MultiLinePlainText(text) => {
714 div().child(SharedString::from(text.clone()))716 div().child(SharedString::from(text.clone()))
715 }717 }
716 Documentation::MultiLineMarkdown(parsed) if !parsed.text.is_empty() => div()718 CompletionDocumentation::MultiLineMarkdown(parsed)
717 .child(render_parsed_markdown(719 if !parsed.text.is_empty() =>
720 {
721 div().child(render_parsed_markdown(
718 "completions_markdown",722 "completions_markdown",
719 parsed,723 parsed,
720 &style,724 &style,
721 workspace,725 workspace,
722 cx,726 cx,
723 )),727 ))
724 Documentation::MultiLineMarkdown(_) => return None,728 }
725 Documentation::SingleLine(_) => return None,729 CompletionDocumentation::MultiLineMarkdown(_) => return None,
726 Documentation::Undocumented => return None,730 CompletionDocumentation::SingleLine(_) => return None,
731 CompletionDocumentation::Undocumented => return None,
727 }732 }
728 }733 }
729 CompletionEntry::InlineCompletionHint(InlineCompletionMenuHint::Loaded { text }) => {734 CompletionEntry::InlineCompletionHint(InlineCompletionMenuHint::Loaded { text }) => {
crates/editor/src/editor.rs+7−4
@@ -96,9 +96,9 @@ use itertools::Itertools; · 95 unmodified lines
96use language::{96use language::{
97 language_settings::{self, all_language_settings, language_settings, InlayHintSettings},97 language_settings::{self, all_language_settings, language_settings, InlayHintSettings},
98 markdown, point_from_lsp, AutoindentMode, BracketPair, Buffer, Capability, CharKind, CodeLabel,98 markdown, point_from_lsp, AutoindentMode, BracketPair, Buffer, Capability, CharKind, CodeLabel,
99 CursorShape, Diagnostic, Documentation, EditPreview, HighlightedText, IndentKind, IndentSize,99 CompletionDocumentation, CursorShape, Diagnostic, EditPreview, HighlightedText, IndentKind,
100 Language, OffsetRangeExt, Point, Selection, SelectionGoal, TextObject, TransactionId,100 IndentSize, Language, OffsetRangeExt, Point, Selection, SelectionGoal, TextObject,
101 TreeSitterOptions,101 TransactionId, TreeSitterOptions,
102};102};
103use language::{point_to_lsp, BufferRow, CharClassifier, Runnable, RunnableRange};103use language::{point_to_lsp, BufferRow, CharClassifier, Runnable, RunnableRange};
104use linked_editing_ranges::refresh_linked_ranges;104use linked_editing_ranges::refresh_linked_ranges;
@@ -14723,7 +14723,10 @@ fn snippet_completions( · 14618 unmodified lines
14723 filter_range: 0..matching_prefix.len(),14723 filter_range: 0..matching_prefix.len(),
14724 },14724 },
14725 server_id: LanguageServerId(usize::MAX),14725 server_id: LanguageServerId(usize::MAX),
14726 documentation: snippet.description.clone().map(Documentation::SingleLine),14726 documentation: snippet
14727 .description
14728 .clone()
14729 .map(CompletionDocumentation::SingleLine),
14727 lsp_completion: lsp::CompletionItem {14730 lsp_completion: lsp::CompletionItem {
14728 label: snippet.prefix.first().unwrap().clone(),14731 label: snippet.prefix.first().unwrap().clone(),
14729 kind: Some(CompletionItemKind::SNIPPET),14732 kind: Some(CompletionItemKind::SNIPPET),
crates/google_ai/src/supported_countries.rs+1−1
@@ -3,7 +3,7 @@ use std::sync::LazyLock; · 2 unmodified lines
3 3
4/// Returns whether the given country code is supported by Google Gemini.4/// Returns whether the given country code is supported by Google Gemini.
5///5///
6/// https://ai.google.dev/gemini-api/docs/available-regions6/// <https://ai.google.dev/gemini-api/docs/available-regions>
7pub fn is_supported_country(country_code: &str) -> bool {7pub fn is_supported_country(country_code: &str) -> bool {
8 SUPPORTED_COUNTRIES.contains(&country_code)8 SUPPORTED_COUNTRIES.contains(&country_code)
9}9}
crates/gpui/src/app.rs+1−1
@@ -1418,7 +1418,7 @@ impl App { · 1417 unmodified lines
1418 }1418 }
1419 1419
1420 /// Dispatch an action to the currently active window or global action handler1420 /// Dispatch an action to the currently active window or global action handler
1421 /// See [action::Action] for more information on how actions work1421 /// See [`crate::Action`] for more information on how actions work
1422 pub fn dispatch_action(&mut self, action: &dyn Action) {1422 pub fn dispatch_action(&mut self, action: &dyn Action) {
1423 if let Some(active_window) = self.active_window() {1423 if let Some(active_window) = self.active_window() {
1424 active_window1424 active_window
crates/gpui/src/color.rs+5−5
@@ -559,8 +559,8 @@ pub(crate) enum BackgroundTag { · 558 unmodified lines
559/// A color space for color interpolation.559/// A color space for color interpolation.
560///560///
561/// References:561/// References:
562/// - https://developer.mozilla.org/en-US/docs/Web/CSS/color-interpolation-method562/// - <https://developer.mozilla.org/en-US/docs/Web/CSS/color-interpolation-method>
563/// - https://www.w3.org/TR/css-color-4/#typedef-color-space563/// - <https://www.w3.org/TR/css-color-4/#typedef-color-space>
564#[derive(Debug, Clone, Copy, PartialEq, Default)]564#[derive(Debug, Clone, Copy, PartialEq, Default)]
565#[repr(C)]565#[repr(C)]
566pub enum ColorSpace {566pub enum ColorSpace {
@@ -622,7 +622,7 @@ pub fn pattern_slash(color: Hsla) -> Background { · 55 unmodified lines
622///622///
623/// The `angle` is in degrees value in the range 0.0 to 360.0.623/// The `angle` is in degrees value in the range 0.0 to 360.0.
624///624///
625/// https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient625/// <https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient>
626pub fn linear_gradient(626pub fn linear_gradient(
627 angle: f32,627 angle: f32,
628 from: impl Into<LinearColorStop>,628 from: impl Into<LinearColorStop>,
@@ -638,7 +638,7 @@ pub fn linear_gradient( · 9 unmodified lines
638 638
639/// A color stop in a linear gradient.639/// A color stop in a linear gradient.
640///640///
641/// https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient#linear-color-stop641/// <https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient#linear-color-stop>
642#[derive(Debug, Clone, Copy, Default, PartialEq)]642#[derive(Debug, Clone, Copy, Default, PartialEq)]
643#[repr(C)]643#[repr(C)]
644pub struct LinearColorStop {644pub struct LinearColorStop {
@@ -671,7 +671,7 @@ impl LinearColorStop { · 26 unmodified lines
671impl Background {671impl Background {
672 /// Use specified color space for color interpolation.672 /// Use specified color space for color interpolation.
673 ///673 ///
674 /// https://developer.mozilla.org/en-US/docs/Web/CSS/color-interpolation-method674 /// <https://developer.mozilla.org/en-US/docs/Web/CSS/color-interpolation-method>
675 pub fn color_space(mut self, color_space: ColorSpace) -> Self {675 pub fn color_space(mut self, color_space: ColorSpace) -> Self {
676 self.color_space = color_space;676 self.color_space = color_space;
677 self677 self
crates/gpui/src/gpui.rs+2−2
@@ -48,10 +48,10 @@ · 47 unmodified lines
48//! complex applications:48//! complex applications:
49//!49//!
50//! - Actions are user-defined structs that are used for converting keystrokes into logical operations in your UI.50//! - Actions are user-defined structs that are used for converting keystrokes into logical operations in your UI.
51//! Use this for implementing keyboard shortcuts, such as cmd-q. See the [`action`] module for more information.51//! Use this for implementing keyboard shortcuts, such as cmd-q (See `action` module for more information).
52//! - Platform services, such as `quit the app` or `open a URL` are available as methods on the [`app::App`].52//! - Platform services, such as `quit the app` or `open a URL` are available as methods on the [`app::App`].
53//! - An async executor that is integrated with the platform's event loop. See the [`executor`] module for more information.,53//! - An async executor that is integrated with the platform's event loop. See the [`executor`] module for more information.,
54//! - The [gpui::test] macro provides a convenient way to write tests for your GPUI applications. Tests also have their54//! - The [`gpui::test`](test) macro provides a convenient way to write tests for your GPUI applications. Tests also have their
55//! own kind of context, a [`TestAppContext`] which provides ways of simulating common platform input. See [`app::test_context`]55//! own kind of context, a [`TestAppContext`] which provides ways of simulating common platform input. See [`app::test_context`]
56//! and [`test`] modules for more details.56//! and [`test`] modules for more details.
57//!57//!
crates/gpui/src/platform/linux/platform.rs+1−1
@@ -773,7 +773,7 @@ impl crate::Keystroke { · 772 unmodified lines
773 773
774 /**774 /**
775 * Returns which symbol the dead key represents775 * Returns which symbol the dead key represents
776 * https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values#dead_keycodes_for_linux776 * <https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values#dead_keycodes_for_linux>
777 */777 */
778 pub fn underlying_dead_key(keysym: Keysym) -> Option<String> {778 pub fn underlying_dead_key(keysym: Keysym) -> Option<String> {
779 match keysym {779 match keysym {
crates/gpui/src/shared_string.rs+1−1
@@ -16,7 +16,7 @@ impl SharedString { · 15 unmodified lines
16 Self(ArcCow::Borrowed(str))16 Self(ArcCow::Borrowed(str))
17 }17 }
18 18
19 /// Creates a [`SharedString`] from anything that can become an Arc<str>19 /// Creates a [`SharedString`] from anything that can become an `Arc<str>`
20 pub fn new(str: impl Into<Arc<str>>) -> Self {20 pub fn new(str: impl Into<Arc<str>>) -> Self {
21 SharedString(ArcCow::Owned(str.into()))21 SharedString(ArcCow::Owned(str.into()))
22 }22 }
crates/gpui_macros/src/gpui_macros.rs+2−2
@@ -143,7 +143,7 @@ pub fn box_shadow_style_methods(input: TokenStream) -> TokenStream { · 142 unmodified lines
143 styles::box_shadow_style_methods(input)143 styles::box_shadow_style_methods(input)
144}144}
145 145
146/// #[gpui::test] can be used to annotate test functions that run with GPUI support.146/// `#[gpui::test]` can be used to annotate test functions that run with GPUI support.
147/// it supports both synchronous and asynchronous tests, and can provide you with147/// it supports both synchronous and asynchronous tests, and can provide you with
148/// as many `TestAppContext` instances as you need.148/// as many `TestAppContext` instances as you need.
149/// The output contains a `#[test]` annotation so this can be used with any existing149/// The output contains a `#[test]` annotation so this can be used with any existing
@@ -160,7 +160,7 @@ pub fn box_shadow_style_methods(input: TokenStream) -> TokenStream { · 10 unmodified lines
160/// Using the same `StdRng` for behavior in your test will allow you to exercise a wide160/// Using the same `StdRng` for behavior in your test will allow you to exercise a wide
161/// variety of scenarios and interleavings just by changing the seed.161/// variety of scenarios and interleavings just by changing the seed.
162///162///
163/// #[gpui::test] also takes three different arguments:163/// `#[gpui::test]` also takes three different arguments:
164/// - `#[gpui::test(iterations=10)]` will run the test ten times with a different initial SEED.164/// - `#[gpui::test(iterations=10)]` will run the test ten times with a different initial SEED.
165/// - `#[gpui::test(retries=3)]` will run the test up to four times if it fails to try and make it pass.165/// - `#[gpui::test(retries=3)]` will run the test up to four times if it fails to try and make it pass.
166/// - `#[gpui::test(on_failure="crate::test::report_failure")]` will call the specified function after the166/// - `#[gpui::test(on_failure="crate::test::report_failure")]` will call the specified function after the
crates/http_client/src/async_body.rs+1−1
@@ -8,7 +8,7 @@ use bytes::Bytes; · 7 unmodified lines
8use futures::AsyncRead;8use futures::AsyncRead;
9 9
10/// Based on the implementation of AsyncBody in10/// Based on the implementation of AsyncBody in
11/// https://github.com/sagebind/isahc/blob/5c533f1ef4d6bdf1fd291b5103c22110f41d0bf0/src/body/mod.rs11/// <https://github.com/sagebind/isahc/blob/5c533f1ef4d6bdf1fd291b5103c22110f41d0bf0/src/body/mod.rs>.
12pub struct AsyncBody(pub Inner);12pub struct AsyncBody(pub Inner);
13 13
14pub enum Inner {14pub enum Inner {
crates/language/src/buffer.rs+7−8
@@ -236,36 +236,35 @@ pub async fn prepare_completion_documentation( · 235 unmodified lines
236 documentation: &lsp::Documentation,236 documentation: &lsp::Documentation,
237 language_registry: &Arc<LanguageRegistry>,237 language_registry: &Arc<LanguageRegistry>,
238 language: Option<Arc<Language>>,238 language: Option<Arc<Language>>,
239) -> Documentation {239) -> CompletionDocumentation {
240 match documentation {240 match documentation {
241 lsp::Documentation::String(text) => {241 lsp::Documentation::String(text) => {
242 if text.lines().count() <= 1 {242 if text.lines().count() <= 1 {
243 Documentation::SingleLine(text.clone())243 CompletionDocumentation::SingleLine(text.clone())
244 } else {244 } else {
245 Documentation::MultiLinePlainText(text.clone())245 CompletionDocumentation::MultiLinePlainText(text.clone())
246 }246 }
247 }247 }
248 248
249 lsp::Documentation::MarkupContent(lsp::MarkupContent { kind, value }) => match kind {249 lsp::Documentation::MarkupContent(lsp::MarkupContent { kind, value }) => match kind {
250 lsp::MarkupKind::PlainText => {250 lsp::MarkupKind::PlainText => {
251 if value.lines().count() <= 1 {251 if value.lines().count() <= 1 {
252 Documentation::SingleLine(value.clone())252 CompletionDocumentation::SingleLine(value.clone())
253 } else {253 } else {
254 Documentation::MultiLinePlainText(value.clone())254 CompletionDocumentation::MultiLinePlainText(value.clone())
255 }255 }
256 }256 }
257 257
258 lsp::MarkupKind::Markdown => {258 lsp::MarkupKind::Markdown => {
259 let parsed = parse_markdown(value, Some(language_registry), language).await;259 let parsed = parse_markdown(value, Some(language_registry), language).await;
260 Documentation::MultiLineMarkdown(parsed)260 CompletionDocumentation::MultiLineMarkdown(parsed)
261 }261 }
262 },262 },
263 }263 }
264}264}
265 265
266/// Documentation associated with a [`Completion`].
267#[derive(Clone, Debug)]266#[derive(Clone, Debug)]
268pub enum Documentation {267pub enum CompletionDocumentation {
269 /// There is no documentation for this completion.268 /// There is no documentation for this completion.
270 Undocumented,269 Undocumented,
271 /// A single line of documentation.270 /// A single line of documentation.
crates/multi_buffer/src/multi_buffer.rs+3−3
@@ -266,7 +266,7 @@ impl std::fmt::Debug for ExcerptInfo { · 265 unmodified lines
266 }266 }
267}267}
268 268
269/// A boundary between [`Excerpt`]s in a [`MultiBuffer`]269/// A boundary between `Excerpt`s in a [`MultiBuffer`]
270#[derive(Debug)]270#[derive(Debug)]
271pub struct ExcerptBoundary {271pub struct ExcerptBoundary {
272 pub prev: Option<ExcerptInfo>,272 pub prev: Option<ExcerptInfo>,
@@ -312,7 +312,7 @@ struct Excerpt { · 39 unmodified lines
312 has_trailing_newline: bool,312 has_trailing_newline: bool,
313}313}
314 314
315/// A public view into an [`Excerpt`] in a [`MultiBuffer`].315/// A public view into an `Excerpt` in a [`MultiBuffer`].
316///316///
317/// Contains methods for getting the [`Buffer`] of the excerpt,317/// Contains methods for getting the [`Buffer`] of the excerpt,
318/// as well as mapping offsets to/from buffer and multibuffer coordinates.318/// as well as mapping offsets to/from buffer and multibuffer coordinates.
@@ -332,7 +332,7 @@ struct ExcerptIdMapping { · 13 unmodified lines
332 locator: Locator,332 locator: Locator,
333}333}
334 334
335/// A range of text from a single [`Buffer`], to be shown as an [`Excerpt`].335/// A range of text from a single [`Buffer`], to be shown as an `Excerpt`.
336/// These ranges are relative to the buffer itself336/// These ranges are relative to the buffer itself
337#[derive(Clone, Debug, Eq, PartialEq, Hash)]337#[derive(Clone, Debug, Eq, PartialEq, Hash)]
338pub struct ExcerptRange<T> {338pub struct ExcerptRange<T> {
crates/open_ai/src/supported_countries.rs+1−1
@@ -3,7 +3,7 @@ use std::sync::LazyLock; · 2 unmodified lines
3 3
4/// Returns whether the given country code is supported by OpenAI.4/// Returns whether the given country code is supported by OpenAI.
5///5///
6/// https://platform.openai.com/docs/supported-countries6/// <https://platform.openai.com/docs/supported-countries>
7pub fn is_supported_country(country_code: &str) -> bool {7pub fn is_supported_country(country_code: &str) -> bool {
8 SUPPORTED_COUNTRIES.contains(&country_code)8 SUPPORTED_COUNTRIES.contains(&country_code)
9}9}
crates/project/src/lsp_store.rs+6−6
@@ -36,7 +36,7 @@ use language::{ · 35 unmodified lines
36 markdown, point_to_lsp, prepare_completion_documentation,36 markdown, point_to_lsp, prepare_completion_documentation,
37 proto::{deserialize_anchor, deserialize_version, serialize_anchor, serialize_version},37 proto::{deserialize_anchor, deserialize_version, serialize_anchor, serialize_version},
38 range_from_lsp, range_to_lsp, Bias, Buffer, BufferSnapshot, CachedLspAdapter, CodeLabel,38 range_from_lsp, range_to_lsp, Bias, Buffer, BufferSnapshot, CachedLspAdapter, CodeLabel,
39 Diagnostic, DiagnosticEntry, DiagnosticSet, Diff, Documentation, File as _, Language,39 CompletionDocumentation, Diagnostic, DiagnosticEntry, DiagnosticSet, Diff, File as _, Language,
40 LanguageName, LanguageRegistry, LanguageServerBinaryStatus, LanguageToolchainStore, LocalFile,40 LanguageName, LanguageRegistry, LanguageServerBinaryStatus, LanguageToolchainStore, LocalFile,
41 LspAdapter, LspAdapterDelegate, Patch, PointUtf16, TextBufferSnapshot, ToOffset, ToPointUtf16,41 LspAdapter, LspAdapterDelegate, Patch, PointUtf16, TextBufferSnapshot, ToOffset, ToPointUtf16,
42 Transaction, Unclipped,42 Transaction, Unclipped,
@@ -4359,7 +4359,7 @@ impl LspStore { · 4316 unmodified lines
4359 } else {4359 } else {
4360 let mut completions = completions.borrow_mut();4360 let mut completions = completions.borrow_mut();
4361 let completion = &mut completions[completion_index];4361 let completion = &mut completions[completion_index];
4362 completion.documentation = Some(Documentation::Undocumented);4362 completion.documentation = Some(CompletionDocumentation::Undocumented);
4363 }4363 }
4364 4364
4365 // NB: Zed does not have `details` inside the completion resolve capabilities, but certain language servers violate the spec and do not return `details` immediately, e.g. https://github.com/yioneko/vtsls/issues/2134365 // NB: Zed does not have `details` inside the completion resolve capabilities, but certain language servers violate the spec and do not return `details` immediately, e.g. https://github.com/yioneko/vtsls/issues/213
@@ -4434,16 +4434,16 @@ impl LspStore { · 68 unmodified lines
4434 let lsp_completion = serde_json::from_slice(&response.lsp_completion)?;4434 let lsp_completion = serde_json::from_slice(&response.lsp_completion)?;
4435 4435
4436 let documentation = if response.documentation.is_empty() {4436 let documentation = if response.documentation.is_empty() {
4437 Documentation::Undocumented4437 CompletionDocumentation::Undocumented
4438 } else if response.documentation_is_markdown {4438 } else if response.documentation_is_markdown {
4439 Documentation::MultiLineMarkdown(4439 CompletionDocumentation::MultiLineMarkdown(
4440 markdown::parse_markdown(&response.documentation, Some(&language_registry), None)4440 markdown::parse_markdown(&response.documentation, Some(&language_registry), None)
4441 .await,4441 .await,
4442 )4442 )
4443 } else if response.documentation.lines().count() <= 1 {4443 } else if response.documentation.lines().count() <= 1 {
4444 Documentation::SingleLine(response.documentation)4444 CompletionDocumentation::SingleLine(response.documentation)
4445 } else {4445 } else {
4446 Documentation::MultiLinePlainText(response.documentation)4446 CompletionDocumentation::MultiLinePlainText(response.documentation)
4447 };4447 };
4448 4448
4449 let mut completions = completions.borrow_mut();4449 let mut completions = completions.borrow_mut();
crates/project/src/project.rs+4−4
@@ -56,9 +56,9 @@ use gpui::{ · 55 unmodified lines
56use itertools::Itertools;56use itertools::Itertools;
57use language::{57use language::{
58 language_settings::InlayHintKind, proto::split_operations, Buffer, BufferEvent,58 language_settings::InlayHintKind, proto::split_operations, Buffer, BufferEvent,
59 CachedLspAdapter, Capability, CodeLabel, Documentation, File as _, Language, LanguageName,59 CachedLspAdapter, Capability, CodeLabel, CompletionDocumentation, File as _, Language,
60 LanguageRegistry, PointUtf16, ToOffset, ToPointUtf16, Toolchain, ToolchainList, Transaction,60 LanguageName, LanguageRegistry, PointUtf16, ToOffset, ToPointUtf16, Toolchain, ToolchainList,
61 Unclipped,61 Transaction, Unclipped,
62};62};
63use lsp::{63use lsp::{
64 CodeActionKind, CompletionContext, CompletionItemKind, DocumentHighlightKind, LanguageServer,64 CodeActionKind, CompletionContext, CompletionItemKind, DocumentHighlightKind, LanguageServer,
@@ -368,7 +368,7 @@ pub struct Completion { · 303 unmodified lines
368 /// The id of the language server that produced this completion.368 /// The id of the language server that produced this completion.
369 pub server_id: LanguageServerId,369 pub server_id: LanguageServerId,
370 /// The documentation for this completion.370 /// The documentation for this completion.
371 pub documentation: Option<Documentation>,371 pub documentation: Option<CompletionDocumentation>,
372 /// The raw completion provided by the language server.372 /// The raw completion provided by the language server.
373 pub lsp_completion: lsp::CompletionItem,373 pub lsp_completion: lsp::CompletionItem,
374 /// Whether this completion has been resolved, to ensure it happens once per completion.374 /// Whether this completion has been resolved, to ensure it happens once per completion.
crates/release_channel/src/lib.rs+0−5
@@ -53,11 +53,6 @@ pub struct AppVersion; · 52 unmodified lines
53 53
54impl AppVersion {54impl AppVersion {
55 /// Initializes the global [`AppVersion`].55 /// Initializes the global [`AppVersion`].
56 ///
57 /// Attempts to read the version number from the following locations, in order:
58 /// 1. the `ZED_APP_VERSION` environment variable,
59 /// 2. the [`AppContext::app_metadata`],
60 /// 3. the passed in `pkg_version`.
61 pub fn init(pkg_version: &str) -> SemanticVersion {56 pub fn init(pkg_version: &str) -> SemanticVersion {
62 if let Ok(from_env) = env::var("ZED_APP_VERSION") {57 if let Ok(from_env) = env::var("ZED_APP_VERSION") {
63 from_env.parse().expect("invalid ZED_APP_VERSION")58 from_env.parse().expect("invalid ZED_APP_VERSION")
crates/reqwest_client/src/reqwest_client.rs+1−1
@@ -139,7 +139,7 @@ impl futures::Stream for StreamReader { · 138 unmodified lines
139 }139 }
140}140}
141 141
142/// Implementation from https://docs.rs/tokio-util/0.7.12/src/tokio_util/util/poll_buf.rs.html142/// Implementation from <https://docs.rs/tokio-util/0.7.12/src/tokio_util/util/poll_buf.rs.html>
143/// Specialized for this use case143/// Specialized for this use case
144pub fn poll_read_buf(144pub fn poll_read_buf(
145 io: &mut Pin<Box<dyn futures::AsyncRead + Send + Sync>>,145 io: &mut Pin<Box<dyn futures::AsyncRead + Send + Sync>>,
crates/settings/src/settings_store.rs+6−5
@@ -32,12 +32,13 @@ pub trait Settings: 'static + Send + Sync { · 31 unmodified lines
32 /// from the root object.32 /// from the root object.
33 const KEY: Option<&'static str>;33 const KEY: Option<&'static str>;
34 34
35 /// The name of the keys in the [`FileContent`] that should always be written to35 /// The name of the keys in the [`FileContent`](Self::FileContent) that should
36 /// a settings file, even if their value matches the default value.36 /// always be written to a settings file, even if their value matches the default
37 /// value.
37 ///38 ///
38 /// This is useful for tagged [`FileContent`]s where the tag is a "version" field39 /// This is useful for tagged [`FileContent`](Self::FileContent)s where the tag
39 /// that should always be persisted, even if the current user settings match the40 /// is a "version" field that should always be persisted, even if the current
40 /// current version of the settings.41 /// user settings match the current version of the settings.
41 const PRESERVED_KEYS: Option<&'static [&'static str]> = None;42 const PRESERVED_KEYS: Option<&'static [&'static str]> = None;
42 43
43 /// The type that is stored in an individual JSON file.44 /// The type that is stored in an individual JSON file.
crates/sum_tree/src/sum_tree.rs+1−1
@@ -32,7 +32,7 @@ pub trait KeyedItem: Item { · 31 unmodified lines
32 32
33/// A type that describes the Sum of all [`Item`]s in a subtree of the [`SumTree`]33/// A type that describes the Sum of all [`Item`]s in a subtree of the [`SumTree`]
34///34///
35/// Each Summary type can have multiple [`Dimensions`] that it measures,35/// Each Summary type can have multiple [`Dimension`]s that it measures,
36/// which can be used to navigate the tree36/// which can be used to navigate the tree
37pub trait Summary: Clone {37pub trait Summary: Clone {
38 type Context;38 type Context;
crates/terminal/src/terminal.rs+2−2
@@ -122,7 +122,7 @@ pub struct PathLikeTarget { · 121 unmodified lines
122/// A string inside terminal, potentially useful as a URI that can be opened.122/// A string inside terminal, potentially useful as a URI that can be opened.
123#[derive(Clone, Debug)]123#[derive(Clone, Debug)]
124pub enum MaybeNavigationTarget {124pub enum MaybeNavigationTarget {
125 /// HTTP, git, etc. string determined by the [`URL_REGEX`] regex.125 /// HTTP, git, etc. string determined by the `URL_REGEX` regex.
126 Url(String),126 Url(String),
127 /// File system path, absolute or relative, existing or not.127 /// File system path, absolute or relative, existing or not.
128 /// Might have line and column number(s) attached as `file.rs:1:23`128 /// Might have line and column number(s) attached as `file.rs:1:23`
@@ -1910,7 +1910,7 @@ fn content_index_for_mouse(pos: Point<Pixels>, size: &TerminalSize) -> usize { · 1781 unmodified lines
1910 1910
1911/// Converts an 8 bit ANSI color to its GPUI equivalent.1911/// Converts an 8 bit ANSI color to its GPUI equivalent.
1912/// Accepts `usize` for compatibility with the `alacritty::Colors` interface,1912/// Accepts `usize` for compatibility with the `alacritty::Colors` interface,
1913/// Other than that use case, should only be called with values in the [0,255] range1913/// Other than that use case, should only be called with values in the `[0,255]` range
1914pub fn get_color_at_index(index: usize, theme: &Theme) -> Hsla {1914pub fn get_color_at_index(index: usize, theme: &Theme) -> Hsla {
1915 let colors = theme.colors();1915 let colors = theme.colors();
1916 1916
crates/theme/src/settings.rs+1−1
@@ -425,7 +425,7 @@ impl BufferLineHeight { · 424 unmodified lines
425}425}
426 426
427impl ThemeSettings {427impl ThemeSettings {
428 /// Returns the [AdjustedBufferFontSize].428 /// Returns the buffer font size.
429 pub fn buffer_font_size(&self) -> Pixels {429 pub fn buffer_font_size(&self) -> Pixels {
430 Self::clamp_font_size(self.buffer_font_size)430 Self::clamp_font_size(self.buffer_font_size)
431 }431 }
crates/ui/src/components/button/button.rs+2−2
@@ -349,8 +349,8 @@ impl ButtonCommon for Button { · 348 unmodified lines
349 /// Sets a tooltip for the button.349 /// Sets a tooltip for the button.
350 ///350 ///
351 /// This method allows a tooltip to be set for the button. The tooltip is a function that351 /// This method allows a tooltip to be set for the button. The tooltip is a function that
352 /// takes a mutable reference to a [`WindowContext`] and returns an [`AnyView`]. The tooltip352 /// takes a mutable references to [`Window`] and [`App`], and returns an [`AnyView`]. The
353 /// is displayed when the user hovers over the button.353 /// tooltip is displayed when the user hovers over the button.
354 ///354 ///
355 /// # Examples355 /// # Examples
356 ///356 ///
crates/ui/src/components/content_group.rs+3−3
@@ -31,7 +31,7 @@ pub struct ContentGroup { · 30 unmodified lines
31}31}
32 32
33impl ContentGroup {33impl ContentGroup {
34 /// Creates a new [ContentBox].34 /// Creates a new [`ContentGroup`].
35 pub fn new() -> Self {35 pub fn new() -> Self {
36 Self {36 Self {
37 base: div(),37 base: div(),
@@ -41,13 +41,13 @@ impl ContentGroup { · 3 unmodified lines
41 }41 }
42 }42 }
43 43
44 /// Removes the border from the [ContentBox].44 /// Removes the border from the [`ContentGroup`].
45 pub fn borderless(mut self) -> Self {45 pub fn borderless(mut self) -> Self {
46 self.border = false;46 self.border = false;
47 self47 self
48 }48 }
49 49
50 /// Removes the background fill from the [ContentBox].50 /// Removes the background fill from the [`ContentGroup`].
51 pub fn unfilled(mut self) -> Self {51 pub fn unfilled(mut self) -> Self {
52 self.fill = false;52 self.fill = false;
53 self53 self
crates/ui/src/components/image.rs+1−1
@@ -28,7 +28,7 @@ pub enum VectorName { · 27 unmodified lines
28 28
29/// A vector image, such as an SVG.29/// A vector image, such as an SVG.
30///30///
31/// A [`Vector`] is different from an [`Icon`] in that it is intended31/// A [`Vector`] is different from an [`crate::Icon`] in that it is intended
32/// to be displayed at a specific size, or series of sizes, rather32/// to be displayed at a specific size, or series of sizes, rather
33/// than conforming to the standard size of an icon.33/// than conforming to the standard size of an icon.
34#[derive(IntoElement)]34#[derive(IntoElement)]
crates/ui/src/components/navigable.rs+4−2
@@ -42,8 +42,9 @@ impl Navigable { · 41 unmodified lines
42 }42 }
43 43
44 /// Add a new entry that can be navigated to via keyboard.44 /// Add a new entry that can be navigated to via keyboard.
45 /// The order of calls to [Navigable::entry] determines the order of traversal of elements via successive45 ///
46 /// uses of [menu:::SelectNext]/[menu::SelectPrev]46 /// The order of calls to [Navigable::entry] determines the order of traversal of
47 /// elements via successive uses of `menu:::SelectNext/SelectPrev`
47 pub fn entry(mut self, child: NavigableEntry) -> Self {48 pub fn entry(mut self, child: NavigableEntry) -> Self {
48 self.selectable_children.push(child);49 self.selectable_children.push(child);
49 self50 self
@@ -59,6 +60,7 @@ impl Navigable { · 9 unmodified lines
59 .position(|entry| entry.focus_handle.contains_focused(window, cx))60 .position(|entry| entry.focus_handle.contains_focused(window, cx))
60 }61 }
61}62}
63
62impl RenderOnce for Navigable {64impl RenderOnce for Navigable {
63 fn render(self, _window: &mut Window, _: &mut App) -> impl crate::IntoElement {65 fn render(self, _window: &mut Window, _: &mut App) -> impl crate::IntoElement {
64 div()66 div()
crates/ui/src/components/radio.rs+2−0
@@ -5,6 +5,8 @@ use std::sync::Arc; · 4 unmodified lines
5use crate::prelude::*;5use crate::prelude::*;
6 6
7/// A [`Checkbox`] that has a [`Label`].7/// A [`Checkbox`] that has a [`Label`].
8///
9/// [`Checkbox`]: crate::components::Checkbox
8#[derive(IntoElement)]10#[derive(IntoElement)]
9pub struct RadioWithLabel {11pub struct RadioWithLabel {
10 id: ElementId,12 id: ElementId,
crates/ui/src/styles/elevation.rs+1−1
@@ -22,7 +22,7 @@ pub enum ElevationIndex { · 21 unmodified lines
22 EditorSurface,22 EditorSurface,
23 /// A surface that is elevated above the primary surface. but below washes, models, and dragged elements.23 /// A surface that is elevated above the primary surface. but below washes, models, and dragged elements.
24 ElevatedSurface,24 ElevatedSurface,
25 /// A surface above the [ElevationIndex::Wash] that is used for dialogs, alerts, modals, etc.25 /// A surface above the [ElevationIndex::ElevatedSurface] that is used for dialogs, alerts, modals, etc.
26 ModalSurface,26 ModalSurface,
27}27}
28 28
crates/ui/src/styles/typography.rs+1−1
@@ -24,7 +24,7 @@ pub trait StyledTypography: Styled + Sized { · 23 unmodified lines
24 self.font_family(ui_font_family)24 self.font_family(ui_font_family)
25 }25 }
26 26
27 /// Sets the text size using a [`UiTextSize`].27 /// Sets the text size using a [`TextSize`].
28 fn text_ui_size(self, size: TextSize, cx: &App) -> Self {28 fn text_ui_size(self, size: TextSize, cx: &App) -> Self {
29 self.text_size(size.rems(cx))29 self.text_size(size.rems(cx))
30 }30 }
crates/ui/src/traits/styled_ext.rs+6−6
@@ -42,9 +42,9 @@ pub trait StyledExt: Styled + Sized { · 41 unmodified lines
42 elevated(self, cx, ElevationIndex::Surface)42 elevated(self, cx, ElevationIndex::Surface)
43 }43 }
44 44
45 /// See [`elevation_1`].45 /// See [`elevation_1`](Self::elevation_1).
46 ///46 ///
47 /// Renders a borderless version [`elevation_1`].47 /// Renders a borderless version [`elevation_1`](Self::elevation_1).
48 fn elevation_1_borderless(self, cx: &mut App) -> Self {48 fn elevation_1_borderless(self, cx: &mut App) -> Self {
49 elevated_borderless(self, cx, ElevationIndex::Surface)49 elevated_borderless(self, cx, ElevationIndex::Surface)
50 }50 }
@@ -58,9 +58,9 @@ pub trait StyledExt: Styled + Sized { · 7 unmodified lines
58 elevated(self, cx, ElevationIndex::ElevatedSurface)58 elevated(self, cx, ElevationIndex::ElevatedSurface)
59 }59 }
60 60
61 /// See [`elevation_2`].61 /// See [`elevation_2`](Self::elevation_2).
62 ///62 ///
63 /// Renders a borderless version [`elevation_2`].63 /// Renders a borderless version [`elevation_2`](Self::elevation_2).
64 fn elevation_2_borderless(self, cx: &mut App) -> Self {64 fn elevation_2_borderless(self, cx: &mut App) -> Self {
65 elevated_borderless(self, cx, ElevationIndex::ElevatedSurface)65 elevated_borderless(self, cx, ElevationIndex::ElevatedSurface)
66 }66 }
@@ -78,9 +78,9 @@ pub trait StyledExt: Styled + Sized { · 11 unmodified lines
78 elevated(self, cx, ElevationIndex::ModalSurface)78 elevated(self, cx, ElevationIndex::ModalSurface)
79 }79 }
80 80
81 /// See [`elevation_3`].81 /// See [`elevation_3`](Self::elevation_3).
82 ///82 ///
83 /// Renders a borderless version [`elevation_3`].83 /// Renders a borderless version [`elevation_3`](Self::elevation_3).
84 fn elevation_3_borderless(self, cx: &mut App) -> Self {84 fn elevation_3_borderless(self, cx: &mut App) -> Self {
85 elevated_borderless(self, cx, ElevationIndex::ModalSurface)85 elevated_borderless(self, cx, ElevationIndex::ModalSurface)
86 }86 }
crates/ui/src/ui.rs+1−2
@@ -7,8 +7,7 @@ · 6 unmodified lines
7//! ## Related Crates:7//! ## Related Crates:
8//!8//!
9//! - [`ui_macros`] - proc_macros support for this crate9//! - [`ui_macros`] - proc_macros support for this crate
10//! - [`ui_input`] - the single line input component10//! - `ui_input` - the single line input component
11//!
12 11
13mod components;12mod components;
14pub mod prelude;13pub mod prelude;
crates/ui/src/utils/with_rem_size.rs+2−0
@@ -22,6 +22,8 @@ impl WithRemSize { · 21 unmodified lines
22 22
23 /// Block the mouse from interacting with this element or any of its children23 /// Block the mouse from interacting with this element or any of its children
24 /// The fluent API equivalent to [`Interactivity::occlude_mouse`]24 /// The fluent API equivalent to [`Interactivity::occlude_mouse`]
25 ///
26 /// [`Interactivity::occlude_mouse`]: gpui::Interactivity::occlude_mouse
25 pub fn occlude(mut self) -> Self {27 pub fn occlude(mut self) -> Self {
26 self.div = self.div.occlude();28 self.div = self.div.occlude();
27 self29 self