@@ -13,6 +13,13 @@ use crate::{ProcMacroKind, codec::Codec};
1313/// Represents requests sent from the client to the proc-macro-srv.
1414#[ derive( Debug , Serialize , Deserialize ) ]
1515pub enum Request {
16+ // IMPORTANT: Keep his first, otherwise postcard will break as its not a self describing format
17+ // As such, this is the only request that needs to be supported across all protocol versions
18+ // and by keeping it first, we ensure it always has the same discriminant encoding in postcard
19+ /// Performs an API version check between the client and the server.
20+ /// Since [`VERSION_CHECK_VERSION`]
21+ ApiVersionCheck { } ,
22+
1623 /// Retrieves a list of macros from a given dynamic library.
1724 /// Since [`NO_VERSION_CHECK_VERSION`]
1825 ListMacros { dylib_path : Utf8PathBuf } ,
@@ -21,10 +28,6 @@ pub enum Request {
2128 /// Since [`NO_VERSION_CHECK_VERSION`]
2229 ExpandMacro ( Box < ExpandMacro > ) ,
2330
24- /// Performs an API version check between the client and the server.
25- /// Since [`VERSION_CHECK_VERSION`]
26- ApiVersionCheck { } ,
27-
2831 /// Sets server-specific configurations.
2932 /// Since [`RUST_ANALYZER_SPAN_SUPPORT`]
3033 SetConfig ( ServerConfig ) ,
@@ -44,6 +47,13 @@ pub enum SpanMode {
4447/// Represents responses sent from the proc-macro-srv to the client.
4548#[ derive( Debug , Serialize , Deserialize ) ]
4649pub enum Response {
50+ // IMPORTANT: Keep his first, otherwise postcard will break as its not a self describing format
51+ // As such, this is the only request that needs to be supported across all protocol versions
52+ // and by keeping it first, we ensure it always has the same discriminant encoding in postcard
53+ /// Returns the API version supported by the server.
54+ /// Since [`NO_VERSION_CHECK_VERSION`]
55+ ApiVersionCheck ( u32 ) ,
56+
4757 /// Returns a list of available macros in a dynamic library.
4858 /// Since [`NO_VERSION_CHECK_VERSION`]
4959 ListMacros ( Result < Vec < ( String , ProcMacroKind ) > , String > ) ,
@@ -52,10 +62,6 @@ pub enum Response {
5262 /// Since [`NO_VERSION_CHECK_VERSION`]
5363 ExpandMacro ( Result < FlatTree , PanicMessage > ) ,
5464
55- /// Returns the API version supported by the server.
56- /// Since [`NO_VERSION_CHECK_VERSION`]
57- ApiVersionCheck ( u32 ) ,
58-
5965 /// Confirms the application of a configuration update.
6066 /// Since [`RUST_ANALYZER_SPAN_SUPPORT`]
6167 SetConfig ( ServerConfig ) ,
0 commit comments