Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit79fe240

Browse files
authored
Enable string length encoding fix in cpptools (microsoft#13769)
1 parenta637321 commit79fe240

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

‎Extension/src/LanguageServer/client.ts‎

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import * as fs from 'fs';
2828
import*asosfrom'os';
2929
import{SourceFileConfiguration,SourceFileConfigurationItem,Version,WorkspaceBrowseConfiguration}from'vscode-cpptools';
3030
import{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';
3232
import{LanguageClient,ServerOptions}from'vscode-languageclient/node';
3333
import*asnlsfrom'vscode-nls';
3434
import{DebugConfigurationProvider}from'../Debugger/configurationProvider';
@@ -590,6 +590,18 @@ export interface CopilotCompletionContextParams {
590590
doAggregateSnippets:boolean;
591591
}
592592

593+
exportinterfaceTextDocumentItemWithOriginalEncoding{
594+
uri:string;
595+
languageId:string;
596+
version:number;
597+
text:string;
598+
originalEncoding:string;
599+
}
600+
601+
exportinterfaceDidOpenTextDocumentParamsWithOriginalEncoding{
602+
textDocument:TextDocumentItemWithOriginalEncoding;
603+
}
604+
593605
// Requests
594606
constPreInitializationRequest:RequestType<void,string,void>=newRequestType<void,string,void>('cpptools/preinitialize');
595607
constInitializationRequest:RequestType<CppInitializationParams,CppInitializationResult,void>=newRequestType<CppInitializationParams,CppInitializationResult,void>('cpptools/initialize');
@@ -614,7 +626,7 @@ const CppContextRequest: RequestType<TextDocumentIdentifier, ChatContextResult,
614626
constCopilotCompletionContextRequest:RequestType<CopilotCompletionContextParams,CopilotCompletionContextResult,void>=newRequestType<CopilotCompletionContextParams,CopilotCompletionContextResult,void>('cpptools/getCompletionContext');
615627

616628
// Notifications to the server
617-
constDidOpenNotification:NotificationType<DidOpenTextDocumentParams>=newNotificationType<DidOpenTextDocumentParams>('textDocument/didOpen');
629+
constDidOpenNotification:NotificationType<DidOpenTextDocumentParamsWithOriginalEncoding>=newNotificationType<DidOpenTextDocumentParamsWithOriginalEncoding>('cpptools/didOpen');
618630
constFileCreatedNotification:NotificationType<FileChangedParams>=newNotificationType<FileChangedParams>('cpptools/fileCreated');
619631
constFileChangedNotification:NotificationType<FileChangedParams>=newNotificationType<FileChangedParams>('cpptools/fileChanged');
620632
constFileDeletedNotification:NotificationType<FileChangedParams>=newNotificationType<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).
23292341
publicasyncsendDidOpen(document:vscode.TextDocument):Promise<void>{
2330-
constparams:DidOpenTextDocumentParams={
2342+
constparams:DidOpenTextDocumentParamsWithOriginalEncoding={
23312343
textDocument:{
23322344
uri:document.uri.toString(),
23332345
languageId:document.languageId,
23342346
version:document.version,
2335-
text:document.getText()
2347+
text:document.getText(),
2348+
originalEncoding:document.encoding
23362349
}
23372350
};
23382351
awaitthis.ready;

‎Extension/src/LanguageServer/protocolFilter.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const ServerCancelled: number = -32802;
1919

2020
exportfunctioncreateProtocolFilter():Middleware{
2121
return{
22-
didOpen:async(document,sendMessage)=>{
22+
didOpen:async(document,_sendMessage)=>{
2323
if(!util.isCpp(document)){
2424
return;
2525
}
@@ -44,8 +44,8 @@ export function createProtocolFilter(): Middleware {
4444
}
4545
// client.takeOwnership() will call client.TrackedDocuments.add() again, but that's ok. It's a Set.
4646
client.takeOwnership(document);
47-
voidsendMessage(document);
4847
client.ready.then(()=>{
48+
client.sendDidOpen(document).catch(logAndReturn.undefined);
4949
constcppEditors:vscode.TextEditor[]=vscode.window.visibleTextEditors.filter(e=>util.isCpp(e.document));
5050
client.onDidChangeVisibleTextEditors(cppEditors).catch(logAndReturn.undefined);
5151
}).catch(logAndReturn.undefined);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp