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

Commitbf7287e

Browse files
committed
2 parents63ce035 +3b6dc61 commitbf7287e

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

‎Extension/src/LanguageServer/client.ts‎

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export interface Client {
169169
activeDocumentChanged(document:vscode.TextDocument):void;
170170
activate():void;
171171
selectionChanged(selection:vscode.Position):void;
172-
sendCustomConfigurations(configs:SourceFileConfigurationItem[]):void;
172+
sendCustomConfigurations(configs:any):void;
173173
resetDatabase():void;
174174
deactivate():void;
175175
pauseParsing():void;
@@ -997,9 +997,27 @@ class DefaultClient implements Client {
997997
this.notifyWhenReady(()=>this.languageClient.sendNotification(ChangeCompileCommandsNotification,params));
998998
}
999999

1000-
publicsendCustomConfigurations(configs:SourceFileConfigurationItem[]):void{
1000+
publicsendCustomConfigurations(configs:any):void{
1001+
// configs is marked as 'any' because it is untrusted data coming from a 3rd-party. We need to sanitize it before sending it to the language server.
1002+
if(!configs||!(configsinstanceofArray)){
1003+
return;
1004+
}
1005+
letsanitized:SourceFileConfigurationItem[]=<SourceFileConfigurationItem[]>configs;
1006+
sanitized=sanitized.filter(item=>{
1007+
if(item&&item.uri&&item.configuration&&
1008+
item.configuration.includePath&&item.configuration.defines&&item.configuration.intelliSenseMode&&item.configuration.standard){
1009+
returntrue;
1010+
}
1011+
console.warn("discarding invalid SourceFileConfigurationItem: "+item);
1012+
returnfalse;
1013+
});
1014+
1015+
if(sanitized.length===0){
1016+
return;
1017+
}
1018+
10011019
letparams:CustomConfigurationParams={
1002-
configurationItems:configs
1020+
configurationItems:sanitized
10031021
};
10041022
this.notifyWhenReady(()=>this.languageClient.sendNotification(CustomConfigurationNotification,params));
10051023
}
@@ -1104,7 +1122,7 @@ class NullClient implements Client {
11041122
queueTaskWithTimeout(task:()=>Thenable<any>,ms:number,tokenSource?:CancellationTokenSource):Thenable<any>{returntask();}
11051123
requestWhenReady(request:()=>Thenable<any>):Thenable<any>{return;}
11061124
notifyWhenReady(notify:()=>void):void{}
1107-
sendCustomConfigurations(configs:SourceFileConfigurationItem[]):void{}
1125+
sendCustomConfigurations(configs:any):void{}
11081126
requestGoToDeclaration():Thenable<void>{returnPromise.resolve();}
11091127
requestSwitchHeaderSource(rootPath:string,fileName:string):Thenable<string>{returnPromise.resolve("");}
11101128
requestNavigationList(document:vscode.TextDocument):Thenable<string>{returnPromise.resolve("");}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp