diff options
author | Aleksey Kladov <[email protected]> | 2020-06-16 17:45:58 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-06-16 17:45:58 +0100 |
commit | 3c72fc05738b8a08dbf90dab18a15b9894d9e2a1 (patch) | |
tree | 18501e20ac9848d31019c572170aee9259f1d0ea /crates/ra_ide_db | |
parent | da34d630b878f14e85be02b8ffdb702edf736539 (diff) |
Anchor file-system operations to the file, and not to the source root.
Anchoring to the SourceRoot wont' work if the path is absolute:
#[path = "/tmp/foo.rs"]
mod foo;
Anchoring to a file will.
However, we *should* anchor, instead of just producing an abs path.
I can imagine a situation where, for example, rust-analyzer processes
crates from different machines (or, for example, from in-memory git
branch), where the same absolute path in different crates might refer
to different files in the end!
Diffstat (limited to 'crates/ra_ide_db')
-rw-r--r-- | crates/ra_ide_db/src/source_change.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_ide_db/src/source_change.rs b/crates/ra_ide_db/src/source_change.rs index f40ae8304..0bbd3c3e5 100644 --- a/crates/ra_ide_db/src/source_change.rs +++ b/crates/ra_ide_db/src/source_change.rs | |||
@@ -3,7 +3,7 @@ | |||
3 | //! | 3 | //! |
4 | //! It can be viewed as a dual for `AnalysisChange`. | 4 | //! It can be viewed as a dual for `AnalysisChange`. |
5 | 5 | ||
6 | use ra_db::{FileId, RelativePathBuf, SourceRootId}; | 6 | use ra_db::FileId; |
7 | use ra_text_edit::TextEdit; | 7 | use ra_text_edit::TextEdit; |
8 | 8 | ||
9 | #[derive(Debug, Clone)] | 9 | #[derive(Debug, Clone)] |
@@ -44,8 +44,8 @@ impl From<Vec<SourceFileEdit>> for SourceChange { | |||
44 | 44 | ||
45 | #[derive(Debug, Clone)] | 45 | #[derive(Debug, Clone)] |
46 | pub enum FileSystemEdit { | 46 | pub enum FileSystemEdit { |
47 | CreateFile { source_root: SourceRootId, path: RelativePathBuf }, | 47 | CreateFile { anchor: FileId, dst: String }, |
48 | MoveFile { src: FileId, dst_source_root: SourceRootId, dst_path: RelativePathBuf }, | 48 | MoveFile { src: FileId, anchor: FileId, dst: String }, |
49 | } | 49 | } |
50 | 50 | ||
51 | impl From<FileSystemEdit> for SourceChange { | 51 | impl From<FileSystemEdit> for SourceChange { |