Solve 50+ cargo doc warnings (#24071)

Release Notes:

- N/A
This commit is contained in:
João Marcos 2025-02-01 03:19:29 -03:00 committed by GitHub
parent 39d45bcbc1
commit 5bd7eaa173
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 99 additions and 89 deletions

View file

@ -250,7 +250,7 @@ pub async fn stream_completion(
.map(|output| output.0) .map(|output| output.0)
} }
/// https://docs.anthropic.com/en/api/rate-limits#response-headers /// <https://docs.anthropic.com/en/api/rate-limits#response-headers>
#[derive(Debug)] #[derive(Debug)]
pub struct RateLimitInfo { pub struct RateLimitInfo {
pub requests_limit: usize, pub requests_limit: usize,
@ -626,7 +626,7 @@ pub struct ApiError {
} }
/// An Anthropic API error code. /// An Anthropic API error code.
/// https://docs.anthropic.com/en/api/errors#http-errors /// <https://docs.anthropic.com/en/api/errors#http-errors>
#[derive(Debug, PartialEq, Eq, Clone, Copy, EnumString)] #[derive(Debug, PartialEq, Eq, Clone, Copy, EnumString)]
#[strum(serialize_all = "snake_case")] #[strum(serialize_all = "snake_case")]
pub enum ApiErrorCode { pub enum ApiErrorCode {

View file

@ -3,7 +3,7 @@ use std::sync::LazyLock;
/// Returns whether the given country code is supported by Anthropic. /// Returns whether the given country code is supported by Anthropic.
/// ///
/// https://www.anthropic.com/supported-countries /// <https://www.anthropic.com/supported-countries>
pub fn is_supported_country(country_code: &str) -> bool { pub fn is_supported_country(country_code: &str) -> bool {
SUPPORTED_COUNTRIES.contains(&country_code) SUPPORTED_COUNTRIES.contains(&country_code)
} }

View file

@ -5,7 +5,7 @@ use assistant_slash_command::{AfterCompletion, SlashCommandLine, SlashCommandWor
use editor::{CompletionProvider, Editor}; use editor::{CompletionProvider, Editor};
use fuzzy::{match_strings, StringMatchCandidate}; use fuzzy::{match_strings, StringMatchCandidate};
use gpui::{App, Context, Entity, Task, WeakEntity, Window}; use gpui::{App, Context, Entity, Task, WeakEntity, Window};
use language::{Anchor, Buffer, Documentation, LanguageServerId, ToPoint}; use language::{Anchor, Buffer, CompletionDocumentation, LanguageServerId, ToPoint};
use parking_lot::Mutex; use parking_lot::Mutex;
use project::CompletionIntent; use project::CompletionIntent;
use rope::Point; use rope::Point;
@ -120,7 +120,9 @@ impl SlashCommandCompletionProvider {
}); });
Some(project::Completion { Some(project::Completion {
old_range: name_range.clone(), old_range: name_range.clone(),
documentation: Some(Documentation::SingleLine(command.description())), documentation: Some(CompletionDocumentation::SingleLine(
command.description(),
)),
new_text, new_text,
label: command.label(cx), label: command.label(cx),
server_id: LanguageServerId(0), server_id: LanguageServerId(0),

View file

@ -434,7 +434,7 @@ pub struct LegacyAssistantSettingsContent {
pub default_open_ai_model: Option<OpenAiModel>, pub default_open_ai_model: Option<OpenAiModel>,
/// OpenAI API base URL to use when creating new chats. /// OpenAI API base URL to use when creating new chats.
/// ///
/// Default: https://api.openai.com/v1 /// Default: <https://api.openai.com/v1>
pub openai_api_url: Option<String>, pub openai_api_url: Option<String>,
} }

View file

@ -5,7 +5,7 @@ use gpui::{
Size, StrikethroughStyle, StyledText, UniformListScrollHandle, WeakEntity, Size, StrikethroughStyle, StyledText, UniformListScrollHandle, WeakEntity,
}; };
use language::Buffer; use language::Buffer;
use language::{CodeLabel, Documentation}; use language::{CodeLabel, CompletionDocumentation};
use lsp::LanguageServerId; use lsp::LanguageServerId;
use multi_buffer::{Anchor, ExcerptId}; use multi_buffer::{Anchor, ExcerptId};
use ordered_float::OrderedFloat; use ordered_float::OrderedFloat;
@ -474,7 +474,7 @@ impl CompletionsMenu {
let documentation = &completion.documentation; let documentation = &completion.documentation;
let mut len = completion.label.text.chars().count(); let mut len = completion.label.text.chars().count();
if let Some(Documentation::SingleLine(text)) = documentation { if let Some(CompletionDocumentation::SingleLine(text)) = documentation {
if show_completion_documentation { if show_completion_documentation {
len += text.chars().count(); len += text.chars().count();
} }
@ -558,7 +558,9 @@ impl CompletionsMenu {
StyledText::new(completion.label.text.clone()) StyledText::new(completion.label.text.clone())
.with_highlights(&style.text, highlights); .with_highlights(&style.text, highlights);
let documentation_label = let documentation_label =
if let Some(Documentation::SingleLine(text)) = documentation { if let Some(CompletionDocumentation::SingleLine(text)) =
documentation
{
if text.trim().is_empty() { if text.trim().is_empty() {
None None
} else { } else {
@ -710,20 +712,23 @@ impl CompletionsMenu {
.documentation .documentation
.as_ref()? .as_ref()?
{ {
Documentation::MultiLinePlainText(text) => { CompletionDocumentation::MultiLinePlainText(text) => {
div().child(SharedString::from(text.clone())) div().child(SharedString::from(text.clone()))
} }
Documentation::MultiLineMarkdown(parsed) if !parsed.text.is_empty() => div() CompletionDocumentation::MultiLineMarkdown(parsed)
.child(render_parsed_markdown( if !parsed.text.is_empty() =>
{
div().child(render_parsed_markdown(
"completions_markdown", "completions_markdown",
parsed, parsed,
&style, &style,
workspace, workspace,
cx, cx,
)), ))
Documentation::MultiLineMarkdown(_) => return None, }
Documentation::SingleLine(_) => return None, CompletionDocumentation::MultiLineMarkdown(_) => return None,
Documentation::Undocumented => return None, CompletionDocumentation::SingleLine(_) => return None,
CompletionDocumentation::Undocumented => return None,
} }
} }
CompletionEntry::InlineCompletionHint(InlineCompletionMenuHint::Loaded { text }) => { CompletionEntry::InlineCompletionHint(InlineCompletionMenuHint::Loaded { text }) => {

View file

@ -96,9 +96,9 @@ use itertools::Itertools;
use language::{ use language::{
language_settings::{self, all_language_settings, language_settings, InlayHintSettings}, language_settings::{self, all_language_settings, language_settings, InlayHintSettings},
markdown, point_from_lsp, AutoindentMode, BracketPair, Buffer, Capability, CharKind, CodeLabel, markdown, point_from_lsp, AutoindentMode, BracketPair, Buffer, Capability, CharKind, CodeLabel,
CursorShape, Diagnostic, Documentation, EditPreview, HighlightedText, IndentKind, IndentSize, CompletionDocumentation, CursorShape, Diagnostic, EditPreview, HighlightedText, IndentKind,
Language, OffsetRangeExt, Point, Selection, SelectionGoal, TextObject, TransactionId, IndentSize, Language, OffsetRangeExt, Point, Selection, SelectionGoal, TextObject,
TreeSitterOptions, TransactionId, TreeSitterOptions,
}; };
use language::{point_to_lsp, BufferRow, CharClassifier, Runnable, RunnableRange}; use language::{point_to_lsp, BufferRow, CharClassifier, Runnable, RunnableRange};
use linked_editing_ranges::refresh_linked_ranges; use linked_editing_ranges::refresh_linked_ranges;
@ -14723,7 +14723,10 @@ fn snippet_completions(
filter_range: 0..matching_prefix.len(), filter_range: 0..matching_prefix.len(),
}, },
server_id: LanguageServerId(usize::MAX), server_id: LanguageServerId(usize::MAX),
documentation: snippet.description.clone().map(Documentation::SingleLine), documentation: snippet
.description
.clone()
.map(CompletionDocumentation::SingleLine),
lsp_completion: lsp::CompletionItem { lsp_completion: lsp::CompletionItem {
label: snippet.prefix.first().unwrap().clone(), label: snippet.prefix.first().unwrap().clone(),
kind: Some(CompletionItemKind::SNIPPET), kind: Some(CompletionItemKind::SNIPPET),

View file

@ -3,7 +3,7 @@ use std::sync::LazyLock;
/// Returns whether the given country code is supported by Google Gemini. /// Returns whether the given country code is supported by Google Gemini.
/// ///
/// https://ai.google.dev/gemini-api/docs/available-regions /// <https://ai.google.dev/gemini-api/docs/available-regions>
pub fn is_supported_country(country_code: &str) -> bool { pub fn is_supported_country(country_code: &str) -> bool {
SUPPORTED_COUNTRIES.contains(&country_code) SUPPORTED_COUNTRIES.contains(&country_code)
} }

View file

@ -1418,7 +1418,7 @@ impl App {
} }
/// Dispatch an action to the currently active window or global action handler /// Dispatch an action to the currently active window or global action handler
/// See [action::Action] for more information on how actions work /// See [`crate::Action`] for more information on how actions work
pub fn dispatch_action(&mut self, action: &dyn Action) { pub fn dispatch_action(&mut self, action: &dyn Action) {
if let Some(active_window) = self.active_window() { if let Some(active_window) = self.active_window() {
active_window active_window

View file

@ -559,8 +559,8 @@ pub(crate) enum BackgroundTag {
/// A color space for color interpolation. /// A color space for color interpolation.
/// ///
/// References: /// References:
/// - https://developer.mozilla.org/en-US/docs/Web/CSS/color-interpolation-method /// - <https://developer.mozilla.org/en-US/docs/Web/CSS/color-interpolation-method>
/// - https://www.w3.org/TR/css-color-4/#typedef-color-space /// - <https://www.w3.org/TR/css-color-4/#typedef-color-space>
#[derive(Debug, Clone, Copy, PartialEq, Default)] #[derive(Debug, Clone, Copy, PartialEq, Default)]
#[repr(C)] #[repr(C)]
pub enum ColorSpace { pub enum ColorSpace {
@ -622,7 +622,7 @@ pub fn pattern_slash(color: Hsla) -> Background {
/// ///
/// The `angle` is in degrees value in the range 0.0 to 360.0. /// The `angle` is in degrees value in the range 0.0 to 360.0.
/// ///
/// https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient /// <https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient>
pub fn linear_gradient( pub fn linear_gradient(
angle: f32, angle: f32,
from: impl Into<LinearColorStop>, from: impl Into<LinearColorStop>,
@ -638,7 +638,7 @@ pub fn linear_gradient(
/// A color stop in a linear gradient. /// A color stop in a linear gradient.
/// ///
/// https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient#linear-color-stop /// <https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient#linear-color-stop>
#[derive(Debug, Clone, Copy, Default, PartialEq)] #[derive(Debug, Clone, Copy, Default, PartialEq)]
#[repr(C)] #[repr(C)]
pub struct LinearColorStop { pub struct LinearColorStop {
@ -671,7 +671,7 @@ impl LinearColorStop {
impl Background { impl Background {
/// Use specified color space for color interpolation. /// Use specified color space for color interpolation.
/// ///
/// https://developer.mozilla.org/en-US/docs/Web/CSS/color-interpolation-method /// <https://developer.mozilla.org/en-US/docs/Web/CSS/color-interpolation-method>
pub fn color_space(mut self, color_space: ColorSpace) -> Self { pub fn color_space(mut self, color_space: ColorSpace) -> Self {
self.color_space = color_space; self.color_space = color_space;
self self

View file

@ -48,10 +48,10 @@
//! complex applications: //! complex applications:
//! //!
//! - Actions are user-defined structs that are used for converting keystrokes into logical operations in your UI. //! - Actions are user-defined structs that are used for converting keystrokes into logical operations in your UI.
//! Use this for implementing keyboard shortcuts, such as cmd-q. See the [`action`] module for more information. //! Use this for implementing keyboard shortcuts, such as cmd-q (See `action` module for more information).
//! - Platform services, such as `quit the app` or `open a URL` are available as methods on the [`app::App`]. //! - Platform services, such as `quit the app` or `open a URL` are available as methods on the [`app::App`].
//! - An async executor that is integrated with the platform's event loop. See the [`executor`] module for more information., //! - An async executor that is integrated with the platform's event loop. See the [`executor`] module for more information.,
//! - The [gpui::test] macro provides a convenient way to write tests for your GPUI applications. Tests also have their //! - The [`gpui::test`](test) macro provides a convenient way to write tests for your GPUI applications. Tests also have their
//! own kind of context, a [`TestAppContext`] which provides ways of simulating common platform input. See [`app::test_context`] //! own kind of context, a [`TestAppContext`] which provides ways of simulating common platform input. See [`app::test_context`]
//! and [`test`] modules for more details. //! and [`test`] modules for more details.
//! //!

View file

@ -773,7 +773,7 @@ impl crate::Keystroke {
/** /**
* Returns which symbol the dead key represents * Returns which symbol the dead key represents
* https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values#dead_keycodes_for_linux * <https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values#dead_keycodes_for_linux>
*/ */
pub fn underlying_dead_key(keysym: Keysym) -> Option<String> { pub fn underlying_dead_key(keysym: Keysym) -> Option<String> {
match keysym { match keysym {

View file

@ -16,7 +16,7 @@ impl SharedString {
Self(ArcCow::Borrowed(str)) Self(ArcCow::Borrowed(str))
} }
/// Creates a [`SharedString`] from anything that can become an Arc<str> /// Creates a [`SharedString`] from anything that can become an `Arc<str>`
pub fn new(str: impl Into<Arc<str>>) -> Self { pub fn new(str: impl Into<Arc<str>>) -> Self {
SharedString(ArcCow::Owned(str.into())) SharedString(ArcCow::Owned(str.into()))
} }

View file

@ -143,7 +143,7 @@ pub fn box_shadow_style_methods(input: TokenStream) -> TokenStream {
styles::box_shadow_style_methods(input) styles::box_shadow_style_methods(input)
} }
/// #[gpui::test] can be used to annotate test functions that run with GPUI support. /// `#[gpui::test]` can be used to annotate test functions that run with GPUI support.
/// it supports both synchronous and asynchronous tests, and can provide you with /// it supports both synchronous and asynchronous tests, and can provide you with
/// as many `TestAppContext` instances as you need. /// as many `TestAppContext` instances as you need.
/// The output contains a `#[test]` annotation so this can be used with any existing /// 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 {
/// Using the same `StdRng` for behavior in your test will allow you to exercise a wide /// Using the same `StdRng` for behavior in your test will allow you to exercise a wide
/// variety of scenarios and interleavings just by changing the seed. /// variety of scenarios and interleavings just by changing the seed.
/// ///
/// #[gpui::test] also takes three different arguments: /// `#[gpui::test]` also takes three different arguments:
/// - `#[gpui::test(iterations=10)]` will run the test ten times with a different initial SEED. /// - `#[gpui::test(iterations=10)]` will run the test ten times with a different initial SEED.
/// - `#[gpui::test(retries=3)]` will run the test up to four times if it fails to try and make it pass. /// - `#[gpui::test(retries=3)]` will run the test up to four times if it fails to try and make it pass.
/// - `#[gpui::test(on_failure="crate::test::report_failure")]` will call the specified function after the /// - `#[gpui::test(on_failure="crate::test::report_failure")]` will call the specified function after the

View file

@ -8,7 +8,7 @@ use bytes::Bytes;
use futures::AsyncRead; use futures::AsyncRead;
/// Based on the implementation of AsyncBody in /// Based on the implementation of AsyncBody in
/// https://github.com/sagebind/isahc/blob/5c533f1ef4d6bdf1fd291b5103c22110f41d0bf0/src/body/mod.rs /// <https://github.com/sagebind/isahc/blob/5c533f1ef4d6bdf1fd291b5103c22110f41d0bf0/src/body/mod.rs>.
pub struct AsyncBody(pub Inner); pub struct AsyncBody(pub Inner);
pub enum Inner { pub enum Inner {

View file

@ -236,36 +236,35 @@ pub async fn prepare_completion_documentation(
documentation: &lsp::Documentation, documentation: &lsp::Documentation,
language_registry: &Arc<LanguageRegistry>, language_registry: &Arc<LanguageRegistry>,
language: Option<Arc<Language>>, language: Option<Arc<Language>>,
) -> Documentation { ) -> CompletionDocumentation {
match documentation { match documentation {
lsp::Documentation::String(text) => { lsp::Documentation::String(text) => {
if text.lines().count() <= 1 { if text.lines().count() <= 1 {
Documentation::SingleLine(text.clone()) CompletionDocumentation::SingleLine(text.clone())
} else { } else {
Documentation::MultiLinePlainText(text.clone()) CompletionDocumentation::MultiLinePlainText(text.clone())
} }
} }
lsp::Documentation::MarkupContent(lsp::MarkupContent { kind, value }) => match kind { lsp::Documentation::MarkupContent(lsp::MarkupContent { kind, value }) => match kind {
lsp::MarkupKind::PlainText => { lsp::MarkupKind::PlainText => {
if value.lines().count() <= 1 { if value.lines().count() <= 1 {
Documentation::SingleLine(value.clone()) CompletionDocumentation::SingleLine(value.clone())
} else { } else {
Documentation::MultiLinePlainText(value.clone()) CompletionDocumentation::MultiLinePlainText(value.clone())
} }
} }
lsp::MarkupKind::Markdown => { lsp::MarkupKind::Markdown => {
let parsed = parse_markdown(value, Some(language_registry), language).await; let parsed = parse_markdown(value, Some(language_registry), language).await;
Documentation::MultiLineMarkdown(parsed) CompletionDocumentation::MultiLineMarkdown(parsed)
} }
}, },
} }
} }
/// Documentation associated with a [`Completion`].
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum Documentation { pub enum CompletionDocumentation {
/// There is no documentation for this completion. /// There is no documentation for this completion.
Undocumented, Undocumented,
/// A single line of documentation. /// A single line of documentation.

View file

@ -266,7 +266,7 @@ impl std::fmt::Debug for ExcerptInfo {
} }
} }
/// A boundary between [`Excerpt`]s in a [`MultiBuffer`] /// A boundary between `Excerpt`s in a [`MultiBuffer`]
#[derive(Debug)] #[derive(Debug)]
pub struct ExcerptBoundary { pub struct ExcerptBoundary {
pub prev: Option<ExcerptInfo>, pub prev: Option<ExcerptInfo>,
@ -312,7 +312,7 @@ struct Excerpt {
has_trailing_newline: bool, has_trailing_newline: bool,
} }
/// A public view into an [`Excerpt`] in a [`MultiBuffer`]. /// A public view into an `Excerpt` in a [`MultiBuffer`].
/// ///
/// Contains methods for getting the [`Buffer`] of the excerpt, /// Contains methods for getting the [`Buffer`] of the excerpt,
/// as well as mapping offsets to/from buffer and multibuffer coordinates. /// as well as mapping offsets to/from buffer and multibuffer coordinates.
@ -332,7 +332,7 @@ struct ExcerptIdMapping {
locator: Locator, locator: Locator,
} }
/// A range of text from a single [`Buffer`], to be shown as an [`Excerpt`]. /// A range of text from a single [`Buffer`], to be shown as an `Excerpt`.
/// These ranges are relative to the buffer itself /// These ranges are relative to the buffer itself
#[derive(Clone, Debug, Eq, PartialEq, Hash)] #[derive(Clone, Debug, Eq, PartialEq, Hash)]
pub struct ExcerptRange<T> { pub struct ExcerptRange<T> {

View file

@ -3,7 +3,7 @@ use std::sync::LazyLock;
/// Returns whether the given country code is supported by OpenAI. /// Returns whether the given country code is supported by OpenAI.
/// ///
/// https://platform.openai.com/docs/supported-countries /// <https://platform.openai.com/docs/supported-countries>
pub fn is_supported_country(country_code: &str) -> bool { pub fn is_supported_country(country_code: &str) -> bool {
SUPPORTED_COUNTRIES.contains(&country_code) SUPPORTED_COUNTRIES.contains(&country_code)
} }

View file

@ -36,7 +36,7 @@ use language::{
markdown, point_to_lsp, prepare_completion_documentation, markdown, point_to_lsp, prepare_completion_documentation,
proto::{deserialize_anchor, deserialize_version, serialize_anchor, serialize_version}, proto::{deserialize_anchor, deserialize_version, serialize_anchor, serialize_version},
range_from_lsp, range_to_lsp, Bias, Buffer, BufferSnapshot, CachedLspAdapter, CodeLabel, range_from_lsp, range_to_lsp, Bias, Buffer, BufferSnapshot, CachedLspAdapter, CodeLabel,
Diagnostic, DiagnosticEntry, DiagnosticSet, Diff, Documentation, File as _, Language, CompletionDocumentation, Diagnostic, DiagnosticEntry, DiagnosticSet, Diff, File as _, Language,
LanguageName, LanguageRegistry, LanguageServerBinaryStatus, LanguageToolchainStore, LocalFile, LanguageName, LanguageRegistry, LanguageServerBinaryStatus, LanguageToolchainStore, LocalFile,
LspAdapter, LspAdapterDelegate, Patch, PointUtf16, TextBufferSnapshot, ToOffset, ToPointUtf16, LspAdapter, LspAdapterDelegate, Patch, PointUtf16, TextBufferSnapshot, ToOffset, ToPointUtf16,
Transaction, Unclipped, Transaction, Unclipped,
@ -4359,7 +4359,7 @@ impl LspStore {
} else { } else {
let mut completions = completions.borrow_mut(); let mut completions = completions.borrow_mut();
let completion = &mut completions[completion_index]; let completion = &mut completions[completion_index];
completion.documentation = Some(Documentation::Undocumented); completion.documentation = Some(CompletionDocumentation::Undocumented);
} }
// 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 // 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 {
let lsp_completion = serde_json::from_slice(&response.lsp_completion)?; let lsp_completion = serde_json::from_slice(&response.lsp_completion)?;
let documentation = if response.documentation.is_empty() { let documentation = if response.documentation.is_empty() {
Documentation::Undocumented CompletionDocumentation::Undocumented
} else if response.documentation_is_markdown { } else if response.documentation_is_markdown {
Documentation::MultiLineMarkdown( CompletionDocumentation::MultiLineMarkdown(
markdown::parse_markdown(&response.documentation, Some(&language_registry), None) markdown::parse_markdown(&response.documentation, Some(&language_registry), None)
.await, .await,
) )
} else if response.documentation.lines().count() <= 1 { } else if response.documentation.lines().count() <= 1 {
Documentation::SingleLine(response.documentation) CompletionDocumentation::SingleLine(response.documentation)
} else { } else {
Documentation::MultiLinePlainText(response.documentation) CompletionDocumentation::MultiLinePlainText(response.documentation)
}; };
let mut completions = completions.borrow_mut(); let mut completions = completions.borrow_mut();

View file

@ -56,9 +56,9 @@ use gpui::{
use itertools::Itertools; use itertools::Itertools;
use language::{ use language::{
language_settings::InlayHintKind, proto::split_operations, Buffer, BufferEvent, language_settings::InlayHintKind, proto::split_operations, Buffer, BufferEvent,
CachedLspAdapter, Capability, CodeLabel, Documentation, File as _, Language, LanguageName, CachedLspAdapter, Capability, CodeLabel, CompletionDocumentation, File as _, Language,
LanguageRegistry, PointUtf16, ToOffset, ToPointUtf16, Toolchain, ToolchainList, Transaction, LanguageName, LanguageRegistry, PointUtf16, ToOffset, ToPointUtf16, Toolchain, ToolchainList,
Unclipped, Transaction, Unclipped,
}; };
use lsp::{ use lsp::{
CodeActionKind, CompletionContext, CompletionItemKind, DocumentHighlightKind, LanguageServer, CodeActionKind, CompletionContext, CompletionItemKind, DocumentHighlightKind, LanguageServer,
@ -368,7 +368,7 @@ pub struct Completion {
/// The id of the language server that produced this completion. /// The id of the language server that produced this completion.
pub server_id: LanguageServerId, pub server_id: LanguageServerId,
/// The documentation for this completion. /// The documentation for this completion.
pub documentation: Option<Documentation>, pub documentation: Option<CompletionDocumentation>,
/// The raw completion provided by the language server. /// The raw completion provided by the language server.
pub lsp_completion: lsp::CompletionItem, pub lsp_completion: lsp::CompletionItem,
/// Whether this completion has been resolved, to ensure it happens once per completion. /// Whether this completion has been resolved, to ensure it happens once per completion.

View file

@ -53,11 +53,6 @@ pub struct AppVersion;
impl AppVersion { impl AppVersion {
/// Initializes the global [`AppVersion`]. /// Initializes the global [`AppVersion`].
///
/// Attempts to read the version number from the following locations, in order:
/// 1. the `ZED_APP_VERSION` environment variable,
/// 2. the [`AppContext::app_metadata`],
/// 3. the passed in `pkg_version`.
pub fn init(pkg_version: &str) -> SemanticVersion { pub fn init(pkg_version: &str) -> SemanticVersion {
if let Ok(from_env) = env::var("ZED_APP_VERSION") { if let Ok(from_env) = env::var("ZED_APP_VERSION") {
from_env.parse().expect("invalid ZED_APP_VERSION") from_env.parse().expect("invalid ZED_APP_VERSION")

View file

@ -139,7 +139,7 @@ impl futures::Stream for StreamReader {
} }
} }
/// Implementation from https://docs.rs/tokio-util/0.7.12/src/tokio_util/util/poll_buf.rs.html /// Implementation from <https://docs.rs/tokio-util/0.7.12/src/tokio_util/util/poll_buf.rs.html>
/// Specialized for this use case /// Specialized for this use case
pub fn poll_read_buf( pub fn poll_read_buf(
io: &mut Pin<Box<dyn futures::AsyncRead + Send + Sync>>, io: &mut Pin<Box<dyn futures::AsyncRead + Send + Sync>>,

View file

@ -32,12 +32,13 @@ pub trait Settings: 'static + Send + Sync {
/// from the root object. /// from the root object.
const KEY: Option<&'static str>; const KEY: Option<&'static str>;
/// The name of the keys in the [`FileContent`] that should always be written to /// The name of the keys in the [`FileContent`](Self::FileContent) that should
/// a settings file, even if their value matches the default value. /// always be written to a settings file, even if their value matches the default
/// value.
/// ///
/// This is useful for tagged [`FileContent`]s where the tag is a "version" field /// This is useful for tagged [`FileContent`](Self::FileContent)s where the tag
/// that should always be persisted, even if the current user settings match the /// is a "version" field that should always be persisted, even if the current
/// current version of the settings. /// user settings match the current version of the settings.
const PRESERVED_KEYS: Option<&'static [&'static str]> = None; const PRESERVED_KEYS: Option<&'static [&'static str]> = None;
/// The type that is stored in an individual JSON file. /// The type that is stored in an individual JSON file.

View file

@ -32,7 +32,7 @@ pub trait KeyedItem: Item {
/// A type that describes the Sum of all [`Item`]s in a subtree of the [`SumTree`] /// A type that describes the Sum of all [`Item`]s in a subtree of the [`SumTree`]
/// ///
/// Each Summary type can have multiple [`Dimensions`] that it measures, /// Each Summary type can have multiple [`Dimension`]s that it measures,
/// which can be used to navigate the tree /// which can be used to navigate the tree
pub trait Summary: Clone { pub trait Summary: Clone {
type Context; type Context;

View file

@ -122,7 +122,7 @@ pub struct PathLikeTarget {
/// A string inside terminal, potentially useful as a URI that can be opened. /// A string inside terminal, potentially useful as a URI that can be opened.
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum MaybeNavigationTarget { pub enum MaybeNavigationTarget {
/// HTTP, git, etc. string determined by the [`URL_REGEX`] regex. /// HTTP, git, etc. string determined by the `URL_REGEX` regex.
Url(String), Url(String),
/// File system path, absolute or relative, existing or not. /// File system path, absolute or relative, existing or not.
/// Might have line and column number(s) attached as `file.rs:1:23` /// 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 {
/// Converts an 8 bit ANSI color to its GPUI equivalent. /// Converts an 8 bit ANSI color to its GPUI equivalent.
/// Accepts `usize` for compatibility with the `alacritty::Colors` interface, /// Accepts `usize` for compatibility with the `alacritty::Colors` interface,
/// Other than that use case, should only be called with values in the [0,255] range /// Other than that use case, should only be called with values in the `[0,255]` range
pub fn get_color_at_index(index: usize, theme: &Theme) -> Hsla { pub fn get_color_at_index(index: usize, theme: &Theme) -> Hsla {
let colors = theme.colors(); let colors = theme.colors();

View file

@ -425,7 +425,7 @@ impl BufferLineHeight {
} }
impl ThemeSettings { impl ThemeSettings {
/// Returns the [AdjustedBufferFontSize]. /// Returns the buffer font size.
pub fn buffer_font_size(&self) -> Pixels { pub fn buffer_font_size(&self) -> Pixels {
Self::clamp_font_size(self.buffer_font_size) Self::clamp_font_size(self.buffer_font_size)
} }

View file

@ -349,8 +349,8 @@ impl ButtonCommon for Button {
/// Sets a tooltip for the button. /// Sets a tooltip for the button.
/// ///
/// This method allows a tooltip to be set for the button. The tooltip is a function that /// This method allows a tooltip to be set for the button. The tooltip is a function that
/// takes a mutable reference to a [`WindowContext`] and returns an [`AnyView`]. The tooltip /// takes a mutable references to [`Window`] and [`App`], and returns an [`AnyView`]. The
/// is displayed when the user hovers over the button. /// tooltip is displayed when the user hovers over the button.
/// ///
/// # Examples /// # Examples
/// ///

View file

@ -31,7 +31,7 @@ pub struct ContentGroup {
} }
impl ContentGroup { impl ContentGroup {
/// Creates a new [ContentBox]. /// Creates a new [`ContentGroup`].
pub fn new() -> Self { pub fn new() -> Self {
Self { Self {
base: div(), base: div(),
@ -41,13 +41,13 @@ impl ContentGroup {
} }
} }
/// Removes the border from the [ContentBox]. /// Removes the border from the [`ContentGroup`].
pub fn borderless(mut self) -> Self { pub fn borderless(mut self) -> Self {
self.border = false; self.border = false;
self self
} }
/// Removes the background fill from the [ContentBox]. /// Removes the background fill from the [`ContentGroup`].
pub fn unfilled(mut self) -> Self { pub fn unfilled(mut self) -> Self {
self.fill = false; self.fill = false;
self self

View file

@ -28,7 +28,7 @@ pub enum VectorName {
/// A vector image, such as an SVG. /// A vector image, such as an SVG.
/// ///
/// A [`Vector`] is different from an [`Icon`] in that it is intended /// A [`Vector`] is different from an [`crate::Icon`] in that it is intended
/// to be displayed at a specific size, or series of sizes, rather /// to be displayed at a specific size, or series of sizes, rather
/// than conforming to the standard size of an icon. /// than conforming to the standard size of an icon.
#[derive(IntoElement)] #[derive(IntoElement)]

View file

@ -42,8 +42,9 @@ impl Navigable {
} }
/// Add a new entry that can be navigated to via keyboard. /// Add a new entry that can be navigated to via keyboard.
/// The order of calls to [Navigable::entry] determines the order of traversal of elements via successive ///
/// uses of [menu:::SelectNext]/[menu::SelectPrev] /// The order of calls to [Navigable::entry] determines the order of traversal of
/// elements via successive uses of `menu:::SelectNext/SelectPrev`
pub fn entry(mut self, child: NavigableEntry) -> Self { pub fn entry(mut self, child: NavigableEntry) -> Self {
self.selectable_children.push(child); self.selectable_children.push(child);
self self
@ -59,6 +60,7 @@ impl Navigable {
.position(|entry| entry.focus_handle.contains_focused(window, cx)) .position(|entry| entry.focus_handle.contains_focused(window, cx))
} }
} }
impl RenderOnce for Navigable { impl RenderOnce for Navigable {
fn render(self, _window: &mut Window, _: &mut App) -> impl crate::IntoElement { fn render(self, _window: &mut Window, _: &mut App) -> impl crate::IntoElement {
div() div()

View file

@ -5,6 +5,8 @@ use std::sync::Arc;
use crate::prelude::*; use crate::prelude::*;
/// A [`Checkbox`] that has a [`Label`]. /// A [`Checkbox`] that has a [`Label`].
///
/// [`Checkbox`]: crate::components::Checkbox
#[derive(IntoElement)] #[derive(IntoElement)]
pub struct RadioWithLabel { pub struct RadioWithLabel {
id: ElementId, id: ElementId,

View file

@ -22,7 +22,7 @@ pub enum ElevationIndex {
EditorSurface, EditorSurface,
/// A surface that is elevated above the primary surface. but below washes, models, and dragged elements. /// A surface that is elevated above the primary surface. but below washes, models, and dragged elements.
ElevatedSurface, ElevatedSurface,
/// A surface above the [ElevationIndex::Wash] that is used for dialogs, alerts, modals, etc. /// A surface above the [ElevationIndex::ElevatedSurface] that is used for dialogs, alerts, modals, etc.
ModalSurface, ModalSurface,
} }

View file

@ -24,7 +24,7 @@ pub trait StyledTypography: Styled + Sized {
self.font_family(ui_font_family) self.font_family(ui_font_family)
} }
/// Sets the text size using a [`UiTextSize`]. /// Sets the text size using a [`TextSize`].
fn text_ui_size(self, size: TextSize, cx: &App) -> Self { fn text_ui_size(self, size: TextSize, cx: &App) -> Self {
self.text_size(size.rems(cx)) self.text_size(size.rems(cx))
} }

View file

@ -42,9 +42,9 @@ pub trait StyledExt: Styled + Sized {
elevated(self, cx, ElevationIndex::Surface) elevated(self, cx, ElevationIndex::Surface)
} }
/// See [`elevation_1`]. /// See [`elevation_1`](Self::elevation_1).
/// ///
/// Renders a borderless version [`elevation_1`]. /// Renders a borderless version [`elevation_1`](Self::elevation_1).
fn elevation_1_borderless(self, cx: &mut App) -> Self { fn elevation_1_borderless(self, cx: &mut App) -> Self {
elevated_borderless(self, cx, ElevationIndex::Surface) elevated_borderless(self, cx, ElevationIndex::Surface)
} }
@ -58,9 +58,9 @@ pub trait StyledExt: Styled + Sized {
elevated(self, cx, ElevationIndex::ElevatedSurface) elevated(self, cx, ElevationIndex::ElevatedSurface)
} }
/// See [`elevation_2`]. /// See [`elevation_2`](Self::elevation_2).
/// ///
/// Renders a borderless version [`elevation_2`]. /// Renders a borderless version [`elevation_2`](Self::elevation_2).
fn elevation_2_borderless(self, cx: &mut App) -> Self { fn elevation_2_borderless(self, cx: &mut App) -> Self {
elevated_borderless(self, cx, ElevationIndex::ElevatedSurface) elevated_borderless(self, cx, ElevationIndex::ElevatedSurface)
} }
@ -78,9 +78,9 @@ pub trait StyledExt: Styled + Sized {
elevated(self, cx, ElevationIndex::ModalSurface) elevated(self, cx, ElevationIndex::ModalSurface)
} }
/// See [`elevation_3`]. /// See [`elevation_3`](Self::elevation_3).
/// ///
/// Renders a borderless version [`elevation_3`]. /// Renders a borderless version [`elevation_3`](Self::elevation_3).
fn elevation_3_borderless(self, cx: &mut App) -> Self { fn elevation_3_borderless(self, cx: &mut App) -> Self {
elevated_borderless(self, cx, ElevationIndex::ModalSurface) elevated_borderless(self, cx, ElevationIndex::ModalSurface)
} }

View file

@ -7,8 +7,7 @@
//! ## Related Crates: //! ## Related Crates:
//! //!
//! - [`ui_macros`] - proc_macros support for this crate //! - [`ui_macros`] - proc_macros support for this crate
//! - [`ui_input`] - the single line input component //! - `ui_input` - the single line input component
//!
mod components; mod components;
pub mod prelude; pub mod prelude;

View file

@ -22,6 +22,8 @@ impl WithRemSize {
/// Block the mouse from interacting with this element or any of its children /// Block the mouse from interacting with this element or any of its children
/// The fluent API equivalent to [`Interactivity::occlude_mouse`] /// The fluent API equivalent to [`Interactivity::occlude_mouse`]
///
/// [`Interactivity::occlude_mouse`]: gpui::Interactivity::occlude_mouse
pub fn occlude(mut self) -> Self { pub fn occlude(mut self) -> Self {
self.div = self.div.occlude(); self.div = self.div.occlude();
self self