@@ -28,7 +28,7 @@ import * as fs from 'fs';
2828import * as os from 'os' ;
2929import { SourceFileConfiguration , SourceFileConfigurationItem , Version , WorkspaceBrowseConfiguration } from 'vscode-cpptools' ;
3030import { IntelliSenseStatus , Status } from 'vscode-cpptools/out/testApi' ;
31- import { CloseAction , DidOpenTextDocumentParams , ErrorAction , LanguageClientOptions , NotificationType , Position , Range , RequestType , ResponseError , TextDocumentIdentifier , TextDocumentPositionParams } from 'vscode-languageclient' ;
31+ import { CloseAction , ErrorAction , LanguageClientOptions , NotificationType , Position , Range , RequestType , ResponseError , TextDocumentIdentifier , TextDocumentPositionParams } from 'vscode-languageclient' ;
3232import { LanguageClient , ServerOptions } from 'vscode-languageclient/node' ;
3333import * as nls from 'vscode-nls' ;
3434import { DebugConfigurationProvider } from '../Debugger/configurationProvider' ;
@@ -590,6 +590,18 @@ export interface CopilotCompletionContextParams {
590590doAggregateSnippets :boolean ;
591591}
592592
593+ export interface TextDocumentItemWithOriginalEncoding {
594+ uri :string ;
595+ languageId :string ;
596+ version :number ;
597+ text :string ;
598+ originalEncoding :string ;
599+ }
600+
601+ export interface DidOpenTextDocumentParamsWithOriginalEncoding {
602+ textDocument :TextDocumentItemWithOriginalEncoding ;
603+ }
604+
593605// Requests
594606const PreInitializationRequest :RequestType < void , string , void > = new RequestType < void , string , void > ( 'cpptools/preinitialize' ) ;
595607const InitializationRequest :RequestType < CppInitializationParams , CppInitializationResult , void > = new RequestType < CppInitializationParams , CppInitializationResult , void > ( 'cpptools/initialize' ) ;
@@ -614,7 +626,7 @@ const CppContextRequest: RequestType<TextDocumentIdentifier, ChatContextResult,
614626const CopilotCompletionContextRequest :RequestType < CopilotCompletionContextParams , CopilotCompletionContextResult , void > = new RequestType < CopilotCompletionContextParams , CopilotCompletionContextResult , void > ( 'cpptools/getCompletionContext' ) ;
615627
616628// Notifications to the server
617- const DidOpenNotification :NotificationType < DidOpenTextDocumentParams > = new NotificationType < DidOpenTextDocumentParams > ( 'textDocument /didOpen' ) ;
629+ const DidOpenNotification :NotificationType < DidOpenTextDocumentParamsWithOriginalEncoding > = new NotificationType < DidOpenTextDocumentParamsWithOriginalEncoding > ( 'cpptools /didOpen' ) ;
618630const FileCreatedNotification :NotificationType < FileChangedParams > = new NotificationType < FileChangedParams > ( 'cpptools/fileCreated' ) ;
619631const FileChangedNotification :NotificationType < FileChangedParams > = new NotificationType < FileChangedParams > ( 'cpptools/fileChanged' ) ;
620632const FileDeletedNotification :NotificationType < FileChangedParams > = new NotificationType < FileChangedParams > ( 'cpptools/fileDeleted' ) ;
@@ -2327,12 +2339,13 @@ export class DefaultClient implements Client {
23272339
23282340// Only used in crash recovery. Otherwise, VS Code sends didOpen directly to native process (through the protocolFilter).
23292341public async sendDidOpen ( document :vscode . TextDocument ) :Promise < void > {
2330- const params :DidOpenTextDocumentParams = {
2342+ const params :DidOpenTextDocumentParamsWithOriginalEncoding = {
23312343textDocument :{
23322344uri :document . uri . toString ( ) ,
23332345languageId :document . languageId ,
23342346version :document . version ,
2335- text :document . getText ( )
2347+ text :document . getText ( ) ,
2348+ originalEncoding :document . encoding
23362349}
23372350} ;
23382351await this . ready ;