Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/proc-macro-api/src/legacy_protocol/msg.rs')
-rw-r--r--crates/proc-macro-api/src/legacy_protocol/msg.rs25
1 files changed, 5 insertions, 20 deletions
diff --git a/crates/proc-macro-api/src/legacy_protocol/msg.rs b/crates/proc-macro-api/src/legacy_protocol/msg.rs
index 165936269d..b795c45589 100644
--- a/crates/proc-macro-api/src/legacy_protocol/msg.rs
+++ b/crates/proc-macro-api/src/legacy_protocol/msg.rs
@@ -1,5 +1,6 @@
//! Defines messages for cross-process message passing based on `ndjson` wire protocol
pub(crate) mod flat;
+pub use self::flat::*;
use std::io::{self, BufRead, Write};
@@ -9,24 +10,6 @@ use serde_derive::{Deserialize, Serialize};
use crate::ProcMacroKind;
-pub use self::flat::{
- FlatTree, SpanDataIndexMap, deserialize_span_data_index_map, serialize_span_data_index_map,
-};
-pub use span::TokenId;
-
-// The versions of the server protocol
-pub const NO_VERSION_CHECK_VERSION: u32 = 0;
-pub const VERSION_CHECK_VERSION: u32 = 1;
-pub const ENCODE_CLOSE_SPAN_VERSION: u32 = 2;
-pub const HAS_GLOBAL_SPANS: u32 = 3;
-pub const RUST_ANALYZER_SPAN_SUPPORT: u32 = 4;
-/// Whether literals encode their kind as an additional u32 field and idents their rawness as a u32 field.
-pub const EXTENDED_LEAF_DATA: u32 = 5;
-pub const HASHED_AST_ID: u32 = 6;
-
-/// Current API version of the proc-macro protocol.
-pub const CURRENT_API_VERSION: u32 = HASHED_AST_ID;
-
/// Represents requests sent from the client to the proc-macro-srv.
#[derive(Debug, Serialize, Deserialize)]
pub enum Request {
@@ -48,7 +31,7 @@ pub enum Request {
}
/// Defines the mode used for handling span data.
-#[derive(Copy, Clone, Default, Debug, Serialize, Deserialize)]
+#[derive(Copy, Clone, Default, Debug, Serialize, Deserialize, PartialEq, Eq)]
pub enum SpanMode {
/// Default mode, where spans are identified by an ID.
#[default]
@@ -210,6 +193,8 @@ mod tests {
TopSubtreeBuilder,
};
+ use crate::version;
+
use super::*;
fn fixture_token_tree() -> TopSubtree<Span> {
@@ -308,7 +293,7 @@ mod tests {
#[test]
fn test_proc_macro_rpc_works() {
let tt = fixture_token_tree();
- for v in RUST_ANALYZER_SPAN_SUPPORT..=CURRENT_API_VERSION {
+ for v in version::RUST_ANALYZER_SPAN_SUPPORT..=version::CURRENT_API_VERSION {
let mut span_data_table = Default::default();
let task = ExpandMacro {
data: ExpandMacroData {