Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/syntax_highlighting/inject.rs')
-rw-r--r--crates/ide/src/syntax_highlighting/inject.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/crates/ide/src/syntax_highlighting/inject.rs b/crates/ide/src/syntax_highlighting/inject.rs
index f9b8a22a3c..bc1ec53007 100644
--- a/crates/ide/src/syntax_highlighting/inject.rs
+++ b/crates/ide/src/syntax_highlighting/inject.rs
@@ -3,11 +3,12 @@
use std::mem;
use either::Either;
-use hir::{InFile, Semantics};
+use hir::{sym, HirFileId, InFile, Semantics};
use ide_db::{
- active_parameter::ActiveParameter, base_db::FileId, defs::Definition,
- documentation::docs_with_rangemap, rust_doc::is_rust_fence, SymbolKind,
+ active_parameter::ActiveParameter, defs::Definition, documentation::docs_with_rangemap,
+ rust_doc::is_rust_fence, SymbolKind,
};
+use span::EditionedFileId;
use syntax::{
ast::{self, AstNode, IsString, QuoteOffsets},
AstToken, NodeOrToken, SyntaxNode, TextRange, TextSize,
@@ -108,14 +109,14 @@ pub(super) fn doc_comment(
hl: &mut Highlights,
sema: &Semantics<'_, RootDatabase>,
config: HighlightConfig,
- src_file_id: FileId,
+ src_file_id: EditionedFileId,
node: &SyntaxNode,
) {
let (attributes, def) = match doc_attributes(sema, node) {
Some(it) => it,
None => return,
};
- let src_file_id = src_file_id.into();
+ let src_file_id: HirFileId = src_file_id.into();
// Extract intra-doc links and emit highlights for them.
if let Some((docs, doc_mapping)) = docs_with_rangemap(sema.db, &attributes) {
@@ -153,7 +154,7 @@ pub(super) fn doc_comment(
let mut new_comments = Vec::new();
let mut string;
- for attr in attributes.by_key("doc").attrs() {
+ for attr in attributes.by_key(&sym::doc).attrs() {
let InFile { file_id, value: src } = attrs_source_map.source_of(attr);
if file_id != src_file_id {
continue;
@@ -271,7 +272,7 @@ fn find_doc_string_in_attr(attr: &hir::Attr, it: &ast::Attr) -> Option<ast::Stri
// #[cfg_attr(..., doc = "", ...)]
None => {
// We gotta hunt the string token manually here
- let text = attr.string_value()?;
+ let text = attr.string_value()?.as_str();
// FIXME: We just pick the first string literal that has the same text as the doc attribute
// This means technically we might highlight the wrong one
it.syntax()