mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-01 20:31:59 +00:00
Use stable AST IDs
Instead of simple numbering, we hash important bits, like the name of the item. This will allow for much better incrementality, e.g. when you add an item. Currently, this invalidates the IDs of all following items, which invalidates pretty much everything.
This commit is contained in:
parent
5b2c8bc9ae
commit
4bcf03e28b
22 changed files with 1220 additions and 546 deletions
|
|
@ -26,7 +26,7 @@ pub(crate) fn run() -> io::Result<()> {
|
|||
let write_response = |msg: msg::Response| msg.write(write_json, &mut io::stdout().lock());
|
||||
|
||||
let env = EnvSnapshot::default();
|
||||
let srv = proc_macro_srv::ProcMacroSrv::new(&env);
|
||||
let mut srv = proc_macro_srv::ProcMacroSrv::new(&env);
|
||||
|
||||
let mut span_mode = SpanMode::Id;
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ pub(crate) fn run() -> io::Result<()> {
|
|||
})
|
||||
.map_err(msg::PanicMessage)
|
||||
}),
|
||||
SpanMode::RustAnalyzer => msg::Response::ExpandMacroExtended({
|
||||
SpanMode::RustAnalyzer { .. } => msg::Response::ExpandMacroExtended({
|
||||
let mut span_data_table = deserialize_span_data_index_map(&span_data_table);
|
||||
|
||||
let def_site = span_data_table[def_site];
|
||||
|
|
@ -122,6 +122,9 @@ pub(crate) fn run() -> io::Result<()> {
|
|||
msg::Request::ApiVersionCheck {} => msg::Response::ApiVersionCheck(CURRENT_API_VERSION),
|
||||
msg::Request::SetConfig(config) => {
|
||||
span_mode = config.span_mode;
|
||||
if let SpanMode::RustAnalyzer { fixup_ast_id } = span_mode {
|
||||
srv.set_fixup_ast_id(fixup_ast_id);
|
||||
}
|
||||
msg::Response::SetConfig(config)
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue