lsp_json 0.1.1

Defines a LSP implementation in Rust, including serialization with serde_json.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
#[cfg(test)]
mod tests {
}


use std::{collections::HashMap, fmt::Display};

use serde::{Serialize, Deserialize, de::Visitor};

/// Defines an integer number in the range of -2^31 to 2^31 - 1.
type Integer = i64;

/// Defines an unsigned integer number in the range of 0 to 2^31 - 1.
type Uinteger = u64;

/// Defines a decimal number. Since decimal numbers are very
/// rare in the language server specification we denote the
/// exact range with every decimal using the mathematics
/// interval notation (e.g. \[0, 1] denotes all decimals d with
/// 0 <= d <= 1.
type Decimal = f64;

/// The LSP any type
#[derive(Debug)]
pub enum LSPAny {
    Object(Box<LSPObject>),
    Array(Box<LSPArray>),
    String(String),
    Integer(Integer),
    UInteger(Uinteger),
    Decimal(Decimal),
    Boolean(bool),
    Null
}

impl Serialize for LSPAny {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
        where
            S: serde::Serializer {
        match self {
            Self::Object(obj) => obj.serialize(serializer),
            Self::Array(arr) => arr.serialize(serializer),
            Self::Boolean(b) => serializer.serialize_bool(*b),
            Self::Decimal(d) => serializer.serialize_f64(*d),
            Self::Integer(i) => serializer.serialize_i64(*i),
            Self::String(s) => s.serialize(serializer),
            Self::UInteger(ui) => serializer.serialize_u64(*ui),
            Self::Null => serializer.serialize_unit()
        }
    }
}
struct LSPAnyVisitor;

impl<'de> Visitor<'de> for LSPAnyVisitor {
    type Value = LSPAny;

    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
        formatter.write_str("object, array, boolean, decimal, integer, string or null.")
    }

    fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
        where
            E: serde::de::Error, {
        Ok(LSPAny::Boolean(v))
    }

    fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
        where
            E: serde::de::Error, {
        Ok(LSPAny::Decimal(v))
    }

    fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
        where
            E: serde::de::Error, {
        Ok(LSPAny::Integer(v))
    }

    fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
        where
            E: serde::de::Error, {
        Ok(LSPAny::UInteger(v))
    }

    fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
        where
            E: serde::de::Error, {
        Ok(LSPAny::String(String::from(v)))
    }

    fn visit_unit<E>(self) -> Result<Self::Value, E>
        where
            E: serde::de::Error, {
        Ok(LSPAny::Null)
    }

    fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error>
        where
            A: serde::de::SeqAccess<'de>, {
        let mut v = Box::new(vec![]);

        while let Some(element) = seq.next_element()? {
            v.push(element);
        }

        Ok(LSPAny::Array(v))
    }

    fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error>
        where
            A: serde::de::MapAccess<'de>, {
        let mut m = Box::new(HashMap::new());

        while let Some((key, value)) = map.next_entry()? {
            m.insert(key, value);
        }

        Ok(LSPAny::Object(m))
    }
}

impl<'de> Deserialize<'de> for LSPAny {

    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
        where
            D: serde::Deserializer<'de> {
        deserializer.deserialize_any(LSPAnyVisitor)
    }
}

/// LSP object definition.
type LSPObject = HashMap<String, LSPAny>;

/// LSP arrays.
type LSPArray = Vec<LSPAny>;

/// Message id type
#[derive(Debug, PartialEq, Eq, Hash)]
pub enum IntegerOrString {
    Integer(Integer),
    String(String)
}

impl Serialize for IntegerOrString {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
        where
            S: serde::Serializer {
        match self {
            Self::Integer(i) => serializer.serialize_i64(*i),
            Self::String(s) => s.serialize(serializer),
        }
    }
}
struct IntegerOrStringVisitor;

impl<'de> Visitor<'de> for IntegerOrStringVisitor {
    type Value = IntegerOrString;

    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
        formatter.write_str("integer or string.")
    }

    fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>
        where
            E: serde::de::Error, {
        Ok(IntegerOrString::Integer(v))
    }

    fn visit_i32<E>(self, v: i32) -> Result<Self::Value, E>
        where
            E: serde::de::Error, {
        Ok(IntegerOrString::Integer(v as i64))
    }

    fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
        where
            E: serde::de::Error, {
        Ok(IntegerOrString::String(String::from(v)))
    }
}

