mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
More symbol usage
This commit is contained in:
parent
c30bdfcc84
commit
df5f1777b8
50 changed files with 388 additions and 303 deletions
|
@ -2,7 +2,7 @@
|
|||
use either::Either;
|
||||
use hir::{
|
||||
db::{DefDatabase, HirDatabase},
|
||||
resolve_doc_path_on, AttrId, AttrSourceMap, AttrsWithOwner, HasAttrs, InFile,
|
||||
resolve_doc_path_on, sym, AttrId, AttrSourceMap, AttrsWithOwner, HasAttrs, InFile,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use syntax::{
|
||||
|
@ -92,7 +92,7 @@ pub fn docs_with_rangemap(
|
|||
attrs: &AttrsWithOwner,
|
||||
) -> Option<(Documentation, DocsRangeMap)> {
|
||||
let docs = attrs
|
||||
.by_key("doc")
|
||||
.by_key(&sym::doc)
|
||||
.attrs()
|
||||
.filter_map(|attr| attr.string_value_unescape().map(|s| (s, attr.id)));
|
||||
let indent = doc_indent(attrs);
|
||||
|
@ -134,7 +134,7 @@ pub fn docs_with_rangemap(
|
|||
}
|
||||
|
||||
pub fn docs_from_attrs(attrs: &hir::Attrs) -> Option<String> {
|
||||
let docs = attrs.by_key("doc").attrs().filter_map(|attr| attr.string_value_unescape());
|
||||
let docs = attrs.by_key(&sym::doc).attrs().filter_map(|attr| attr.string_value_unescape());
|
||||
let indent = doc_indent(attrs);
|
||||
let mut buf = String::new();
|
||||
for doc in docs {
|
||||
|
@ -270,7 +270,7 @@ fn get_doc_string_in_attr(it: &ast::Attr) -> Option<ast::String> {
|
|||
|
||||
fn doc_indent(attrs: &hir::Attrs) -> usize {
|
||||
let mut min = !0;
|
||||
for val in attrs.by_key("doc").attrs().filter_map(|attr| attr.string_value_unescape()) {
|
||||
for val in attrs.by_key(&sym::doc).attrs().filter_map(|attr| attr.string_value_unescape()) {
|
||||
if let Some(m) =
|
||||
val.lines().filter_map(|line| line.chars().position(|c| !c.is_whitespace())).min()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue