Skip to content

Commit

Permalink
Split format requests into separate messages for telemetry (#6068)
Browse files Browse the repository at this point in the history
  • Loading branch information
Colengms authored Sep 2, 2020
1 parent e8bc0e8 commit abde9a3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Extension/src/LanguageServer/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,10 @@ const GetDocumentSymbolRequest: RequestType<GetDocumentSymbolRequestParams, Loca
const GetSymbolInfoRequest: RequestType<WorkspaceSymbolParams, LocalizeSymbolInformation[], void, void> = new RequestType<WorkspaceSymbolParams, LocalizeSymbolInformation[], void, void>('cpptools/getWorkspaceSymbols');
const GetFoldingRangesRequest: RequestType<GetFoldingRangesParams, GetFoldingRangesResult, void, void> = new RequestType<GetFoldingRangesParams, GetFoldingRangesResult, void, void>('cpptools/getFoldingRanges');
const GetSemanticTokensRequest: RequestType<GetSemanticTokensParams, GetSemanticTokensResult, void, void> = new RequestType<GetSemanticTokensParams, GetSemanticTokensResult, void, void>('cpptools/getSemanticTokens');
const DocumentFormatRequest: RequestType<FormatParams, TextEdit[], void, void> = new RequestType<FormatParams, TextEdit[], void, void>('cpptools/format');
const FormatDocumentRequest: RequestType<FormatParams, TextEdit[], void, void> = new RequestType<FormatParams, TextEdit[], void, void>('cpptools/formatDocument');
const FormatRangeRequest: RequestType<FormatParams, TextEdit[], void, void> = new RequestType<FormatParams, TextEdit[], void, void>('cpptools/formatRange');
const FormatOnTypeRequest: RequestType<FormatParams, TextEdit[], void, void> = new RequestType<FormatParams, TextEdit[], void, void>('cpptools/formatOnType');

// Notifications to the server
const DidOpenNotification: NotificationType<DidOpenTextDocumentParams, void> = new NotificationType<DidOpenTextDocumentParams, void>('textDocument/didOpen');
const FileCreatedNotification: NotificationType<FileChangedParams, void> = new NotificationType<FileChangedParams, void>('cpptools/fileCreated');
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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) => {
Expand Down

0 comments on commit abde9a3

Please sign in to comment.