impl<'de> Deserialize<'de> for IntegerOrString {

    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
        where
            D: serde::Deserializer<'de> {
        deserializer.deserialize_any(IntegerOrStringVisitor)
    }
}

impl Display for IntegerOrString {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            IntegerOrString::Integer(i) => write!(f, "{i}"),
            IntegerOrString::String(s) => write!(f, "\"{s}\"")
        }
    }
}

/// A request message to describe a request between the client and the server.
/// Every processed request must send a response back to the sender of the request.
#[derive(Debug, Deserialize, Serialize)]
pub struct RequestMessage<T> {
    /// jsonrpc version. LSP uses 2.0
    pub jsonrpc: String,
    /// The request id.
    pub id: IntegerOrString,
    /// The method to be invoked.
    pub method: String,
    /// The method's params
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default)]
    pub params: Option<T>
}

/// A Response Message sent as a result of a request. If a request doesn’t provide a result value
/// the receiver of a request still needs to return a response message to conform to the JSON-RPC specification.
/// The result property of the ResponseMessage should be set to null in this case to signal a successful request.
#[derive(Debug, Deserialize, Serialize)]
pub struct ResponseMessage<T> {
    /// jsonrpc version. LSP uses 2.0
    pub jsonrpc: String,
    /// The request id.
    pub id: Option<IntegerOrString>,
    /// The result of a request. This member is REQUIRED on success.
    /// This member MUST NOT exist if there was an error invoking the method.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default)]
    pub result: Option<T>,
    /// The error object in case a request fails.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default)]
    pub error: Option<ResponseError>
}

#[derive(Debug, Serialize, Deserialize)]
pub struct ResponseError {
    /// A number indicating the error type that occured.
    pub code: Integer,
    /// A string providing a short description of the error.
    pub message: String,
    /// A primitive or structured value that contains additional
    /// information about the error. Can be omitted.
    /// 
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default)]
    pub data: Option<LSPAny>
}

pub mod error_codes {
    use super::Integer;
    // Defined by JSON-RPC
    pub const PARSE_ERROR: Integer = -32700;
    pub const INVALID_REQUEST: Integer = -32600;
    pub const METHOD_NOT_FOUND: Integer = -32701;
    pub const INVALID_PARAMS: Integer = -32702;
    pub const INTERNAL_ERROR: Integer = -32703;

	/// This is the start range of JSON-RPC reserved error codes.
	/// It doesn't denote a real error code. No LSP error codes should
	/// be defined between the start and end range. For backwards
	/// compatibility the `ServerNotInitialized` and the `UnknownErrorCode`
	/// are left in the range.
    pub const JSONRPC_RESERVED_ERROR_RANGE_START: Integer = -32099;
    /// Deprecated: use `JSONRPC_RESERVED_ERROR_RANGE_START` instead.
    #[deprecated]
    pub const SERVER_ERROR_START: Integer = JSONRPC_RESERVED_ERROR_RANGE_START;

    /// Error code indicating that a server received a notification or
    /// request before the server has received the `initialize` request.
    pub const SERVER_NOT_INITIALIZED: Integer = -32002;
    pub const UNKNOWN_ERROR_CODE: Integer = -32001;

	/// This is the end range of JSON-RPC reserved error codes.
	/// It doesn't denote a real error code.
	pub const JSONRPC_RESERVED_ERROR_RANGE_END: Integer = -32000;
    /// Deprecated: use 
	#[deprecated]
	pub const SERVER_ERROR_END: Integer = JSONRPC_RESERVED_ERROR_RANGE_END;

	/// This is the start range of LSP reserved error codes.
	/// It doesn't denote a real error code.
	pub const LSP_RESERVED_ERROR_RANGE_START: Integer = -32899;

	/// A request failed but it was syntactically correct, e.g the
	/// method name was known and the parameters were valid. The error
	/// message should contain human readable information about why
	/// the request failed.
	pub const REQUEST_FAILED: Integer = -32803;

	/// The server cancelled the request. This error code should
	/// only be used for requests that explicitly support being
	/// server cancellable.
	pub const SERVER_CANCELLED: Integer = -32802;

	/// The server detected that the content of a document got
	/// modified outside normal conditions. A server should
	/// NOT send this error code if it detects a content change
	/// in it unprocessed messages. The result even computed
	/// on an older state might still be useful for the client.
	///
	/// If a client decides that a result is not of any use anymore
	/// the client should cancel the request.
	pub const CONTENT_MODIFIED: Integer = -32801;

	/// The client has canceled a request and a server as detected
	/// the cancel.
	pub const REQUEST_CANCELLED: Integer = -32800;

	/// This is the end range of LSP reserved error codes.
	/// It doesn't denote a real error code.
	pub const LSP_RESERVED_ERROR_RANGE_END: Integer = -32800;
}

pub type DocumentUri = String;
pub type URI = String;

/// A notification message. A processed notification message must not send a response back. They work like events.
#[derive(Debug, Serialize, Deserialize)]
pub struct NotificationMessage<T> {
    /// jsonrpc version. LSP uses 2.0
    pub jsonrpc: String,
    /// The method to be invoked.
    pub method: String,
    /// The notification's params
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default)]
    pub params: Option<T>
}

#[derive(Debug, Serialize, Deserialize)]
pub struct CancelParams {
    /// The request id to cancel.
    id: IntegerOrString
}

/// The base protocol offers support for request cancellation.
/// A request A request that got canceled still needs to return from the server and send a response back.
/// It can not be left open / hanging. This is in line with the JSON-RPC protocol
/// that requires that every request sends a response back. In addition it allows for
/// returning partial results on cancel. If the request returns an error response on cancellation it is
/// advised to set the error code to `ErrorCodes.RequestCancelled`.
/// To cancel a request, a notification message with the following properties is sent:
/// # Notification
/// * `method`: '$/cancelRequest'
/// * `params`: CancelParams
pub type CancelNotification = NotificationMessage<CancelParams>;

pub type ProgressToken = IntegerOrString;

#[derive(Debug, Serialize, Deserialize)]
pub struct ProgressParams<T> {
    /// The progress token provided by the client or server.
    token: ProgressToken,
    /// The progress data.
    value: T
}

/// The base protocol offers also support to report progress in a generic fashion.
/// This mechanism can be used to report any kind of progress including work done progress
/// (usually used to report progress in the user interface using a progress bar) and partial
/// result progress to support streaming of results.
///A progress notification has the following properties:
/// # Notification:
/// * `method`: '$/progress'
/// * `params`: ProgressParams
pub type ProgressNotification<T> = NotificationMessage<ProgressParams<T>>;

/// Client capabilities specific to regular expressions
#[derive(Debug, Serialize, Deserialize)]
pub struct RegularExpressionsClientCapabilities {
    /// The engine's name
    engine: String,
    /// The engine's version
    #[serde(skip_serializing_if = "Option::is_none")]
    version: Option<String>
}

pub const EOL: [&str; 3] = ["\n", "\r\n", "\r"];

/// Position in a text document expressed as zero-based line and zero-based character offset.
/// A position is between two characters like an 'insert' cursor in an editor. Special values like for example -1 to
/// denote the end of a line are not supported.
#[derive(Debug, Serialize, Deserialize)]
pub struct Position {
    /// Line position in a document (zero-based).
    line: Uinteger,
    /// Character offset on a line in a document (zero-based). The meaning of this
	/// offset is determined by the negotiated `PositionEncodingKind`.
	/// If the character value is greater than the line length it defaults back
	/// to the line length.
    character: Uinteger
}

#[derive(Debug, Serialize, Deserialize)]
/// A type indicating how positions are encoded, specifically what column offsets mean.
pub enum PositionEncodingKind {
    /// Character offsets count UTF-8 code units.
    #[serde(rename = "utf-8")]
    UTF8,
    /// Character offsets count UTF-16 code units.
    /// 
    /// This is the default and must always be supported by servers.
    #[serde(rename = "utf-16")]
    UTF16,
    /// Character offsets count UTF-32 code units.
    /// 
    /// Implementation note: these are the same as Unicode code points,
    /// so this `PositionEncodingKind` may also be used for an
    /// encoding-agnostic representation of character offsets.
    #[serde(rename = "utf-32")]
    UTF32
}

