laburnum 1.17.1

An LSP framework for building language servers and compilers, powered by an incremental query tree with content-addressed storage, task-based dataflow, and parallel queries.
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
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
// Copyright Two Neutron Stars Incorporated and contributors
// SPDX-License-Identifier: BlueOak-1.0.0

use {
  crate::{
    Uri,
    database::PartitionWriteContextRef,
    protocol::{
      jsonrpc,
      lsp::{
        Position,
        PositionEncodingKind,
        Range,
      },
      macros::lsp_enum,
    },
    scheduler::task::TaskContext,
  },
  serde::{
    Deserialize,
    Serialize,
    de::Error,
  },
  std::collections::HashMap,
};

#[cfg(feature = "proposed")]
use crate::protocol::lsp::OneOf;

/// LSP document version number from the editor/client.
///
/// Per the LSP specification:
/// - The client generates and owns version numbers
/// - The server must never create or alter version numbers
/// - Version numbers flow from client → server
///
/// This type can only be created at the LSP protocol boundary via `From<i32>`,
/// or in test code via the `#[cfg(test)]` constructor.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct LspVersion(i32);

impl LspVersion {
  /// Get the raw i32 value.
  pub const fn raw(self) -> i32 {
    self.0
  }

  /// Test-only constructor.
  #[cfg(test)]
  pub const fn new(value: i32) -> Self {
    Self(value)
  }
}

impl From<i32> for LspVersion {
  fn from(value: i32) -> Self {
    Self(value)
  }
}

impl From<LspVersion> for i32 {
  fn from(value: LspVersion) -> Self {
    value.0
  }
}

fn deserialize_lsp_version<'de, D>(deserializer: D) -> Result<LspVersion, D::Error>
where
  D: serde::Deserializer<'de>,
{
  let value = i32::deserialize(deserializer)?;
  Ok(value.into())
}

fn serialize_lsp_version<S>(version: &LspVersion, serializer: S) -> Result<S::Ok, S::Error>
where
  S: serde::Serializer,
{
  serializer.serialize_i32(version.raw())
}

/// A textual edit applicable to a text document.
///
/// If n `TextEdit`s are applied to a text document all text edits describe
/// changes to the initial document version. Execution wise text edits should
/// applied from the bottom to the top of the text document. Overlapping text
/// edits are not supported.
#[derive(Debug, Default, Clone, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct TextEdit {
  /// The range of the text document to be manipulated. To insert
  /// text into a document create a range where start === end.
  pub range:    Range,
  /// The string to be inserted. For delete operations use an
  /// empty string.
  pub new_text: String,
}

impl TextEdit {
  #[must_use]
  pub const fn new(range: Range, new_text: String) -> Self {
    Self { range, new_text }
  }
}

/// Additional information that describes document changes.
///
/// @since 3.16.0
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ChangeAnnotation {
  /// A human-readable string describing the actual change. The string
  /// is rendered prominent in the user interface.
  pub label:              String,
  /// A flag which indicates that user confirmation is needed
  /// before applying the change.
  #[serde(skip_serializing_if = "Option::is_none")]
  pub needs_confirmation: Option<bool>,
  /// A human-readable string which is rendered less prominent in
  /// the user interface.
  #[serde(skip_serializing_if = "Option::is_none")]
  pub description:        Option<String>,
}

/// An identifier referring to a change annotation managed by a workspace
/// edit.
///
/// @since 3.16.0
pub type ChangeAnnotationIdentifier = String;

/// A special text edit with an additional change annotation.
///
/// @since 3.16.0
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct AnnotatedTextEdit {
  #[serde(flatten)]
  pub text_edit:     TextEdit,
  /// The actual annotation
  pub annotation_id: ChangeAnnotationIdentifier,
}

#[cfg(feature = "proposed")]
/// A string value used as a snippet is a template which allows to insert text
/// and to control the editor cursor when insertion happens.
///
/// A snippet can define tab stops and placeholders with `$1`, `$2`
/// and `${3:foo}`. `$0` defines the final tab stop, it defaults to
/// the end of the snippet. Variables are defined with `$name` and
/// `${name:default value}`.
///
/// @since 3.18.0
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
#[serde(tag = "kind")]
pub enum StringValue {
  Snippet(String),
}

