use root-relative paths

This commit is contained in:
Aleksey Kladov 2018-12-21 12:30:28 +03:00
parent b5b44659a4
commit fd927ea3a9
2 changed files with 3 additions and 7 deletions

View file

@ -81,7 +81,7 @@ fn test_unresolved_module_diagnostic() {
fix: Some(SourceChange {
label: "create module",
source_file_edits: [],
file_system_edits: [CreateFile { anchor: FileId(1), path: "../foo.rs" }],
file_system_edits: [CreateFile { source_root: SourceRootId(0), path: "foo.rs" }],
cursor_position: None }) }]"#,
&diagnostics,
);

View file

@ -4,7 +4,7 @@ use ra_syntax::{
ast::{self, NameOwner},
SmolStr,
};
use relative_path::{RelativePathBuf, RelativePath};
use relative_path::RelativePathBuf;
use rustc_hash::{FxHashMap, FxHashSet};
use arrayvec::ArrayVec;
use ra_db::{SourceRoot, SourceRootId, Cancelable, FileId};
@ -184,11 +184,7 @@ fn resolve_submodule(
.collect::<Vec<_>>();
let problem = if points_to.is_empty() {
Some(Problem::UnresolvedModule {
candidate: RelativePath::new("../").join(&if is_dir_owner {
file_mod
} else {
file_dir_mod
}),
candidate: if is_dir_owner { file_mod } else { file_dir_mod },
})
} else {
None