/// A range in a text document expressed as (zero-based) start and end positions. A range is comparable to a selection in an editor.
/// Therefore the end position is exclusive. If you want to specify a range that contains a line including the
/// line ending character(s) then use an end position denoting the start of the next line. For example:
/// 
/// ```json
/// {
///     start: { line: 5, character: 23 },
///     end : { line: 6, character: 0 }
/// }
/// ```
#[derive(Debug, Serialize, Deserialize)]
pub struct Range {
    /// The range's start position.
    pub start: Position,
    /// The range's end position.
    pub end: Position
}

/// Information about the client
#[derive(Debug, Serialize, Deserialize)]
pub struct ClientInfo {
    /// The name of the client as defined by the client.
    name: String,
    /// The client's version as defined by the client.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default)]
    version: Option<String>
}

#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct InitializeParams {
    /// The process Id of the parent process that started the server. Is null if the process has not been started by another process.
    /// If the parent process is not alive then the server should exit (see exit notification) its process.
    pub process_id: Option<Integer>,
    /// Information about the client
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default)]
    pub client_info: Option<ClientInfo>,
    /// The locale the client is currently showing the user interface
	/// in. This must not necessarily be the locale of the operating
	/// system.
	///
	/// Uses IETF language tags as the value's syntax
	/// (See https://en.wikipedia.org/wiki/IETF_language_tag)
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default)]
    pub locale: Option<String>,
    /// The root path of the workspace. Is null if no folder is open.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default)]
    #[deprecated = "in favour of root_uri"]
    pub root_path: Option<Option<String>>,
    /// The rootUri of the workspace. Is null if no folder is open. If both `root_path` and `root_uri` are set, `root_uri` wins.
    #[deprecated = "in favour of workspace_folders"]
    pub root_uri: Option<DocumentUri>,
    /// User provided initialization options.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default)]
    pub initialization_options: Option<LSPAny>,
    /// The capabilities provided by the client.
    pub capabilities: ClientCapabilities,
    /// The initial trace setting. If omitted trace is disabled (`'off'`).
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default)]
    pub trace: Option<TraceValue>,
    /// The workspace folders configured in the client when the server starts.
	/// This property is only available if the client supports workspace folders.
	/// It can be `null` if the client supports workspace folders but none are
	/// configured.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default)]
    pub workspace_folders: Option<Option<Vec<WorkspaceFolder>>>,
}

/// Information about the server.
#[derive(Debug, Serialize, Deserialize)]
pub struct ServerInfo {
    /// The name of the server as defined by the server.
    pub name: String,
    /// The server's version as defined by the server.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default)]
    pub version: Option<String>
}

#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct InitializeResult {
    /// The capabilities the language server provides.
    pub capabilities: ServerCapabilities,
    /// Information about the server
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default)]
    pub server_info: Option<ServerInfo>
}

#[derive(Debug, Serialize, Deserialize)]
pub struct InitializedParams {}

/// The initialize request is sent as the first request from the client to the server. If the server receives a request or notification
/// before the initialize request it should act as follows:
///
/// * For a request the response should be an error with code: -32002. The message can be picked by the server.
/// * Notifications should be dropped, except for the exit notification. This will allow the exit of a server without an initialize request.
///
/// Until the server has responded to the initialize request with an InitializeResult, the client must not send any additional requests or
/// notifications to the server. In addition the server is not allowed to send any requests or notifications to the client until it has
/// responded with an InitializeResult, with the exception that during the initialize request the server is allowed to send the notifications
/// window/showMessage, window/logMessage and telemetry/event as well as the window/showMessageRequest request to the client.
/// In case the client sets up a progress token in the initialize params (e.g. property workDoneToken) the server is also allowed
/// to use that token (and only that token) using the $/progress notification sent from the server to the client.
///
/// The initialize request may only be sent once.
///
/// # Request
///
/// * `method`: 'initialize'
/// * `params`: `InitializeParams`
pub type InitializeRequest = RequestMessage<InitializeParams>;