#[cfg(feature = "proposed")]
/// An interactive text edit.
///
/// @since 3.18.0
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SnippetTextEdit {
  /// The range of the text document to be manipulated.
  pub range:         Range,
  /// The snippet to be inserted.
  pub snippet:       StringValue,
  /// The actual identifier of the snippet edit.
  #[serde(skip_serializing_if = "Option::is_none")]
  pub annotation_id: Option<ChangeAnnotationIdentifier>,
}

/// Describes textual changes on a single text document.
///
/// The text document is referred to as an
/// `OptionalVersionedTextDocumentIdentifier` to allow clients to check the text
/// document version before an edit is applied. A `TextDocumentEdit` describes
/// all changes on a version Si and after they are applied move the document to
/// version Si+1. So, the creator of a `TextDocumentEdit` doesn't need to sort
/// the array or do any kind of ordering. However, the edits must be non
/// overlapping.
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct TextDocumentEdit {
  /// The text document to change.
  pub text_document: OptionalVersionedTextDocumentIdentifier,

  #[cfg(not(feature = "proposed"))]
  /// The edits to be applied.
  ///
  /// @since 3.16.0 - support for `AnnotatedTextEdit`. This is guarded by the
  /// client capability `workspace.workspaceEdit.changeAnnotationSupport`
  pub edits: Vec<OneOf<TextEdit, AnnotatedTextEdit>>,

  #[cfg(feature = "proposed")]
  /// The edits to be applied.
  ///
  /// @since 3.16.0 - support for `AnnotatedTextEdit`. This is guarded by the
  /// client capability `workspace.workspaceEdit.changeAnnotationSupport`
  ///
  /// @since 3.18.0 - support for `SnippetTextEdit`. This is guarded by the
  /// client capability `workspace.workspaceEdit.snippetEditSupport`
  // TODO: refactor to enum
  pub edits: Vec<OneOf<TextEdit, OneOf<AnnotatedTextEdit, SnippetTextEdit>>>,
}

/// An item to transfer a text document from the client to the server.
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct TextDocumentItem {
  /// The text document's URI.
  pub uri: Uri,

  /// The text document's language identifier.
  pub language_id: String,

  /// The version number of this document (it will strictly increase after each
  /// change, including undo/redo).
  #[serde(deserialize_with = "deserialize_lsp_version", serialize_with = "serialize_lsp_version")]
  pub version: LspVersion,

  /// The content of the opened text document.
  pub text: String,
}

impl TextDocumentItem {
  #[must_use]
  pub const fn new(
    uri: Uri,
    language_id: String,
    version: LspVersion,
    text: String,
  ) -> Self {
    Self {
      uri,
      language_id,
      version,
      text,
    }
  }
}

// Text Document Identifier

/// Text documents are identified using a URI. On the protocol level, URIs are
/// passed as strings.
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
pub struct TextDocumentIdentifier {
  // !!!!!! Note:
  // In the spec VersionedTextDocumentIdentifier extends TextDocumentIdentifier
  // This modelled by "mixing-in" TextDocumentIdentifier in
  // VersionedTextDocumentIdentifier, so any changes to this type must be
  // effected in the sub-type as well.
  /// The text document's URI.
  pub uri: Uri,
}

impl TextDocumentIdentifier {
  #[must_use]
  pub const fn new(uri: Uri) -> Self {
    Self { uri }
  }
}

// Versionned Text Document Identifier

/// An identifier to denote a specific version of a text document. This
/// information usually flows from the client to the server.
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
pub struct VersionedTextDocumentIdentifier {
  // This field was "mixed-in" from TextDocumentIdentifier
  /// The text document's URI.
  pub uri: Uri,

  /// The version number of this document.
  ///
  /// The version number of a document will increase after each change,
  /// including undo/redo. The number doesn't need to be consecutive.
  #[serde(deserialize_with = "deserialize_lsp_version", serialize_with = "serialize_lsp_version")]
  pub version: LspVersion,
}

