5015: Account for updated module ids when determining whether a resolution is changed r=matklad a=Nashenas88 Fixes #4943 5027: Make Debug less verbose for VfsPath and use Display in analysis-stats r=matklad a=lnicola 5028: Remove namedExports config r=matklad a=lnicola Fixes a warning: ``` (!) Plugin commonjs: The namedExports option from "@rollup/plugin-commonjs" is deprecated. Named exports are now handled automatically. ``` Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com> Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
This commit is contained in:
commit
97c4d06258
@ -5,6 +5,7 @@ use hir_expand::name::Name;
|
||||
use once_cell::sync::Lazy;
|
||||
use ra_db::CrateId;
|
||||
use rustc_hash::FxHashMap;
|
||||
use test_utils::mark;
|
||||
|
||||
use crate::{
|
||||
db::DefDatabase, per_ns::PerNs, visibility::Visibility, AdtId, BuiltinType, HasModule, ImplId,
|
||||
@ -126,19 +127,27 @@ impl ItemScope {
|
||||
let mut changed = false;
|
||||
let existing = self.visible.entry(name).or_default();
|
||||
|
||||
if existing.types.is_none() && def.types.is_some() {
|
||||
existing.types = def.types;
|
||||
changed = true;
|
||||
}
|
||||
if existing.values.is_none() && def.values.is_some() {
|
||||
existing.values = def.values;
|
||||
changed = true;
|
||||
}
|
||||
if existing.macros.is_none() && def.macros.is_some() {
|
||||
existing.macros = def.macros;
|
||||
changed = true;
|
||||
macro_rules! check_changed {
|
||||
($changed:ident, $existing:expr, $def:expr) => {
|
||||
match ($existing, $def) {
|
||||
(None, Some(_)) => {
|
||||
$existing = $def;
|
||||
$changed = true;
|
||||
}
|
||||
(Some(e), Some(d)) if e.0 != d.0 => {
|
||||
mark::hit!(import_shadowed);
|
||||
$existing = $def;
|
||||
$changed = true;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
check_changed!(changed, existing.types, def.types);
|
||||
check_changed!(changed, existing.values, def.values);
|
||||
check_changed!(changed, existing.macros, def.macros);
|
||||
|
||||
changed
|
||||
}
|
||||
|
||||
|
@ -229,3 +229,50 @@ fn glob_enum_group() {
|
||||
"###
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn glob_shadowed_def() {
|
||||
mark::check!(import_shadowed);
|
||||
let map = def_map(
|
||||
r###"
|
||||
//- /lib.rs
|
||||
mod foo;
|
||||
mod bar;
|
||||
|
||||
use foo::*;
|
||||
use bar::baz;
|
||||
|
||||
use baz::Bar;
|
||||
|
||||
//- /foo.rs
|
||||
pub mod baz {
|
||||
pub struct Foo;
|
||||
}
|
||||
|
||||
//- /bar.rs
|
||||
pub mod baz {
|
||||
pub struct Bar;
|
||||
}
|
||||
"###,
|
||||
);
|
||||
assert_snapshot!(map, @r###"
|
||||
⋮crate
|
||||
⋮Bar: t v
|
||||
⋮bar: t
|
||||
⋮baz: t
|
||||
⋮foo: t
|
||||
⋮
|
||||
⋮crate::bar
|
||||
⋮baz: t
|
||||
⋮
|
||||
⋮crate::bar::baz
|
||||
⋮Bar: t v
|
||||
⋮
|
||||
⋮crate::foo
|
||||
⋮baz: t
|
||||
⋮
|
||||
⋮crate::foo::baz
|
||||
⋮Foo: t v
|
||||
"###
|
||||
);
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ pub fn analysis_stats(
|
||||
let original_file = src.file_id.original_file(db);
|
||||
let path = vfs.file_path(original_file);
|
||||
let syntax_range = src.value.syntax().text_range();
|
||||
format_to!(msg, " ({:?} {:?})", path, syntax_range);
|
||||
format_to!(msg, " ({} {:?})", path, syntax_range);
|
||||
}
|
||||
if verbosity.is_spammy() {
|
||||
bar.println(msg.to_string());
|
||||
|
@ -5,7 +5,7 @@ use paths::{AbsPath, AbsPathBuf};
|
||||
|
||||
/// Long-term, we want to support files which do not reside in the file-system,
|
||||
/// so we treat VfsPaths as opaque identifiers.
|
||||
#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
|
||||
#[derive(Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
|
||||
pub struct VfsPath(VfsPathRepr);
|
||||
|
||||
impl VfsPath {
|
||||
@ -50,7 +50,7 @@ impl VfsPath {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
|
||||
#[derive(Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
|
||||
enum VfsPathRepr {
|
||||
PathBuf(AbsPathBuf),
|
||||
VirtualPath(VirtualPath),
|
||||
@ -71,6 +71,21 @@ impl fmt::Display for VfsPath {
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for VfsPath {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt::Debug::fmt(&self.0, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for VfsPathRepr {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match &self {
|
||||
VfsPathRepr::PathBuf(it) => fmt::Debug::fmt(&it.display(), f),
|
||||
VfsPathRepr::VirtualPath(VirtualPath(it)) => fmt::Debug::fmt(&it, f),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
|
||||
struct VirtualPath(String);
|
||||
|
||||
|
@ -11,12 +11,7 @@ export default {
|
||||
resolve({
|
||||
preferBuiltins: true
|
||||
}),
|
||||
commonjs({
|
||||
namedExports: {
|
||||
// squelch missing import warnings
|
||||
'vscode-languageclient': ['CreateFile', 'RenameFile', 'ErrorCodes', 'WorkDoneProgress', 'WorkDoneProgressBegin', 'WorkDoneProgressReport', 'WorkDoneProgressEnd']
|
||||
}
|
||||
})
|
||||
commonjs()
|
||||
],
|
||||
external: [...nodeBuiltins, 'vscode'],
|
||||
output: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user