/// # Response
/// * `result`: `InitializeResult`
pub type InitializeResponse = ResponseMessage<InitializeResult>;

/// The initialized notification is sent from the client to the server after the client received the result of the initialize request but before the client is sending any other request or notification to the server. The server can use the initialized notification for example to dynamically register capabilities. The initialized notification may only be sent once.
///
/// # Notification:
/// * `method`: 'initialized'
///* `params`: `InitializedParams`
pub type InitializedNotification = NotificationMessage<InitializedParams>;

/// `ClientCapabilities` define capabilities for dynamic registration, workspace and text document features the client supports.
/// The experimental can be used to pass experimental capabilities under development.
/// For future compatibility a ClientCapabilities object literal can have more properties set than currently defined.
/// Servers receiving a ClientCapabilities object literal with unknown properties should ignore these properties.
/// A missing property should be interpreted as an absence of the capability. If a missing property normally defines sub properties,
/// all missing sub properties should be interpreted as an absence of the corresponding capability.
#[derive(Debug, Serialize, Deserialize)]
pub struct ClientCapabilities {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default)]
    pub workspace: Option<WorkspaceClientCapabilities>,
}

/// Workspace specific capabilities.
#[derive(Debug, Serialize, Deserialize)]
pub struct WorkspaceClientCapabilities {

}

/// A `TraceValue` represents the level of verbosity with which the server systematically reports its execution
/// trace using `$/logTrace` notifications. The initial trace value is set by the client at initialization
/// and can be modified later using the `$/setTrace` notification.
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub enum TraceValue {
    Off,
    Messages,
    Verbose
}

#[derive(Debug, Serialize, Deserialize)]
pub struct WorkspaceFolder {
    /// The associated URI for this workspace folder.
    uri: DocumentUri,
    /// The name of the workspace folder. Used to refer to this workspace folder in the user interface.
    name: String
}

#[derive(Debug, Serialize, Deserialize)]
pub struct SetTraceParams {
    /// The new value that should be assigned to the trace setting.
    pub value: TraceValue
}

/// A notification that should be used by the client to modify the trace setting of the server.
///
/// # Notification
///
/// * `method`: `'$/setTrace'`
/// * `params`: `SetTraceParams`
pub type SetTraceNotification = NotificationMessage<SetTraceParams>;

#[derive(Debug, Serialize, Deserialize)]
pub struct LogTraceParams {
    /// The message to be logged.
    pub message: String,
    /// Additional information that can be computed if the `trace` configuration is set to `'verbose'`.
    #[serde(skip_serializing_if = "Option::is_none  ")]
    pub verbose: Option<String>
}

/// A notification to log the trace of the server’s execution. The amount and content of these notifications depends
/// on the current trace configuration. If trace is 'off', the server should not send any logTrace notification. If trace is 'messages',
/// the server should not add the 'verbose' field in the LogTraceParams.
///
/// `'$/logTrace'` should be used for systematic trace reporting. For single debugging messages, the server should send window/logMessage notifications.
///
/// # Notification
///
/// * `method`: `'$/logTrace'`
/// * `params`: `LogTraceParams`
pub type LogTraceNotification = NotificationMessage<LogTraceParams>;

/// The server can signal the following capabilities
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ServerCapabilities {
}

pub type ShutdownParams = ();
pub type ShutdownResult = ();

/// The `shutdown` request is sent from the client to the server. It asks the server to shut down, but to not exit
/// (otherwise the response might not be delivered correctly to the client). There is a separate `exit` notification
/// that asks the server to exit. Clients must not send any notifications other than exit or requests to a server
/// to which they have sent a `shutdown` request. Clients should also wait with sending the `exit` notification until
/// they have received a response from the `shutdown` request.
///
/// If a server receives requests after a shutdown request those requests should error with `InvalidRequest`.
///
/// # Request
/// * `method`: `'shutdown'`
/// * `params`: `void`
pub type ShutdownRequest = RequestMessage<()>;

/// # Response
/// * `result`: `null`
/// * `error`: code and message set in case an exception happens during shutdown request.
pub type ShutdownRespons = ResponseMessage<()>;