impl VersionedTextDocumentIdentifier {
  #[must_use]
  pub const fn new(uri: Uri, version: LspVersion) -> Self {
    Self { uri, version }
  }
}

/// An identifier which optionally denotes a specific version of a text
/// document. This information usually flows from the server to the client
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
pub struct OptionalVersionedTextDocumentIdentifier {
  // This field was "mixed-in" from TextDocumentIdentifier
  /// The text document's URI.
  pub uri:     Uri,
  /// The version number of this document. If an optional versioned text
  /// document identifier is sent from the server to the client and the file
  /// is not open in the editor (the server has not received an open
  /// notification before) the server can send `null` to indicate that the
  /// version is known and the content on disk is the master (as specified
  /// with document content ownership).
  ///
  /// The version number of a document will increase after each change,
  /// including undo/redo. The number doesn't need to be consecutive.
  pub version: Option<i32>,
}

impl OptionalVersionedTextDocumentIdentifier {
  #[must_use]
  pub const fn new(uri: Uri, version: i32) -> Self {
    Self {
      uri,
      version: Some(version),
    }
  }
}

// Text Document Position Params moved to text_document_position.rs module

pub use super::text_document_position::TextDocumentPositionParams;

/// Defines how the host (editor) should sync document changes to the language
/// server.
#[derive(Clone, Copy, PartialEq, Eq, Deserialize, Serialize)]
#[serde(transparent)]
pub struct TextDocumentSyncKind(i32);

lsp_enum! {
    impl TextDocumentSyncKind {
        /// Documents should not be synced at all.
        const NONE = 0;
        /// Documents are synced by always sending the full content of the document.
        const FULL = 1;
        /// Documents are synced by sending the full content on open. After that only
        /// incremental updates to the document are sent.
        const INCREMENTAL = 2;
    }
}

/// A document filter denotes a document through properties like language,
/// schema or pattern.
///
/// Examples are a filter that applies to TypeScript files on disk or a filter
/// the applies to JSON files with name package.json:
///
///
/// `{ language: 'typescript', scheme: 'file' }`
/// `{ language: 'json', pattern: '**/package.json' }`
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
pub struct DocumentFilter {
  /// A language id, like `typescript`.
  #[serde(skip_serializing_if = "Option::is_none")]
  pub language: Option<String>,
  /// A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
  #[serde(skip_serializing_if = "Option::is_none")]
  pub scheme:   Option<String>,
  /// A glob pattern, like `*.{ts,js}`.
  #[serde(skip_serializing_if = "Option::is_none")]
  pub pattern:  Option<String>,
}

/// A document selector is the combination of one or many document filters.
pub type DocumentSelector = Vec<DocumentFilter>;

/// Since most of the registration options require to specify a document
/// selector there is a base interface that can be used.
#[derive(Debug, Default, Clone, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct TextDocumentRegistrationOptions {
  /// A document selector to identify the scope of the registration. If set to
  /// null the document selector provided on the client side will be used.
  pub document_selector: Option<DocumentSelector>,
}

#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct DidOpenTextDocumentParams {
  /// The document that was opened.
  pub text_document: TextDocumentItem,
}

#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct DidChangeTextDocumentParams {
  /// The document that did change. The version number points
  /// to the version after all provided content changes have
  /// been applied.
  pub text_document:   VersionedTextDocumentIdentifier,
  /// The actual content changes.
  pub content_changes: Vec<TextDocumentContentChangeEvent>,
}

/// An event describing a change to a text document. If range and rangeLength
/// are omitted the new text is considered to be the full content of the
/// document.
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct TextDocumentContentChangeEvent {
  /// The range of the document that changed.
  #[serde(skip_serializing_if = "Option::is_none")]
  pub range: Option<Range>,

  /// The length of the range that got replaced.
  ///
  /// Deprecated: Use range instead
  #[serde(skip_serializing_if = "Option::is_none")]
  pub range_length: Option<u32>,

  /// The new text of the document.
  pub text: String,
}

