mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Format & replace todos with 'fixme'
This commit is contained in:
parent
f9893d370c
commit
10c50b140a
5 changed files with 27 additions and 21 deletions
|
@ -192,11 +192,11 @@ impl ModuleDef {
|
||||||
ModuleDef::Function(m) => Some(m.name(db)),
|
ModuleDef::Function(m) => Some(m.name(db)),
|
||||||
ModuleDef::Adt(m) => Some(m.name(db)),
|
ModuleDef::Adt(m) => Some(m.name(db)),
|
||||||
ModuleDef::EnumVariant(m) => Some(m.name(db)),
|
ModuleDef::EnumVariant(m) => Some(m.name(db)),
|
||||||
ModuleDef::Const(m) => {m.name(db)},
|
ModuleDef::Const(m) => m.name(db),
|
||||||
ModuleDef::Static(m) => {m.name(db)},
|
ModuleDef::Static(m) => m.name(db),
|
||||||
ModuleDef::Trait(m) => {Some(m.name(db))},
|
ModuleDef::Trait(m) => Some(m.name(db)),
|
||||||
ModuleDef::TypeAlias(m) => {Some(m.name(db))},
|
ModuleDef::TypeAlias(m) => Some(m.name(db)),
|
||||||
ModuleDef::BuiltinType(m) => {Some(m.as_name())}
|
ModuleDef::BuiltinType(m) => Some(m.as_name()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,13 +205,17 @@ impl ModuleDef {
|
||||||
ModuleDef::Module(m) => Into::<ModuleId>::into(m.clone()).resolver(db),
|
ModuleDef::Module(m) => Into::<ModuleId>::into(m.clone()).resolver(db),
|
||||||
ModuleDef::Function(f) => Into::<FunctionId>::into(f.clone()).resolver(db),
|
ModuleDef::Function(f) => Into::<FunctionId>::into(f.clone()).resolver(db),
|
||||||
ModuleDef::Adt(adt) => Into::<AdtId>::into(adt.clone()).resolver(db),
|
ModuleDef::Adt(adt) => Into::<AdtId>::into(adt.clone()).resolver(db),
|
||||||
ModuleDef::EnumVariant(ev) => Into::<GenericDefId>::into(Into::<GenericDef>::into(ev.clone())).resolver(db),
|
ModuleDef::EnumVariant(ev) => {
|
||||||
ModuleDef::Const(c) => Into::<GenericDefId>::into(Into::<GenericDef>::into(c.clone())).resolver(db),
|
Into::<GenericDefId>::into(Into::<GenericDef>::into(ev.clone())).resolver(db)
|
||||||
|
}
|
||||||
|
ModuleDef::Const(c) => {
|
||||||
|
Into::<GenericDefId>::into(Into::<GenericDef>::into(c.clone())).resolver(db)
|
||||||
|
}
|
||||||
ModuleDef::Static(s) => Into::<StaticId>::into(s.clone()).resolver(db),
|
ModuleDef::Static(s) => Into::<StaticId>::into(s.clone()).resolver(db),
|
||||||
ModuleDef::Trait(t) => Into::<TraitId>::into(t.clone()).resolver(db),
|
ModuleDef::Trait(t) => Into::<TraitId>::into(t.clone()).resolver(db),
|
||||||
ModuleDef::TypeAlias(t) => Into::<ModuleId>::into(t.module(db)).resolver(db),
|
ModuleDef::TypeAlias(t) => Into::<ModuleId>::into(t.module(db)).resolver(db),
|
||||||
// TODO: This should be a resolver relative to `std`
|
// FIXME: This should be a resolver relative to `std/core`
|
||||||
ModuleDef::BuiltinType(_t) => None?
|
ModuleDef::BuiltinType(_t) => None?,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -540,14 +540,14 @@ fn try_resolve_intra(
|
||||||
|
|
||||||
let resolved = resolver.resolve_module_path_in_items(db, &modpath);
|
let resolved = resolver.resolve_module_path_in_items(db, &modpath);
|
||||||
let (defid, namespace) = match namespace {
|
let (defid, namespace) = match namespace {
|
||||||
// TODO: .or(resolved.macros)
|
// FIXME: .or(resolved.macros)
|
||||||
None => resolved
|
None => resolved
|
||||||
.types
|
.types
|
||||||
.map(|t| (t.0, Namespace::Types))
|
.map(|t| (t.0, Namespace::Types))
|
||||||
.or(resolved.values.map(|t| (t.0, Namespace::Values)))?,
|
.or(resolved.values.map(|t| (t.0, Namespace::Values)))?,
|
||||||
Some(ns @ Namespace::Types) => (resolved.types?.0, ns),
|
Some(ns @ Namespace::Types) => (resolved.types?.0, ns),
|
||||||
Some(ns @ Namespace::Values) => (resolved.values?.0, ns),
|
Some(ns @ Namespace::Values) => (resolved.values?.0, ns),
|
||||||
// TODO:
|
// FIXME:
|
||||||
Some(Namespace::Macros) => None?,
|
Some(Namespace::Macros) => None?,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -558,7 +558,7 @@ fn try_resolve_intra(
|
||||||
let ns = match namespace {
|
let ns = match namespace {
|
||||||
Namespace::Types => ItemInNs::Types(defid),
|
Namespace::Types => ItemInNs::Types(defid),
|
||||||
Namespace::Values => ItemInNs::Values(defid),
|
Namespace::Values => ItemInNs::Values(defid),
|
||||||
// TODO:
|
// FIXME:
|
||||||
Namespace::Macros => None?,
|
Namespace::Macros => None?,
|
||||||
};
|
};
|
||||||
let import_map = db.import_map(krate.into());
|
let import_map = db.import_map(krate.into());
|
||||||
|
@ -603,7 +603,7 @@ fn try_resolve_path(db: &RootDatabase, definition: &Definition, link: &str) -> O
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Try to get the root URL of the documentation of a crate.
|
/// Try to get the root URL of the documentation of a crate.
|
||||||
// TODO: Special case standard, core, alloc libraries
|
// FIXME: Special case standard, core, alloc libraries
|
||||||
fn get_doc_url(db: &RootDatabase, krate: &Crate) -> Option<Url> {
|
fn get_doc_url(db: &RootDatabase, krate: &Crate) -> Option<Url> {
|
||||||
// Look for #![doc(html_root_url = "...")]
|
// Look for #![doc(html_root_url = "...")]
|
||||||
let attrs = db.attrs(AttrDef::from(krate.root_module(db)?).into());
|
let attrs = db.attrs(AttrDef::from(krate.root_module(db)?).into());
|
||||||
|
@ -621,7 +621,7 @@ fn get_doc_url(db: &RootDatabase, krate: &Crate) -> Option<Url> {
|
||||||
}).next()
|
}).next()
|
||||||
} else {
|
} else {
|
||||||
// Fallback to docs.rs
|
// Fallback to docs.rs
|
||||||
// TODO: Specify an exact version here (from Cargo.lock)
|
// FIXME: Specify an exact version here (from Cargo.lock)
|
||||||
Some(format!("https://docs.rs/{}/*", krate.display_name(db)?))
|
Some(format!("https://docs.rs/{}/*", krate.display_name(db)?))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -648,7 +648,6 @@ fn get_symbol_filename(db: &RootDatabase, definition: &Definition) -> Option<Str
|
||||||
format!("enum.{}.html#variant.{}", ev.parent_enum(db).name(db), ev.name(db))
|
format!("enum.{}.html#variant.{}", ev.parent_enum(db).name(db), ev.name(db))
|
||||||
}
|
}
|
||||||
ModuleDef::Const(c) => format!("const.{}.html", c.name(db)?),
|
ModuleDef::Const(c) => format!("const.{}.html", c.name(db)?),
|
||||||
// TODO: Check this is the right prefix
|
|
||||||
ModuleDef::Static(s) => format!("static.{}.html", s.name(db)?),
|
ModuleDef::Static(s) => format!("static.{}.html", s.name(db)?),
|
||||||
},
|
},
|
||||||
Definition::Macro(m) => format!("macro.{}.html", m.name(db)?),
|
Definition::Macro(m) => format!("macro.{}.html", m.name(db)?),
|
||||||
|
|
|
@ -6,8 +6,9 @@
|
||||||
// FIXME: this badly needs rename/rewrite (matklad, 2020-02-06).
|
// FIXME: this badly needs rename/rewrite (matklad, 2020-02-06).
|
||||||
|
|
||||||
use hir::{
|
use hir::{
|
||||||
|
db::{DefDatabase, HirDatabase},
|
||||||
Field, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, Name, PathResolution,
|
Field, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, Name, PathResolution,
|
||||||
Semantics, TypeParam, Visibility, db::{DefDatabase, HirDatabase},
|
Semantics, TypeParam, Visibility,
|
||||||
};
|
};
|
||||||
use ra_prof::profile;
|
use ra_prof::profile;
|
||||||
use ra_syntax::{
|
use ra_syntax::{
|
||||||
|
@ -16,7 +17,7 @@ use ra_syntax::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::RootDatabase;
|
use crate::RootDatabase;
|
||||||
use ra_hir_def::resolver::{Resolver, HasResolver};
|
use ra_hir_def::resolver::{HasResolver, Resolver};
|
||||||
|
|
||||||
// FIXME: a more precise name would probably be `Symbol`?
|
// FIXME: a more precise name would probably be `Symbol`?
|
||||||
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
|
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
|
||||||
|
@ -83,12 +84,14 @@ impl Definition {
|
||||||
use ra_hir_def::*;
|
use ra_hir_def::*;
|
||||||
Some(match self {
|
Some(match self {
|
||||||
Definition::ModuleDef(def) => def.resolver(db)?,
|
Definition::ModuleDef(def) => def.resolver(db)?,
|
||||||
Definition::Field(field) => Into::<VariantId>::into(Into::<VariantDef>::into(field.parent_def(db))).resolver(db),
|
Definition::Field(field) => {
|
||||||
|
Into::<VariantId>::into(Into::<VariantDef>::into(field.parent_def(db))).resolver(db)
|
||||||
|
}
|
||||||
Definition::Macro(m) => Into::<ModuleId>::into(m.module(db)?).resolver(db),
|
Definition::Macro(m) => Into::<ModuleId>::into(m.module(db)?).resolver(db),
|
||||||
Definition::SelfType(imp) => Into::<ImplId>::into(imp.clone()).resolver(db),
|
Definition::SelfType(imp) => Into::<ImplId>::into(imp.clone()).resolver(db),
|
||||||
// it's possible, read probable, that other arms of this are also unreachable
|
// it's possible, read probable, that other arms of this are also unreachable
|
||||||
Definition::Local(_local) => unreachable!(),
|
Definition::Local(_local) => unreachable!(),
|
||||||
Definition::TypeParam(tp) => Into::<ModuleId>::into(tp.module(db)).resolver(db)
|
Definition::TypeParam(tp) => Into::<ModuleId>::into(tp.module(db)).resolver(db),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ use crate::syntax_node::GreenNode;
|
||||||
pub use crate::{
|
pub use crate::{
|
||||||
algo::InsertPosition,
|
algo::InsertPosition,
|
||||||
ast::{AstNode, AstToken},
|
ast::{AstNode, AstToken},
|
||||||
parsing::{lex_single_syntax_kind, lex_single_valid_syntax_kind, tokenize, Token, parse_text},
|
parsing::{lex_single_syntax_kind, lex_single_valid_syntax_kind, parse_text, tokenize, Token},
|
||||||
ptr::{AstPtr, SyntaxNodePtr},
|
ptr::{AstPtr, SyntaxNodePtr},
|
||||||
syntax_error::SyntaxError,
|
syntax_error::SyntaxError,
|
||||||
syntax_node::{
|
syntax_node::{
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
io::Write as _,
|
io::Write as _,
|
||||||
process::{self, Stdio}
|
process::{self, Stdio},
|
||||||
};
|
};
|
||||||
|
|
||||||
use lsp_server::ErrorCode;
|
use lsp_server::ErrorCode;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue