aboutsummaryrefslogtreecommitdiff
path: root/crates/ide
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide')
-rw-r--r--crates/ide/src/diagnostics/fixes.rs2
-rw-r--r--crates/ide/src/doc_links.rs9
-rw-r--r--crates/ide/src/file_structure.rs2
-rw-r--r--crates/ide/src/join_lines.rs2
-rw-r--r--crates/ide/src/lib.rs14
-rw-r--r--crates/ide/src/markdown_remove.rs3
-rw-r--r--crates/ide/src/matching_brace.rs2
-rw-r--r--crates/ide/src/references.rs8
-rw-r--r--crates/ide/src/syntax_highlighting.rs9
9 files changed, 24 insertions, 27 deletions
diff --git a/crates/ide/src/diagnostics/fixes.rs b/crates/ide/src/diagnostics/fixes.rs
index 0c950003e..02e17ba43 100644
--- a/crates/ide/src/diagnostics/fixes.rs
+++ b/crates/ide/src/diagnostics/fixes.rs
@@ -25,7 +25,7 @@ use crate::{diagnostics::Fix, references::rename::rename_with_semantics, FilePos
25/// A [Diagnostic] that potentially has a fix available. 25/// A [Diagnostic] that potentially has a fix available.
26/// 26///
27/// [Diagnostic]: hir::diagnostics::Diagnostic 27/// [Diagnostic]: hir::diagnostics::Diagnostic
28pub trait DiagnosticWithFix: Diagnostic { 28pub(crate) trait DiagnosticWithFix: Diagnostic {
29 fn fix(&self, sema: &Semantics<RootDatabase>) -> Option<Fix>; 29 fn fix(&self, sema: &Semantics<RootDatabase>) -> Option<Fix>;
30} 30}
31 31
diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs
index 250f10f9f..10263537a 100644
--- a/crates/ide/src/doc_links.rs
+++ b/crates/ide/src/doc_links.rs
@@ -1,7 +1,6 @@
1//! Resolves and rewrites links in markdown documentation. 1//! Resolves and rewrites links in markdown documentation.
2 2
3use std::convert::TryFrom; 3use std::{convert::TryFrom, iter::once};
4use std::iter::once;
5 4
6use itertools::Itertools; 5use itertools::Itertools;
7use pulldown_cmark::{BrokenLink, CowStr, Event, InlineStr, LinkType, Options, Parser, Tag}; 6use pulldown_cmark::{BrokenLink, CowStr, Event, InlineStr, LinkType, Options, Parser, Tag};
@@ -21,10 +20,10 @@ use syntax::{ast, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset,
21 20
22use crate::{FilePosition, Semantics}; 21use crate::{FilePosition, Semantics};
23 22
24pub type DocumentationLink = String; 23pub(crate) type DocumentationLink = String;
25 24
26/// Rewrite documentation links in markdown to point to an online host (e.g. docs.rs) 25/// Rewrite documentation links in markdown to point to an online host (e.g. docs.rs)
27pub fn rewrite_links(db: &RootDatabase, markdown: &str, definition: &Definition) -> String { 26pub(crate) fn rewrite_links(db: &RootDatabase, markdown: &str, definition: &Definition) -> String {
28 let mut cb = |link: BrokenLink| { 27 let mut cb = |link: BrokenLink| {
29 Some(( 28 Some((
30 /*url*/ link.reference.to_owned().into(), 29 /*url*/ link.reference.to_owned().into(),
@@ -63,7 +62,7 @@ pub fn rewrite_links(db: &RootDatabase, markdown: &str, definition: &Definition)
63} 62}
64 63
65/// Remove all links in markdown documentation. 64/// Remove all links in markdown documentation.
66pub fn remove_links(markdown: &str) -> String { 65pub(crate) fn remove_links(markdown: &str) -> String {
67 let mut drop_link = false; 66 let mut drop_link = false;
68 67
69 let mut opts = Options::empty(); 68 let mut opts = Options::empty();
diff --git a/crates/ide/src/file_structure.rs b/crates/ide/src/file_structure.rs
index 6168fb837..415795e8c 100644
--- a/crates/ide/src/file_structure.rs
+++ b/crates/ide/src/file_structure.rs
@@ -27,7 +27,7 @@ pub struct StructureNode {
27// 27//
28// | VS Code | kbd:[Ctrl+Shift+O] 28// | VS Code | kbd:[Ctrl+Shift+O]
29// |=== 29// |===
30pub fn file_structure(file: &SourceFile) -> Vec<StructureNode> { 30pub(crate) fn file_structure(file: &SourceFile) -> Vec<StructureNode> {
31 let mut res = Vec::new(); 31 let mut res = Vec::new();
32 let mut stack = Vec::new(); 32 let mut stack = Vec::new();
33 33
diff --git a/crates/ide/src/join_lines.rs b/crates/ide/src/join_lines.rs
index e37702acd..b5a6f66fd 100644
--- a/crates/ide/src/join_lines.rs
+++ b/crates/ide/src/join_lines.rs
@@ -18,7 +18,7 @@ use text_edit::{TextEdit, TextEditBuilder};
18// 18//
19// | VS Code | **Rust Analyzer: Join lines** 19// | VS Code | **Rust Analyzer: Join lines**
20// |=== 20// |===
21pub fn join_lines(file: &SourceFile, range: TextRange) -> TextEdit { 21pub(crate) fn join_lines(file: &SourceFile, range: TextRange) -> TextEdit {
22 let range = if range.is_empty() { 22 let range = if range.is_empty() {
23 let syntax = file.syntax(); 23 let syntax = file.syntax();
24 let text = syntax.text().slice(range.start()..); 24 let text = syntax.text().slice(range.start()..);
diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs
index 4bc733b70..6288f7ea7 100644
--- a/crates/ide/src/lib.rs
+++ b/crates/ide/src/lib.rs
@@ -72,18 +72,20 @@ pub use crate::{
72 inlay_hints::{InlayHint, InlayHintsConfig, InlayKind}, 72 inlay_hints::{InlayHint, InlayHintsConfig, InlayKind},
73 markup::Markup, 73 markup::Markup,
74 prime_caches::PrimeCachesProgress, 74 prime_caches::PrimeCachesProgress,
75 references::{ 75 references::{rename::RenameError, Declaration, ReferenceSearchResult},
76 Declaration, Reference, ReferenceAccess, ReferenceKind, ReferenceSearchResult, RenameError,
77 },
78 runnables::{Runnable, RunnableKind, TestId}, 76 runnables::{Runnable, RunnableKind, TestId},
79 syntax_highlighting::{ 77 syntax_highlighting::{
80 Highlight, HighlightModifier, HighlightModifiers, HighlightTag, HighlightedRange, 78 tags::{Highlight, HighlightModifier, HighlightModifiers, HighlightTag},
79 HighlightedRange,
81 }, 80 },
82}; 81};
83pub use completion::{ 82pub use completion::{
84 CompletionConfig, CompletionItem, CompletionItemKind, CompletionScore, InsertTextFormat, 83 CompletionConfig, CompletionItem, CompletionItemKind, CompletionScore, InsertTextFormat,
85}; 84};
86pub use ide_db::call_info::CallInfo; 85pub use ide_db::{
86 call_info::CallInfo,
87 search::{Reference, ReferenceAccess, ReferenceKind},
88};
87 89
88pub use assists::{ 90pub use assists::{
89 utils::MergeBehaviour, Assist, AssistConfig, AssistId, AssistKind, ResolvedAssist, 91 utils::MergeBehaviour, Assist, AssistConfig, AssistId, AssistKind, ResolvedAssist,
@@ -503,7 +505,7 @@ impl Analysis {
503 position: FilePosition, 505 position: FilePosition,
504 new_name: &str, 506 new_name: &str,
505 ) -> Cancelable<Result<RangeInfo<SourceChange>, RenameError>> { 507 ) -> Cancelable<Result<RangeInfo<SourceChange>, RenameError>> {
506 self.with_db(|db| references::rename(db, position, new_name)) 508 self.with_db(|db| references::rename::rename(db, position, new_name))
507 } 509 }
508 510
509 pub fn structural_search_replace( 511 pub fn structural_search_replace(
diff --git a/crates/ide/src/markdown_remove.rs b/crates/ide/src/markdown_remove.rs
index 02ad39dfb..3ec5c629e 100644
--- a/crates/ide/src/markdown_remove.rs
+++ b/crates/ide/src/markdown_remove.rs
@@ -1,11 +1,10 @@
1//! Removes markdown from strings. 1//! Removes markdown from strings.
2
3use pulldown_cmark::{Event, Parser, Tag}; 2use pulldown_cmark::{Event, Parser, Tag};
4 3
5/// Removes all markdown, keeping the text and code blocks 4/// Removes all markdown, keeping the text and code blocks
6/// 5///
7/// Currently limited in styling, i.e. no ascii tables or lists 6/// Currently limited in styling, i.e. no ascii tables or lists
8pub fn remove_markdown(markdown: &str) -> String { 7pub(crate) fn remove_markdown(markdown: &str) -> String {
9 let mut out = String::new(); 8 let mut out = String::new();
10 let parser = Parser::new(markdown); 9 let parser = Parser::new(markdown);
11 10
diff --git a/crates/ide/src/matching_brace.rs b/crates/ide/src/matching_brace.rs
index cb6abb0db..d70248afe 100644
--- a/crates/ide/src/matching_brace.rs
+++ b/crates/ide/src/matching_brace.rs
@@ -15,7 +15,7 @@ use test_utils::mark;
15// 15//
16// | VS Code | **Rust Analyzer: Find matching brace** 16// | VS Code | **Rust Analyzer: Find matching brace**
17// |=== 17// |===
18pub fn matching_brace(file: &SourceFile, offset: TextSize) -> Option<TextSize> { 18pub(crate) fn matching_brace(file: &SourceFile, offset: TextSize) -> Option<TextSize> {
19 const BRACES: &[SyntaxKind] = 19 const BRACES: &[SyntaxKind] =
20 &[T!['{'], T!['}'], T!['['], T![']'], T!['('], T![')'], T![<], T![>], T![|], T![|]]; 20 &[T!['{'], T!['}'], T!['['], T![']'], T!['('], T![')'], T![<], T![>], T![|], T![|]];
21 let (brace_token, brace_idx) = file 21 let (brace_token, brace_idx) = file
diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs
index a517081d5..e05465b32 100644
--- a/crates/ide/src/references.rs
+++ b/crates/ide/src/references.rs
@@ -14,7 +14,8 @@ pub(crate) mod rename;
14use hir::Semantics; 14use hir::Semantics;
15use ide_db::{ 15use ide_db::{
16 defs::{Definition, NameClass, NameRefClass}, 16 defs::{Definition, NameClass, NameRefClass},
17 search::SearchScope, 17 search::Reference,
18 search::{ReferenceAccess, ReferenceKind, SearchScope},
18 RootDatabase, 19 RootDatabase,
19}; 20};
20use syntax::{ 21use syntax::{
@@ -25,11 +26,6 @@ use syntax::{
25 26
26use crate::{display::TryToNav, FilePosition, FileRange, NavigationTarget, RangeInfo}; 27use crate::{display::TryToNav, FilePosition, FileRange, NavigationTarget, RangeInfo};
27 28
28pub(crate) use self::rename::rename;
29pub use self::rename::RenameError;
30
31pub use ide_db::search::{Reference, ReferenceAccess, ReferenceKind};
32
33#[derive(Debug, Clone)] 29#[derive(Debug, Clone)]
34pub struct ReferenceSearchResult { 30pub struct ReferenceSearchResult {
35 declaration: Declaration, 31 declaration: Declaration,
diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs
index 624a63075..efcc8ecfe 100644
--- a/crates/ide/src/syntax_highlighting.rs
+++ b/crates/ide/src/syntax_highlighting.rs
@@ -2,7 +2,7 @@ mod format;
2mod html; 2mod html;
3mod injection; 3mod injection;
4mod macro_rules; 4mod macro_rules;
5mod tags; 5pub(crate) mod tags;
6#[cfg(test)] 6#[cfg(test)]
7mod tests; 7mod tests;
8 8
@@ -20,12 +20,13 @@ use syntax::{
20}; 20};
21 21
22use crate::{ 22use crate::{
23 syntax_highlighting::{format::FormatStringHighlighter, macro_rules::MacroRulesHighlighter}, 23 syntax_highlighting::{
24 FileId, 24 format::FormatStringHighlighter, macro_rules::MacroRulesHighlighter, tags::Highlight,
25 },
26 FileId, HighlightModifier, HighlightTag,
25}; 27};
26 28
27pub(crate) use html::highlight_as_html; 29pub(crate) use html::highlight_as_html;
28pub use tags::{Highlight, HighlightModifier, HighlightModifiers, HighlightTag};
29 30
30#[derive(Debug, Clone)] 31#[derive(Debug, Clone)]
31pub struct HighlightedRange { 32pub struct HighlightedRange {