/// Describe options to be used when registering for text document change
/// events.
///
/// Extends `TextDocumentRegistrationOptions`
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct TextDocumentChangeRegistrationOptions {
  /// A document selector to identify the scope of the registration. If set to
  /// null the document selector provided on the client side will be used.
  pub document_selector: Option<DocumentSelector>,

  /// How documents are synced to the server. See TextDocumentSyncKind.Full
  /// and TextDocumentSyncKind.Incremental.
  pub sync_kind: TextDocumentSyncKind,
}

/// The parameters send in a will save text document notification.
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct WillSaveTextDocumentParams {
  /// The document that will be saved.
  pub text_document: TextDocumentIdentifier,

  /// The [`TextDocumentSaveReason`].
  pub reason: TextDocumentSaveReason,
}

/// Represents reasons why a text document is saved.
#[derive(Clone, Copy, PartialEq, Eq, Deserialize, Serialize)]
#[serde(transparent)]
pub struct TextDocumentSaveReason(i32);

lsp_enum! {
    impl TextDocumentSaveReason {
        /// Manually triggered, e.g. by the user pressing save, by starting debugging,
        /// or by an API call.
        const MANUAL = 1;
        /// Automatic after a delay.
        const AFTER_DELAY = 2;
        /// When the editor lost focus.
        const FOCUS_OUT = 3;
    }
}

#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct DidCloseTextDocumentParams {
  /// The document that was closed.
  pub text_document: TextDocumentIdentifier,
}

#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct DidSaveTextDocumentParams {
  /// The document that was saved.
  pub text_document: TextDocumentIdentifier,

  /// Optional the content when saved. Depends on the includeText value
  /// when the save notification was requested.
  #[serde(skip_serializing_if = "Option::is_none")]
  pub text: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct TextDocumentSaveRegistrationOptions {
  /// The client is supposed to include the content on save.
  #[serde(skip_serializing_if = "Option::is_none")]
  pub include_text: Option<bool>,

  #[serde(flatten)]
  pub text_document_registration_options: TextDocumentRegistrationOptions,
}

/// This trait defines all the rest of the `textDocument/` methods that are
/// not part of another feature.
pub trait TextDocumentService<
  P: crate::database::storage::Partitions,
  T: crate::protocol::lsp::LanguageServer<P>,
>: Send + Sync + 'static
{
  /// The [`textDocument/didOpen`] notification is sent from the client to the
  /// server to signal that a new text document has been opened by the client.
  ///
  /// [`textDocument/didOpen`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_didOpen
  ///
  /// The document's truth is now managed by the client and the server must not
  /// try to read the document’s truth using the document's URI. "Open" in
  /// this sense means it is managed by the client. It doesn't necessarily
  /// mean that its content is presented in an editor.
  fn did_open(
    &self,
    params: DidOpenTextDocumentParams,
    ctx: &mut TaskContext<P, T>,
    writer: &mut PartitionWriteContextRef<'_, P>,
  ) -> impl std::future::Future<Output = ()> + Send {
    let client_id = ctx.client_id();

    async move {
      let uri = params.text_document.uri.clone();
      let version = params.text_document.version;

      let source_cache = ctx.source_cache();
      let mut cache = source_cache.write();

      match cache.upsert_with_version(
        uri.clone(),
        params.text_document.text,
        version,
        client_id,
      ) {
        | Ok((key, changed)) => {
          cache.mark_file_open(uri.clone(), client_id);
        },
        | Err(e) => {},
      }
    }
  }

  const DID_OPEN_LANE: crate::scheduler::lanes::Lane =
    crate::scheduler::lanes::INPUT_CONTINUOUS_LANE;

  /// The [`textDocument/didChange`] notification is sent from the client to the
  /// server to signal changes to a text document.
  ///
  /// [`textDocument/didChange`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_didChange
  ///
  /// This notification will contain a distinct version tag and a list of edits
  /// made to the document for the server to interpret.
  fn did_change(
    &self,
    params: DidChangeTextDocumentParams,
    ctx: &mut TaskContext<P, T>,
    writer: &mut PartitionWriteContextRef<'_, P>,
  ) -> impl std::future::Future<Output = ()> + Send {
    let client_id = ctx.client_id();

    // Get the position encoding from the client
    let encoding = ctx.position_encoding();

    async move {
      let cache_lock = ctx.source_cache();
      let mut cache = cache_lock.write();
      match cache.apply_content_changes(
        &params.text_document.uri,
        params.text_document.version,
        params.content_changes,
        &encoding,
        client_id,
      ) {
        | Ok((key, changed)) => {},
        | Err(e) => {},
      }
    }
  }
  const DID_CHANGE_LANE: crate::scheduler::lanes::Lane =
    crate::scheduler::lanes::INPUT_CONTINUOUS_LANE;

  /// The [`textDocument/didSave`] notification is sent from the client to the
  /// server when the document was saved in the client.
  ///
  /// [`textDocument/didSave`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_didSave
  fn did_save(
    &self,
    params: DidSaveTextDocumentParams,
    ctx: &mut TaskContext<P, T>,
    writer: &mut PartitionWriteContextRef<'_, P>,
  ) -> impl std::future::Future<Output = ()> + Send {
    async move {
      let _ = params;
    }
  }
  const DID_SAVE_LANE: crate::scheduler::lanes::Lane =
    crate::scheduler::lanes::DEFAULT_LANE;

  /// The [`textDocument/didClose`] notification is sent from the client to the
  /// server when the document got closed in the client.
  ///
  /// [`textDocument/didClose`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_didClose
  ///
  /// The document's truth now exists where the document's URI points to (e.g.
  /// if the document's URI is a file URI, the truth now exists on disk).
  fn did_close(
    &self,
    params: DidCloseTextDocumentParams,
    ctx: &mut TaskContext<P, T>,
    writer: &mut PartitionWriteContextRef<'_, P>,
  ) -> impl std::future::Future<Output = ()> + Send {
    let client_id = ctx.client_id();

    async move {
      let cache_lock = ctx.source_cache();
      let mut cache = cache_lock.write();
      cache.mark_file_closed(&params.text_document.uri, client_id);
    }
  }
  const DID_CLOSE_LANE: crate::scheduler::lanes::Lane =
    crate::scheduler::lanes::DEFAULT_LANE;

  const TEXT_DOCUMENT_LANE: crate::scheduler::lanes::Lane =
    crate::scheduler::lanes::DEFAULT_LANE;
}

pub trait TextDocumentHookService<
  P: crate::database::storage::Partitions,
  T: crate::protocol::lsp::LanguageServer<P>,
>: Send + Sync + 'static
{
  /// The [`textDocument/willSave`] notification is sent from the client to the
  /// server before the document is actually saved.
  ///
  /// [`textDocument/willSave`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_willSave
  fn will_save(
    &self,
    params: WillSaveTextDocumentParams,
    ctx: &mut TaskContext<P, T>,
    writer: &mut PartitionWriteContextRef<'_, P>,
  ) -> impl std::future::Future<Output = ()> + Send {
    async move {}
  }
  const WILL_SAVE_LANE: crate::scheduler::lanes::Lane =
    crate::scheduler::lanes::DEFAULT_LANE;

  /// The [`textDocument/willSaveWaitUntil`] request is sent from the client to
  /// the server before the document is actually saved.
  ///
  /// [`textDocument/willSaveWaitUntil`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_willSaveWaitUntil
  ///
  /// The request can return an array of `TextEdit`s which will be applied to
  /// the text document before it is saved.
  ///
  /// Please note that clients might drop results if computing the text edits
  /// took too long or if a server constantly fails on this request. This is
  /// done to keep the save fast and reliable.
  fn will_save_wait_until(
    &self,
    params: WillSaveTextDocumentParams,
    ctx: &mut TaskContext<P, T>,
    writer: &mut PartitionWriteContextRef<'_, P>,
  ) -> impl std::future::Future<Output = jsonrpc::Result<Option<Vec<TextEdit>>>> + Send
  {
    async move { Ok(None) }
  }
  const WILL_SAVE_WAIT_UNTIL_LANE: crate::scheduler::lanes::Lane =
    crate::scheduler::lanes::DEFAULT_LANE;
}