mirror of
				https://github.com/rust-lang/rust-analyzer.git
				synced 2025-10-31 03:54:42 +00:00 
			
		
		
		
	Make HirFileId, EditionedFileId and macro files Salsa struct
				
					
				
			And make more queries non-interned. Also flip the default for queries, now the default is to not intern and to intern a query you need to say `invoke_interned`.
This commit is contained in:
		
							parent
							
								
									02ade79631
								
							
						
					
					
						commit
						c58ddafe90
					
				
					 195 changed files with 1473 additions and 1525 deletions
				
			
		|  | @ -15,13 +15,8 @@ mod tests; | |||
| use std::ops::ControlFlow; | ||||
| 
 | ||||
| use either::Either; | ||||
| use hir::{ | ||||
|     DefWithBody, HirFileIdExt, InFile, InRealFile, MacroFileIdExt, MacroKind, Name, Semantics, | ||||
| }; | ||||
| use ide_db::{ | ||||
|     FxHashMap, FxHashSet, Ranker, RootDatabase, SymbolKind, base_db::salsa::AsDynDatabase, | ||||
| }; | ||||
| use span::EditionedFileId; | ||||
| use hir::{DefWithBody, EditionedFileId, InFile, InRealFile, MacroKind, Name, Semantics}; | ||||
| use ide_db::{FxHashMap, FxHashSet, Ranker, RootDatabase, SymbolKind}; | ||||
| use syntax::{ | ||||
|     AstNode, AstToken, NodeOrToken, | ||||
|     SyntaxKind::*, | ||||
|  | @ -201,13 +196,11 @@ pub(crate) fn highlight( | |||
|     let sema = Semantics::new(db); | ||||
|     let file_id = sema | ||||
|         .attach_first_edition(file_id) | ||||
|         .unwrap_or_else(|| EditionedFileId::current_edition(file_id)); | ||||
|         .unwrap_or_else(|| EditionedFileId::current_edition(db, file_id)); | ||||
| 
 | ||||
|     // Determine the root based on the given range.
 | ||||
|     let (root, range_to_highlight) = { | ||||
|         let editioned_file_id_wrapper = | ||||
|             ide_db::base_db::EditionedFileId::new(db.as_dyn_database(), file_id); | ||||
|         let file = sema.parse(editioned_file_id_wrapper); | ||||
|         let file = sema.parse(file_id); | ||||
|         let source_file = file.syntax(); | ||||
|         match range_to_highlight { | ||||
|             Some(range) => { | ||||
|  | @ -235,7 +228,7 @@ fn traverse( | |||
|     krate: Option<hir::Crate>, | ||||
|     range_to_highlight: TextRange, | ||||
| ) { | ||||
|     let is_unlinked = sema.file_to_module_def(file_id).is_none(); | ||||
|     let is_unlinked = sema.file_to_module_def(file_id.file_id(sema.db)).is_none(); | ||||
| 
 | ||||
|     enum AttrOrDerive { | ||||
|         Attr(ast::Item), | ||||
|  | @ -509,7 +502,14 @@ fn string_injections( | |||
|             { | ||||
|                 return ControlFlow::Break(()); | ||||
|             } | ||||
|             highlight_format_string(hl, sema, krate, &string, &descended_string, file_id.edition()); | ||||
|             highlight_format_string( | ||||
|                 hl, | ||||
|                 sema, | ||||
|                 krate, | ||||
|                 &string, | ||||
|                 &descended_string, | ||||
|                 file_id.edition(sema.db), | ||||
|             ); | ||||
| 
 | ||||
|             if !string.is_raw() { | ||||
|                 highlight_escape_string(hl, &string); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Chayim Refael Friedman
						Chayim Refael Friedman