diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-10-31 18:05:12 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-10-31 18:05:12 +0000 |
commit | 1dc5608d0bb6bf2eee5a1b9190fcb2f8cdfa2ef3 (patch) | |
tree | b3c8a97880c625a81a814f4afa4e461ce5a58b82 /crates/ra_analysis/src/syntax_ptr.rs | |
parent | e60ef6260f49b2b0438f8649ca71034fbafef631 (diff) | |
parent | c09e14a4ff02f774460a70472e1aeb3c598e01dc (diff) |
Merge #176
176: Move completio to ra_analysis r=matklad a=matklad
While we should handle completion for isolated file, it's better
achieved by using empty Analysis, rather than working only with &File:
we need memoization for type inference even inside a single file.
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_analysis/src/syntax_ptr.rs')
-rw-r--r-- | crates/ra_analysis/src/syntax_ptr.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/crates/ra_analysis/src/syntax_ptr.rs b/crates/ra_analysis/src/syntax_ptr.rs index 6dc89cb43..c3c904633 100644 --- a/crates/ra_analysis/src/syntax_ptr.rs +++ b/crates/ra_analysis/src/syntax_ptr.rs | |||
@@ -12,6 +12,7 @@ salsa::query_group! { | |||
12 | pub(crate) trait SyntaxPtrDatabase: SyntaxDatabase { | 12 | pub(crate) trait SyntaxPtrDatabase: SyntaxDatabase { |
13 | fn resolve_syntax_ptr(ptr: SyntaxPtr) -> SyntaxNode { | 13 | fn resolve_syntax_ptr(ptr: SyntaxPtr) -> SyntaxNode { |
14 | type ResolveSyntaxPtrQuery; | 14 | type ResolveSyntaxPtrQuery; |
15 | // Don't retain syntax trees in memory | ||
15 | storage volatile; | 16 | storage volatile; |
16 | } | 17 | } |
17 | } | 18 | } |
@@ -83,6 +84,10 @@ impl LocalSyntaxPtr { | |||
83 | .unwrap_or_else(|| panic!("can't resolve local ptr to SyntaxNode: {:?}", self)) | 84 | .unwrap_or_else(|| panic!("can't resolve local ptr to SyntaxNode: {:?}", self)) |
84 | } | 85 | } |
85 | } | 86 | } |
87 | |||
88 | pub(crate) fn into_global(self, file_id: FileId) -> SyntaxPtr { | ||
89 | SyntaxPtr { file_id, local: self} | ||
90 | } | ||
86 | } | 91 | } |
87 | 92 | ||
88 | 93 | ||