diff options
author | Aleksey Kladov <[email protected]> | 2020-12-09 16:01:15 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-12-09 16:07:05 +0000 |
commit | 6e24321e4579d25686982002ed18f321db23cb9f (patch) | |
tree | 08f0fd7d99ad22a3d1db782482b66548e99ba8b2 /crates/ide_db | |
parent | 5e3891c2559de5a6540d69bc14ded281484479f9 (diff) |
Introduce anchored_path
They allow to represent paths like `#[path = "C:\path.rs"] mod foo;`
in a lossless cross-platform & network-transparent way.
Diffstat (limited to 'crates/ide_db')
-rw-r--r-- | crates/ide_db/src/lib.rs | 8 | ||||
-rw-r--r-- | crates/ide_db/src/source_change.rs | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/crates/ide_db/src/lib.rs b/crates/ide_db/src/lib.rs index fceaa089a..118c090d7 100644 --- a/crates/ide_db/src/lib.rs +++ b/crates/ide_db/src/lib.rs | |||
@@ -19,8 +19,8 @@ use std::{fmt, sync::Arc}; | |||
19 | 19 | ||
20 | use base_db::{ | 20 | use base_db::{ |
21 | salsa::{self, Durability}, | 21 | salsa::{self, Durability}, |
22 | Canceled, CheckCanceled, CrateId, FileId, FileLoader, FileLoaderDelegate, SourceDatabase, | 22 | AnchoredPath, Canceled, CheckCanceled, CrateId, FileId, FileLoader, FileLoaderDelegate, |
23 | Upcast, | 23 | SourceDatabase, Upcast, |
24 | }; | 24 | }; |
25 | use hir::db::{AstDatabase, DefDatabase, HirDatabase}; | 25 | use hir::db::{AstDatabase, DefDatabase, HirDatabase}; |
26 | use rustc_hash::FxHashSet; | 26 | use rustc_hash::FxHashSet; |
@@ -72,8 +72,8 @@ impl FileLoader for RootDatabase { | |||
72 | fn file_text(&self, file_id: FileId) -> Arc<String> { | 72 | fn file_text(&self, file_id: FileId) -> Arc<String> { |
73 | FileLoaderDelegate(self).file_text(file_id) | 73 | FileLoaderDelegate(self).file_text(file_id) |
74 | } | 74 | } |
75 | fn resolve_path(&self, anchor: FileId, path: &str) -> Option<FileId> { | 75 | fn resolve_path(&self, path: AnchoredPath) -> Option<FileId> { |
76 | FileLoaderDelegate(self).resolve_path(anchor, path) | 76 | FileLoaderDelegate(self).resolve_path(path) |
77 | } | 77 | } |
78 | fn relevant_crates(&self, file_id: FileId) -> Arc<FxHashSet<CrateId>> { | 78 | fn relevant_crates(&self, file_id: FileId) -> Arc<FxHashSet<CrateId>> { |
79 | FileLoaderDelegate(self).relevant_crates(file_id) | 79 | FileLoaderDelegate(self).relevant_crates(file_id) |
diff --git a/crates/ide_db/src/source_change.rs b/crates/ide_db/src/source_change.rs index f1590ec66..e87d98dad 100644 --- a/crates/ide_db/src/source_change.rs +++ b/crates/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 base_db::FileId; | 6 | use base_db::{AnchoredPathBuf, FileId}; |
7 | use text_edit::TextEdit; | 7 | use text_edit::TextEdit; |
8 | 8 | ||
9 | #[derive(Default, Debug, Clone)] | 9 | #[derive(Default, 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 { anchor: FileId, dst: String }, | 47 | CreateFile { dst: AnchoredPathBuf }, |
48 | MoveFile { src: FileId, anchor: FileId, dst: String }, | 48 | MoveFile { src: FileId, dst: AnchoredPathBuf }, |
49 | } | 49 | } |
50 | 50 | ||
51 | impl From<FileSystemEdit> for SourceChange { | 51 | impl From<FileSystemEdit> for SourceChange { |