From abde9a33b94bb6c1f04e5e613732f61e908dfd5a Mon Sep 17 00:00:00 2001 From: Colen Garoutte-Carson <49173979+Colengms@users.noreply.github.com> Date: Tue, 1 Sep 2020 17:05:30 -0700 Subject: [PATCH] Split format requests into separate messages for telemetry (#6068) --- Extension/src/LanguageServer/client.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Extension/src/LanguageServer/client.ts b/Extension/src/LanguageServer/client.ts index 9aff90b09a..9d3ff74672 100644 --- a/Extension/src/LanguageServer/client.ts +++ b/Extension/src/LanguageServer/client.ts @@ -405,7 +405,10 @@ const GetDocumentSymbolRequest: RequestType = new RequestType('cpptools/getWorkspaceSymbols'); const GetFoldingRangesRequest: RequestType = new RequestType('cpptools/getFoldingRanges'); const GetSemanticTokensRequest: RequestType = new RequestType('cpptools/getSemanticTokens'); -const DocumentFormatRequest: RequestType = new RequestType('cpptools/format'); +const FormatDocumentRequest: RequestType = new RequestType('cpptools/formatDocument'); +const FormatRangeRequest: RequestType = new RequestType('cpptools/formatRange'); +const FormatOnTypeRequest: RequestType = new RequestType('cpptools/formatOnType'); + // Notifications to the server const DidOpenNotification: NotificationType = new NotificationType('textDocument/didOpen'); const FileCreatedNotification: NotificationType = new NotificationType('cpptools/fileCreated'); @@ -702,7 +705,7 @@ class DocumentFormattingEditProvider implements vscode.DocumentFormattingEditPro } } }; - return this.client.languageClient.sendRequest(DocumentFormatRequest, params) + return this.client.languageClient.sendRequest(FormatDocumentRequest, params) .then((textEdits) => { const result: vscode.TextEdit[] = []; textEdits.forEach((textEdit) => { @@ -759,7 +762,7 @@ class DocumentRangeFormattingEditProvider implements vscode.DocumentRangeFormatt } } }; - return this.client.languageClient.sendRequest(DocumentFormatRequest, params) + return this.client.languageClient.sendRequest(FormatRangeRequest, params) .then((textEdits) => { const result: vscode.TextEdit[] = []; textEdits.forEach((textEdit) => { @@ -816,7 +819,7 @@ class OnTypeFormattingEditProvider implements vscode.OnTypeFormattingEditProvide } } }; - return this.client.languageClient.sendRequest(DocumentFormatRequest, params) + return this.client.languageClient.sendRequest(FormatOnTypeRequest, params) .then((textEdits) => { const result: vscode.TextEdit[] = []; textEdits.forEach((textEdit) => {