diff options
Diffstat (limited to 'crates/ra_ide_api/src/lib.rs')
-rw-r--r-- | crates/ra_ide_api/src/lib.rs | 38 |
1 files changed, 3 insertions, 35 deletions
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs index 9c5a82187..2873bab36 100644 --- a/crates/ra_ide_api/src/lib.rs +++ b/crates/ra_ide_api/src/lib.rs | |||
@@ -34,9 +34,9 @@ mod syntax_highlighting; | |||
34 | 34 | ||
35 | use std::{fmt, sync::Arc}; | 35 | use std::{fmt, sync::Arc}; |
36 | 36 | ||
37 | use ra_syntax::{SmolStr, SourceFile, TreePtr, SyntaxKind, TextRange, TextUnit}; | 37 | use ra_syntax::{SourceFile, TreePtr, TextRange, TextUnit}; |
38 | use ra_text_edit::TextEdit; | 38 | use ra_text_edit::TextEdit; |
39 | use ra_db::{SyntaxDatabase, FilesDatabase, LocalSyntaxPtr, BaseDatabase}; | 39 | use ra_db::{SyntaxDatabase, FilesDatabase, BaseDatabase}; |
40 | use rayon::prelude::*; | 40 | use rayon::prelude::*; |
41 | use relative_path::RelativePathBuf; | 41 | use relative_path::RelativePathBuf; |
42 | use rustc_hash::FxHashMap; | 42 | use rustc_hash::FxHashMap; |
@@ -50,6 +50,7 @@ use crate::{ | |||
50 | pub use crate::{ | 50 | pub use crate::{ |
51 | completion::{CompletionItem, CompletionItemKind, InsertText}, | 51 | completion::{CompletionItem, CompletionItemKind, InsertText}, |
52 | runnables::{Runnable, RunnableKind}, | 52 | runnables::{Runnable, RunnableKind}, |
53 | navigation_target::NavigationTarget, | ||
53 | }; | 54 | }; |
54 | pub use ra_ide_api_light::{ | 55 | pub use ra_ide_api_light::{ |
55 | Fold, FoldKind, HighlightedRange, Severity, StructureNode, | 56 | Fold, FoldKind, HighlightedRange, Severity, StructureNode, |
@@ -243,39 +244,6 @@ impl Query { | |||
243 | } | 244 | } |
244 | } | 245 | } |
245 | 246 | ||
246 | /// `NavigationTarget` represents and element in the editor's UI which you can | ||
247 | /// click on to navigate to a particular piece of code. | ||
248 | /// | ||
249 | /// Typically, a `NavigationTarget` corresponds to some element in the source | ||
250 | /// code, like a function or a struct, but this is not strictly required. | ||
251 | #[derive(Debug, Clone)] | ||
252 | pub struct NavigationTarget { | ||
253 | file_id: FileId, | ||
254 | name: SmolStr, | ||
255 | kind: SyntaxKind, | ||
256 | range: TextRange, | ||
257 | // Should be DefId ideally | ||
258 | ptr: Option<LocalSyntaxPtr>, | ||
259 | } | ||
260 | |||
261 | impl NavigationTarget { | ||
262 | pub fn name(&self) -> &SmolStr { | ||
263 | &self.name | ||
264 | } | ||
265 | |||
266 | pub fn kind(&self) -> SyntaxKind { | ||
267 | self.kind | ||
268 | } | ||
269 | |||
270 | pub fn file_id(&self) -> FileId { | ||
271 | self.file_id | ||
272 | } | ||
273 | |||
274 | pub fn range(&self) -> TextRange { | ||
275 | self.range | ||
276 | } | ||
277 | } | ||
278 | |||
279 | #[derive(Debug)] | 247 | #[derive(Debug)] |
280 | pub struct RangeInfo<T> { | 248 | pub struct RangeInfo<T> { |
281 | pub range: TextRange, | 249 | pub range: TextRange, |