internal: Allow OnTypeFormatting to send SnippetTextEdit

But continue to send TextEdit only.
This commit is contained in:
Felicián Németh
2022-03-27 10:45:57 +02:00
parent 3de03d4c61
commit 636d4880c4
5 changed files with 38 additions and 15 deletions

View File

@@ -4,8 +4,8 @@ use std::{collections::HashMap, path::PathBuf};
use lsp_types::request::Request;
use lsp_types::{
notification::Notification, CodeActionKind, PartialResultParams, Position, Range,
TextDocumentIdentifier, WorkDoneProgressParams,
notification::Notification, CodeActionKind, DocumentOnTypeFormattingParams,
PartialResultParams, Position, Range, TextDocumentIdentifier, WorkDoneProgressParams,
};
use serde::{Deserialize, Serialize};
@@ -512,6 +512,19 @@ pub enum WorkspaceSymbolSearchKind {
AllSymbols,
}
/// The document on type formatting request is sent from the client to
/// the server to format parts of the document during typing. This is
/// almost same as lsp_types::request::OnTypeFormatting, but the
/// result has SnippetTextEdit in it instead of TextEdit.
#[derive(Debug)]
pub enum OnTypeFormatting {}
impl Request for OnTypeFormatting {
type Params = DocumentOnTypeFormattingParams;
type Result = Option<Vec<SnippetTextEdit>>;
const METHOD: &'static str = "textDocument/onTypeFormatting";
}
#[derive(Debug, Serialize, Deserialize)]
pub struct CompletionResolveData {
pub position: lsp_types::TextDocumentPositionParams,