mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
⬆️ rust-analyzer
This commit is contained in:
parent
a1f1b95d00
commit
9d2cb42a41
45 changed files with 766 additions and 242 deletions
|
@ -5,7 +5,8 @@ use std::mem;
|
|||
use either::Either;
|
||||
use hir::{InFile, Semantics};
|
||||
use ide_db::{
|
||||
active_parameter::ActiveParameter, defs::Definition, rust_doc::is_rust_fence, SymbolKind,
|
||||
active_parameter::ActiveParameter, base_db::FileId, defs::Definition, rust_doc::is_rust_fence,
|
||||
SymbolKind,
|
||||
};
|
||||
use syntax::{
|
||||
ast::{self, AstNode, IsString, QuoteOffsets},
|
||||
|
@ -81,16 +82,18 @@ pub(super) fn ra_fixture(
|
|||
const RUSTDOC_FENCE_LENGTH: usize = 3;
|
||||
const RUSTDOC_FENCES: [&str; 2] = ["```", "~~~"];
|
||||
|
||||
/// Injection of syntax highlighting of doctests.
|
||||
/// Injection of syntax highlighting of doctests and intra doc links.
|
||||
pub(super) fn doc_comment(
|
||||
hl: &mut Highlights,
|
||||
sema: &Semantics<'_, RootDatabase>,
|
||||
InFile { file_id: src_file_id, value: node }: InFile<&SyntaxNode>,
|
||||
src_file_id: FileId,
|
||||
node: &SyntaxNode,
|
||||
) {
|
||||
let (attributes, def) = match doc_attributes(sema, node) {
|
||||
Some(it) => it,
|
||||
None => return,
|
||||
};
|
||||
let src_file_id = src_file_id.into();
|
||||
|
||||
// Extract intra-doc links and emit highlights for them.
|
||||
if let Some((docs, doc_mapping)) = attributes.docs_with_rangemap(sema.db) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue