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

Commitf73a5d1

Browse files
Use cpptools API v5 (microsoft#6823)
1 parent5f94a64 commitf73a5d1

File tree

5 files changed

+35
-25
lines changed

5 files changed

+35
-25
lines changed

‎Extension/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2450,7 +2450,7 @@
24502450
"mkdirp":"^0.5.1",
24512451
"plist":"^3.0.1",
24522452
"tmp":"^0.1.0",
2453-
"vscode-cpptools":"^4.0.1",
2453+
"vscode-cpptools":"^5.0.0",
24542454
"vscode-extension-telemetry":"^0.1.2",
24552455
"vscode-languageclient":"^5.2.1",
24562456
"vscode-nls":"^4.1.1",

‎Extension/src/LanguageServer/client.ts‎

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,7 +1702,7 @@ export class DefaultClient implements Client {
17021702
returnthis.callTaskWithTimeout(provideConfigurationAsync,configProviderTimeout,tokenSource).then(
17031703
(configs?:SourceFileConfigurationItem[]|null)=>{
17041704
if(configs&&configs.length>0){
1705-
this.sendCustomConfigurations(configs);
1705+
this.sendCustomConfigurations(configs,provider.version);
17061706
}
17071707
onFinished();
17081708
},
@@ -2364,19 +2364,24 @@ export class DefaultClient implements Client {
23642364
this.notifyWhenReady(()=>this.languageClient.sendNotification(ChangeCompileCommandsNotification,params));
23652365
}
23662366

2367-
privateisSourceFileConfigurationItem(input:any):input isSourceFileConfigurationItem{
2367+
privateisSourceFileConfigurationItem(input:any,providerVersion:Version):input isSourceFileConfigurationItem{
2368+
// IntelliSenseMode and standard are optional for version 5+. However, they are required when compilerPath is not defined.
2369+
letareOptionalsValid:boolean=false;
2370+
if(providerVersion<Version.v5||input.configuration.compilerPath===undefined){
2371+
areOptionalsValid=util.isString(input.configuration.intelliSenseMode)&&util.isString(input.configuration.standard);
2372+
}elseif(util.isString(input.configuration.compilerPath)){
2373+
areOptionalsValid=util.isOptionalString(input.configuration.intelliSenseMode)&&util.isOptionalString(input.configuration.standard);
2374+
}
23682375
return(input&&(util.isString(input.uri)||util.isUri(input.uri))&&
23692376
input.configuration&&
2377+
areOptionalsValid&&
23702378
util.isArrayOfString(input.configuration.includePath)&&
23712379
util.isArrayOfString(input.configuration.defines)&&
2372-
util.isString(input.configuration.intelliSenseMode)&&
2373-
util.isString(input.configuration.standard)&&
2374-
util.isOptionalString(input.configuration.compilerPath)&&
23752380
util.isOptionalArrayOfString(input.configuration.compilerArgs)&&
23762381
util.isOptionalArrayOfString(input.configuration.forcedInclude));
23772382
}
23782383

2379-
privatesendCustomConfigurations(configs:any):void{
2384+
privatesendCustomConfigurations(configs:any,providerVersion:Version):void{
23802385
// 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.
23812386
if(!configs||!(configsinstanceofArray)){
23822387
console.warn("discarding invalid SourceFileConfigurationItems[]: "+configs);
@@ -2390,7 +2395,7 @@ export class DefaultClient implements Client {
23902395
}
23912396
constsanitized:SourceFileConfigurationItemAdapter[]=[];
23922397
configs.forEach(item=>{
2393-
if(this.isSourceFileConfigurationItem(item)){
2398+
if(this.isSourceFileConfigurationItem(item,providerVersion)){
23942399
this.configurationLogging.set(item.uri.toString(),JSON.stringify(item.configuration,null,4));
23952400
if(settings.loggingLevel==="Debug"){
23962401
out.appendLine(` uri:${item.uri.toString()}`);
@@ -2432,6 +2437,15 @@ export class DefaultClient implements Client {
24322437
privatebrowseConfigurationLogging:string="";
24332438
privateconfigurationLogging:Map<string,string>=newMap<string,string>();
24342439

2440+
privateisWorkspaceBrowseConfiguration(input:any):boolean{
2441+
constareOptionalsValid:boolean=(input.compilerPath===undefined&&util.isString(input.standard))||
2442+
(util.isString(input.compilerPath)&&util.isOptionalString(input.standard));
2443+
returnareOptionalsValid&&
2444+
util.isArrayOfString(input.browsePath)&&
2445+
util.isOptionalString(input.compilerArgs)&&
2446+
util.isOptionalString(input.windowsSdkVersion);
2447+
}
2448+
24352449
privatesendCustomBrowseConfiguration(config:any,providerId?:string,timeoutOccured?:boolean):void{
24362450
constrootFolder:vscode.WorkspaceFolder|undefined=this.RootFolder;
24372451
if(!rootFolder){
@@ -2461,11 +2475,7 @@ export class DefaultClient implements Client {
24612475
}
24622476

24632477
sanitized={...<WorkspaceBrowseConfiguration>config};
2464-
if(!util.isArrayOfString(sanitized.browsePath)||
2465-
!util.isOptionalString(sanitized.compilerPath)||
2466-
!util.isOptionalArrayOfString(sanitized.compilerArgs)||
2467-
!util.isOptionalString(sanitized.standard)||
2468-
!util.isOptionalString(sanitized.windowsSdkVersion)){
2478+
if(!this.isWorkspaceBrowseConfiguration(sanitized)){
24692479
console.log("Received an invalid browse configuration from configuration provider.");
24702480
constconfigValue:WorkspaceBrowseConfiguration|undefined=lastCustomBrowseConfiguration.Value;
24712481
if(configValue){

‎Extension/src/LanguageServer/configurations.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -481,18 +481,18 @@ export class CppProperties {
481481
privategetIntelliSenseModeForPlatform(name?:string):string{
482482
// Do the built-in configs first.
483483
if(name==="Linux"){
484-
return"gcc-x64";
484+
return"linux-gcc-x64";
485485
}elseif(name==="Mac"){
486-
return"clang-x64";
486+
return"macos-clang-x64";
487487
}elseif(name==="Win32"){
488-
return"msvc-x64";
488+
return"windows-msvc-x64";
489489
}elseif(process.platform==='win32'){
490490
// Custom configs default to the OS's preference.
491-
return"msvc-x64";
491+
return"windows-msvc-x64";
492492
}elseif(process.platform==='darwin'){
493-
return"clang-x64";
493+
return"macos-clang-x64";
494494
}else{
495-
return"gcc-x64";
495+
return"linux-gcc-x64";
496496
}
497497
}
498498

‎Extension/src/LanguageServer/customProviders.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class CustomProviderWrapper implements CustomConfigurationProvider1 {
8383
returnthis._version<Version.v2 ?Promise.resolve(false) :this.provider.canProvideBrowseConfiguration(token);
8484
}
8585

86-
publicprovideBrowseConfiguration(token?:vscode.CancellationToken):Thenable<WorkspaceBrowseConfiguration>{
86+
publicprovideBrowseConfiguration(token?:vscode.CancellationToken):Thenable<WorkspaceBrowseConfiguration|null>{
8787
console.assert(this._version>=Version.v2);
8888
returnthis._version<Version.v2 ?Promise.resolve({browsePath:[]}) :this.provider.provideBrowseConfiguration(token);
8989
}
@@ -92,7 +92,7 @@ class CustomProviderWrapper implements CustomConfigurationProvider1 {
9292
returnthis._version<Version.v3 ?Promise.resolve(false) :this.provider.canProvideBrowseConfigurationsPerFolder(token);
9393
}
9494

95-
publicprovideFolderBrowseConfiguration(uri:vscode.Uri,token?:vscode.CancellationToken):Thenable<WorkspaceBrowseConfiguration>{
95+
publicprovideFolderBrowseConfiguration(uri:vscode.Uri,token?:vscode.CancellationToken):Thenable<WorkspaceBrowseConfiguration|null>{
9696
console.assert(this._version>=Version.v3);
9797
returnthis._version<Version.v3 ?Promise.resolve({browsePath:[]}) :this.provider.provideFolderBrowseConfiguration(uri,token);
9898
}

‎Extension/yarn.lock‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5631,10 +5631,10 @@ vm-browserify@^1.0.1:
56315631
resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0"
56325632
integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==
56335633

5634-
vscode-cpptools@^4.0.1:
5635-
version "4.0.1"
5636-
resolved "https://registry.yarnpkg.com/vscode-cpptools/-/vscode-cpptools-4.0.1.tgz#7e591572b437a6aca47b767487b52bc253e6d911"
5637-
integrity sha512-2IjtWe7rjIp20J+5m0Yjpa8TjGhdQWChwE49iYJBUUTHFqJDFq0aXNAyiDNw6BDWI1Q2Z/gmeQGsJBoxTb0J0Q==
5634+
vscode-cpptools@^5.0.0:
5635+
version "5.0.0"
5636+
resolved "https://registry.yarnpkg.com/vscode-cpptools/-/vscode-cpptools-5.0.0.tgz#f1195736af1cfa10727482be57093a3997c8f63b"
5637+
integrity sha512-TPG6/o9+DisDj2U4AiTOihtfjEzBb/4CErYaB1JIWFMZTQE7zlNTdsgCs+l4xIS2Y34us0RMBIC6On1mBuwxww==
56385638

56395639
vscode-debugadapter@^1.35.0:
56405640
version "1.38.0"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp