blob: 12989c221eb7509278b185c3a9a78a3f0090d274 [file] [log] [blame] [edit]
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="ide crate provides “ide-centric” APIs for the rust-analyzer. That is, it generally operates with files and text ranges, and returns results as Strings, suitable for displaying to the human."><title>ide - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-84e720fa.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="ide" data-themes="" data-resource-suffix="" data-rustdoc-version="1.89.0 (29483883e 2025-08-04)" data-channel="1.89.0" data-search-js="search-92309212.js" data-settings-js="settings-5514c975.js" ><script src="../static.files/storage-4e99c027.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-fd3af306.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../ide/index.html">ide</a><span class="version">0.0.0</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#structs">Crate Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#types" title="Type Aliases">Type Aliases</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>ide</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/ide/lib.rs.html#1-901">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>ide crate provides “ide-centric” APIs for the rust-analyzer. That is,
it generally operates with files and text ranges, and returns results as
Strings, suitable for displaying to the human.</p>
<p>What powers this API are the <code>RootDatabase</code> struct, which defines a <code>salsa</code>
database, and the <code>hir</code> crate, where majority of the analysis happens.
However, IDE specific bits of the analysis (most notably completion) happen
in this crate.</p>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Analysis.html" title="struct ide::Analysis">Analysis</a></dt><dd>Analysis is a snapshot of a world state at a moment in time. It is the main
entry point for asking semantic information about the world. When the world
state is advanced using <code>AnalysisHost::apply_change</code> method, all existing
<code>Analysis</code> are canceled (most method return <code>Err(Canceled)</code>).</dd><dt><a class="struct" href="struct.AnalysisHost.html" title="struct ide::AnalysisHost">Analysis<wbr>Host</a></dt><dd><code>AnalysisHost</code> stores the current state of the world.</dd><dt><a class="struct" href="struct.Annotation.html" title="struct ide::Annotation">Annotation</a></dt><dt><a class="struct" href="struct.AnnotationConfig.html" title="struct ide::AnnotationConfig">Annotation<wbr>Config</a></dt><dt><a class="struct" href="struct.Assist.html" title="struct ide::Assist">Assist</a></dt><dt><a class="struct" href="struct.AssistConfig.html" title="struct ide::AssistConfig">Assist<wbr>Config</a></dt><dt><a class="struct" href="struct.AssistId.html" title="struct ide::AssistId">Assist<wbr>Id</a></dt><dd>Unique identifier of the assist, should not be shown to the user
directly.</dd><dt><a class="struct" href="struct.CallHierarchyConfig.html" title="struct ide::CallHierarchyConfig">Call<wbr>Hierarchy<wbr>Config</a></dt><dt><a class="struct" href="struct.CallItem.html" title="struct ide::CallItem">Call<wbr>Item</a></dt><dt><a class="struct" href="struct.CompletionConfig.html" title="struct ide::CompletionConfig">Completion<wbr>Config</a></dt><dt><a class="struct" href="struct.CompletionFieldsToResolve.html" title="struct ide::CompletionFieldsToResolve">Completion<wbr>Fields<wbr>ToResolve</a></dt><dt><a class="struct" href="struct.CompletionItem.html" title="struct ide::CompletionItem">Completion<wbr>Item</a></dt><dd><code>CompletionItem</code> describes a single completion entity which expands to 1 or more entries in the
editor pop-up.</dd><dt><a class="struct" href="struct.CompletionRelevance.html" title="struct ide::CompletionRelevance">Completion<wbr>Relevance</a></dt><dt><a class="struct" href="struct.Crate.html" title="struct ide::Crate">Crate</a></dt><dt><a class="struct" href="struct.CrateGraphBuilder.html" title="struct ide::CrateGraphBuilder">Crate<wbr>Graph<wbr>Builder</a></dt><dt><a class="struct" href="struct.Diagnostic.html" title="struct ide::Diagnostic">Diagnostic</a></dt><dt><a class="struct" href="struct.DiagnosticsConfig.html" title="struct ide::DiagnosticsConfig">Diagnostics<wbr>Config</a></dt><dt><a class="struct" href="struct.Documentation.html" title="struct ide::Documentation">Documentation</a></dt><dd>Holds documentation</dd><dt><a class="struct" href="struct.ExpandedMacro.html" title="struct ide::ExpandedMacro">Expanded<wbr>Macro</a></dt><dt><a class="struct" href="struct.FileChange.html" title="struct ide::FileChange">File<wbr>Change</a></dt><dd>Encapsulate a bunch of raw <code>.set</code> calls on the database.</dd><dt><a class="struct" href="struct.FileId.html" title="struct ide::FileId">FileId</a></dt><dd>Handle to a file in [<code>Vfs</code>]</dd><dt><a class="struct" href="struct.FileStructureConfig.html" title="struct ide::FileStructureConfig">File<wbr>Structure<wbr>Config</a></dt><dt><a class="struct" href="struct.Fold.html" title="struct ide::Fold">Fold</a></dt><dt><a class="struct" href="struct.GenericParameterHints.html" title="struct ide::GenericParameterHints">Generic<wbr>Parameter<wbr>Hints</a></dt><dt><a class="struct" href="struct.Highlight.html" title="struct ide::Highlight">Highlight</a></dt><dt><a class="struct" href="struct.HighlightConfig.html" title="struct ide::HighlightConfig">Highlight<wbr>Config</a></dt><dt><a class="struct" href="struct.HighlightRelatedConfig.html" title="struct ide::HighlightRelatedConfig">Highlight<wbr>Related<wbr>Config</a></dt><dt><a class="struct" href="struct.HighlightedRange.html" title="struct ide::HighlightedRange">Highlighted<wbr>Range</a></dt><dt><a class="struct" href="struct.HlMods.html" title="struct ide::HlMods">HlMods</a></dt><dt><a class="struct" href="struct.HlRange.html" title="struct ide::HlRange">HlRange</a></dt><dt><a class="struct" href="struct.HoverConfig.html" title="struct ide::HoverConfig">Hover<wbr>Config</a></dt><dt><a class="struct" href="struct.HoverGotoTypeData.html" title="struct ide::HoverGotoTypeData">Hover<wbr>Goto<wbr>Type<wbr>Data</a></dt><dt><a class="struct" href="struct.HoverResult.html" title="struct ide::HoverResult">Hover<wbr>Result</a></dt><dd>Contains the results when hovering over an item</dd><dt><a class="struct" href="struct.Indel.html" title="struct ide::Indel">Indel</a></dt><dd><code>InsertDelete</code> – a single “atomic” change to text</dd><dt><a class="struct" href="struct.InlayFieldsToResolve.html" title="struct ide::InlayFieldsToResolve">Inlay<wbr>Fields<wbr>ToResolve</a></dt><dt><a class="struct" href="struct.InlayHint.html" title="struct ide::InlayHint">Inlay<wbr>Hint</a></dt><dt><a class="struct" href="struct.InlayHintLabel.html" title="struct ide::InlayHintLabel">Inlay<wbr>Hint<wbr>Label</a></dt><dt><a class="struct" href="struct.InlayHintLabelPart.html" title="struct ide::InlayHintLabelPart">Inlay<wbr>Hint<wbr>Label<wbr>Part</a></dt><dt><a class="struct" href="struct.InlayHintsConfig.html" title="struct ide::InlayHintsConfig">Inlay<wbr>Hints<wbr>Config</a></dt><dt><a class="struct" href="struct.JoinLinesConfig.html" title="struct ide::JoinLinesConfig">Join<wbr>Lines<wbr>Config</a></dt><dt><a class="struct" href="struct.Label.html" title="struct ide::Label">Label</a></dt><dd>A type to specify UI label, like an entry in the list of assists. Enforces
proper casing:</dd><dt><a class="struct" href="struct.LineCol.html" title="struct ide::LineCol">LineCol</a></dt><dd><code>(line, column)</code> information in the native, UTF-8 encoding.</dd><dt><a class="struct" href="struct.LineIndex.html" title="struct ide::LineIndex">Line<wbr>Index</a></dt><dd>Maps flat <a href="struct.TextSize.html" title="struct ide::TextSize"><code>TextSize</code></a> offsets to/from <code>(line, column)</code> representation.</dd><dt><a class="struct" href="struct.Markup.html" title="struct ide::Markup">Markup</a></dt><dt><a class="struct" href="struct.MemoryLayoutHoverConfig.html" title="struct ide::MemoryLayoutHoverConfig">Memory<wbr>Layout<wbr>Hover<wbr>Config</a></dt><dt><a class="struct" href="struct.Moniker.html" title="struct ide::Moniker">Moniker</a></dt><dd>Information which uniquely identifies a definition which might be referenceable outside of the
source file. Visibility declarations do not affect presence.</dd><dt><a class="struct" href="struct.MonikerIdentifier.html" title="struct ide::MonikerIdentifier">Moniker<wbr>Identifier</a></dt><dt><a class="struct" href="struct.NavigationTarget.html" title="struct ide::NavigationTarget">Navigation<wbr>Target</a></dt><dd><code>NavigationTarget</code> represents an element in the editor’s UI which you can
click on to navigate to a particular piece of code.</dd><dt><a class="struct" href="struct.PackageInformation.html" title="struct ide::PackageInformation">Package<wbr>Information</a></dt><dt><a class="struct" href="struct.ParallelPrimeCachesProgress.html" title="struct ide::ParallelPrimeCachesProgress">Parallel<wbr>Prime<wbr>Caches<wbr>Progress</a></dt><dd>We’re indexing many crates.</dd><dt><a class="struct" href="struct.Query.html" title="struct ide::Query">Query</a></dt><dt><a class="struct" href="struct.RangeInfo.html" title="struct ide::RangeInfo">Range<wbr>Info</a></dt><dd>Info associated with a text range.</dd><dt><a class="struct" href="struct.ReferenceCategory.html" title="struct ide::ReferenceCategory">Reference<wbr>Category</a></dt><dt><a class="struct" href="struct.ReferenceSearchResult.html" title="struct ide::ReferenceSearchResult">Reference<wbr>Search<wbr>Result</a></dt><dd>Result of a reference search operation.</dd><dt><a class="struct" href="struct.RenameError.html" title="struct ide::RenameError">Rename<wbr>Error</a></dt><dt><a class="struct" href="struct.RootDatabase.html" title="struct ide::RootDatabase">Root<wbr>Database</a></dt><dt><a class="struct" href="struct.Runnable.html" title="struct ide::Runnable">Runnable</a></dt><dt><a class="struct" href="struct.SearchScope.html" title="struct ide::SearchScope">Search<wbr>Scope</a></dt><dd>Generally, <code>search_scope</code> returns files that might contain references for the element.
For <code>pub(crate)</code> things it’s a crate, for <code>pub</code> things it’s a crate and dependant crates.
In some cases, the location of the references is known to within a <code>TextRange</code>,
e.g. for things like local variables.</dd><dt><a class="struct" href="struct.Semantics.html" title="struct ide::Semantics">Semantics</a></dt><dd>Primary API to get semantic information, like types, from syntax trees.</dd><dt><a class="struct" href="struct.SignatureHelp.html" title="struct ide::SignatureHelp">Signature<wbr>Help</a></dt><dd>Contains information about an item signature as seen from a use site.</dd><dt><a class="struct" href="struct.SingleResolve.html" title="struct ide::SingleResolve">Single<wbr>Resolve</a></dt><dd>Hold the <a href="struct.AssistId.html" title="struct ide::AssistId"><code>AssistId</code></a> data of a certain assist to resolve.
The original id object cannot be used due to a <code>'static</code> lifetime
and the requirement to construct this struct dynamically during the resolve handling.</dd><dt><a class="struct" href="struct.Snippet.html" title="struct ide::Snippet">Snippet</a></dt><dd>A user supplied snippet.</dd><dt><a class="struct" href="struct.SnippetEdit.html" title="struct ide::SnippetEdit">Snippet<wbr>Edit</a></dt><dt><a class="struct" href="struct.SourceChange.html" title="struct ide::SourceChange">Source<wbr>Change</a></dt><dt><a class="struct" href="struct.SourceRoot.html" title="struct ide::SourceRoot">Source<wbr>Root</a></dt><dd>Files are grouped into source roots. A source root is a directory on the
file systems which is watched for changes. Typically it corresponds to a
Rust crate. Source roots <em>might</em> be nested: in this case, a file belongs to
the nearest enclosing source root. Paths to files are always relative to a
source root, and the analyzer does not know the root path of the source root at
all. So, a file from one source root can’t refer to a file in another source
root by path.</dd><dt><a class="struct" href="struct.SourceRootId.html" title="struct ide::SourceRootId">Source<wbr>Root<wbr>Id</a></dt><dt><a class="struct" href="struct.SsrError.html" title="struct ide::SsrError">SsrError</a></dt><dt><a class="struct" href="struct.StaticIndex.html" title="struct ide::StaticIndex">Static<wbr>Index</a></dt><dd>A static representation of fully analyzed source code.</dd><dt><a class="struct" href="struct.StaticIndexedFile.html" title="struct ide::StaticIndexedFile">Static<wbr>Indexed<wbr>File</a></dt><dt><a class="struct" href="struct.StructureNode.html" title="struct ide::StructureNode">Structure<wbr>Node</a></dt><dt><a class="struct" href="struct.TestItem.html" title="struct ide::TestItem">Test<wbr>Item</a></dt><dt><a class="struct" href="struct.TextEdit.html" title="struct ide::TextEdit">Text<wbr>Edit</a></dt><dt><a class="struct" href="struct.TextRange.html" title="struct ide::TextRange">Text<wbr>Range</a></dt><dd>A range in text, represented as a pair of <a href="struct.TextSize.html" title="struct ide::TextSize"><code>TextSize</code></a>.</dd><dt><a class="struct" href="struct.TextSize.html" title="struct ide::TextSize">Text<wbr>Size</a></dt><dd>A measure of text length. Also, equivalently, an index into text.</dd><dt><a class="struct" href="struct.TokenId.html" title="struct ide::TokenId">TokenId</a></dt><dt><a class="struct" href="struct.TokenStaticData.html" title="struct ide::TokenStaticData">Token<wbr>Static<wbr>Data</a></dt><dt><a class="struct" href="struct.UpdateTest.html" title="struct ide::UpdateTest">Update<wbr>Test</a></dt><dt><a class="struct" href="struct.UpmappingResult.html" title="struct ide::UpmappingResult">Upmapping<wbr>Result</a></dt></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.AdjustmentHints.html" title="enum ide::AdjustmentHints">Adjustment<wbr>Hints</a></dt><dt><a class="enum" href="enum.AdjustmentHintsMode.html" title="enum ide::AdjustmentHintsMode">Adjustment<wbr>Hints<wbr>Mode</a></dt><dt><a class="enum" href="enum.AnnotationKind.html" title="enum ide::AnnotationKind">Annotation<wbr>Kind</a></dt><dt><a class="enum" href="enum.AnnotationLocation.html" title="enum ide::AnnotationLocation">Annotation<wbr>Location</a></dt><dt><a class="enum" href="enum.AssistKind.html" title="enum ide::AssistKind">Assist<wbr>Kind</a></dt><dt><a class="enum" href="enum.AssistResolveStrategy.html" title="enum ide::AssistResolveStrategy">Assist<wbr>Resolve<wbr>Strategy</a></dt><dd>A way to control how many assist to resolve during the assist resolution.
When an assist is resolved, its edits are calculated that might be costly to always do by default.</dd><dt><a class="enum" href="enum.CallableSnippets.html" title="enum ide::CallableSnippets">Callable<wbr>Snippets</a></dt><dt><a class="enum" href="enum.ClosureReturnTypeHints.html" title="enum ide::ClosureReturnTypeHints">Closure<wbr>Return<wbr>Type<wbr>Hints</a></dt><dt><a class="enum" href="enum.CompletionItemKind.html" title="enum ide::CompletionItemKind">Completion<wbr>Item<wbr>Kind</a></dt><dd>The type of the completion item.</dd><dt><a class="enum" href="enum.CompletionItemRefMode.html" title="enum ide::CompletionItemRefMode">Completion<wbr>Item<wbr>RefMode</a></dt><dt><a class="enum" href="enum.DiagnosticCode.html" title="enum ide::DiagnosticCode">Diagnostic<wbr>Code</a></dt><dt><a class="enum" href="enum.Direction.html" title="enum ide::Direction">Direction</a></dt><dt><a class="enum" href="enum.DiscriminantHints.html" title="enum ide::DiscriminantHints">Discriminant<wbr>Hints</a></dt><dt><a class="enum" href="enum.Edition.html" title="enum ide::Edition">Edition</a></dt><dt><a class="enum" href="enum.ExprFillDefaultMode.html" title="enum ide::ExprFillDefaultMode">Expr<wbr>Fill<wbr>Default<wbr>Mode</a></dt><dt><a class="enum" href="enum.FileSystemEdit.html" title="enum ide::FileSystemEdit">File<wbr>System<wbr>Edit</a></dt><dt><a class="enum" href="enum.FoldKind.html" title="enum ide::FoldKind">Fold<wbr>Kind</a></dt><dt><a class="enum" href="enum.HlMod.html" title="enum ide::HlMod">HlMod</a></dt><dt><a class="enum" href="enum.HlOperator.html" title="enum ide::HlOperator">HlOperator</a></dt><dt><a class="enum" href="enum.HlPunct.html" title="enum ide::HlPunct">HlPunct</a></dt><dt><a class="enum" href="enum.HlTag.html" title="enum ide::HlTag">HlTag</a></dt><dt><a class="enum" href="enum.HoverAction.html" title="enum ide::HoverAction">Hover<wbr>Action</a></dt><dt><a class="enum" href="enum.HoverDocFormat.html" title="enum ide::HoverDocFormat">Hover<wbr>DocFormat</a></dt><dt><a class="enum" href="enum.InlayHintPosition.html" title="enum ide::InlayHintPosition">Inlay<wbr>Hint<wbr>Position</a></dt><dt><a class="enum" href="enum.InlayKind.html" title="enum ide::InlayKind">Inlay<wbr>Kind</a></dt><dt><a class="enum" href="enum.InlayTooltip.html" title="enum ide::InlayTooltip">Inlay<wbr>Tooltip</a></dt><dt><a class="enum" href="enum.LazyProperty.html" title="enum ide::LazyProperty">Lazy<wbr>Property</a></dt><dd>A type signaling that a value is either computed, or is available for computation.</dd><dt><a class="enum" href="enum.LifetimeElisionHints.html" title="enum ide::LifetimeElisionHints">Lifetime<wbr>Elision<wbr>Hints</a></dt><dt><a class="enum" href="enum.MemoryLayoutHoverRenderKind.html" title="enum ide::MemoryLayoutHoverRenderKind">Memory<wbr>Layout<wbr>Hover<wbr>Render<wbr>Kind</a></dt><dt><a class="enum" href="enum.MonikerDescriptorKind.html" title="enum ide::MonikerDescriptorKind">Moniker<wbr>Descriptor<wbr>Kind</a></dt><dt><a class="enum" href="enum.MonikerKind.html" title="enum ide::MonikerKind">Moniker<wbr>Kind</a></dt><dt><a class="enum" href="enum.MonikerResult.html" title="enum ide::MonikerResult">Moniker<wbr>Result</a></dt><dt><a class="enum" href="enum.RunnableKind.html" title="enum ide::RunnableKind">Runnable<wbr>Kind</a></dt><dt><a class="enum" href="enum.Severity.html" title="enum ide::Severity">Severity</a></dt><dt><a class="enum" href="enum.SnippetScope.html" title="enum ide::SnippetScope">Snippet<wbr>Scope</a></dt><dd>A snippet scope describing where a snippet may apply to.
These may differ slightly in meaning depending on the snippet trigger.</dd><dt><a class="enum" href="enum.StructureNodeKind.html" title="enum ide::StructureNodeKind">Structure<wbr>Node<wbr>Kind</a></dt><dt><a class="enum" href="enum.SubstTyLen.html" title="enum ide::SubstTyLen">Subst<wbr>TyLen</a></dt><dt><a class="enum" href="enum.SymbolInformationKind.html" title="enum ide::SymbolInformationKind">Symbol<wbr>Information<wbr>Kind</a></dt><dt><a class="enum" href="enum.SymbolKind.html" title="enum ide::SymbolKind">Symbol<wbr>Kind</a></dt><dt><a class="enum" href="enum.TestId.html" title="enum ide::TestId">TestId</a></dt><dt><a class="enum" href="enum.TestItemKind.html" title="enum ide::TestItemKind">Test<wbr>Item<wbr>Kind</a></dt><dt><a class="enum" href="enum.VendoredLibrariesConfig.html" title="enum ide::VendoredLibrariesConfig">Vendored<wbr>Libraries<wbr>Config</a></dt></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.TryToNav.html" title="trait ide::TryToNav">TryTo<wbr>Nav</a></dt></dl><h2 id="types" class="section-header">Type Aliases<a href="#types" class="anchor">§</a></h2><dl class="item-table"><dt><a class="type" href="type.Cancellable.html" title="type ide::Cancellable">Cancellable</a></dt><dt><a class="type" href="type.FilePosition.html" title="type ide::FilePosition">File<wbr>Position</a></dt><dt><a class="type" href="type.FileRange.html" title="type ide::FileRange">File<wbr>Range</a></dt></dl></section></div></main></body></html>