diff --git a/Extension/cpptools.json b/Extension/cpptools.json index af505dc67c..9e72e62ee3 100644 --- a/Extension/cpptools.json +++ b/Extension/cpptools.json @@ -4,5 +4,5 @@ "recursiveIncludes": 100, "gotoDefIntelliSense": 100, "enhancedColorization": 100, - "minimumVSCodeVersion": "1.49.0" + "minimumVSCodeVersion": "1.52.0" } \ No newline at end of file diff --git a/Extension/package.json b/Extension/package.json index 924df004b8..265964ee67 100644 --- a/Extension/package.json +++ b/Extension/package.json @@ -11,7 +11,7 @@ }, "license": "SEE LICENSE IN LICENSE.txt", "engines": { - "vscode": "^1.49.0" + "vscode": "^1.52.0" }, "bugs": { "url": "https://github.com/Microsoft/vscode-cpptools/issues", @@ -2276,7 +2276,7 @@ "property.static": [ "variable.other.property.static" ], - "member.static": [ + "method.static": [ "entity.name.function.member.static" ], "macro": [ @@ -2352,7 +2352,7 @@ "@types/plist": "^3.0.2", "@types/semver": "^7.1.0", "@types/tmp": "^0.1.0", - "@types/vscode": "1.49.0", + "@types/vscode": "1.52.0", "@types/webpack": "^4.39.0", "@types/which": "^1.3.2", "@types/yauzl": "^2.9.1", @@ -2679,4 +2679,4 @@ "integrity": "CF1A01AA75275F76800F6BC1D289F2066DCEBCD983376D344ABF6B03FDB8FEA0" } ] -} +} \ No newline at end of file diff --git a/Extension/src/LanguageServer/Providers/foldingRangeProvider.ts b/Extension/src/LanguageServer/Providers/foldingRangeProvider.ts index 4ee4a908f5..e79a996644 100644 --- a/Extension/src/LanguageServer/Providers/foldingRangeProvider.ts +++ b/Extension/src/LanguageServer/Providers/foldingRangeProvider.ts @@ -7,8 +7,11 @@ import { DefaultClient, GetFoldingRangesParams, GetFoldingRangesRequest, Folding export class FoldingRangeProvider implements vscode.FoldingRangeProvider { private client: DefaultClient; + public onDidChangeFoldingRangesEvent = new vscode.EventEmitter(); + public onDidChangeFoldingRanges?: vscode.Event; constructor(client: DefaultClient) { this.client = client; + this.onDidChangeFoldingRanges = this.onDidChangeFoldingRangesEvent.event; } provideFoldingRanges(document: vscode.TextDocument, context: vscode.FoldingContext, token: vscode.CancellationToken): Promise { @@ -52,4 +55,8 @@ export class FoldingRangeProvider implements vscode.FoldingRangeProvider { }); }); } + + public refresh(): void { + this.onDidChangeFoldingRangesEvent.fire(); + } } diff --git a/Extension/src/LanguageServer/client.ts b/Extension/src/LanguageServer/client.ts index 361867f9e5..9087b726b5 100644 --- a/Extension/src/LanguageServer/client.ts +++ b/Extension/src/LanguageServer/client.ts @@ -399,7 +399,7 @@ enum SemanticTokenTypes { referenceType = 5, valueType = 6, function = 7, - member = 8, + method = 8, property = 9, cliProperty = 10, event = 11, @@ -606,6 +606,7 @@ export class DefaultClient implements Client { private documentFormattingProviderDisposable: vscode.Disposable | undefined; private formattingRangeProviderDisposable: vscode.Disposable | undefined; private onTypeFormattingProviderDisposable: vscode.Disposable | undefined; + private codeFoldingProvider: FoldingRangeProvider | undefined; private codeFoldingProviderDisposable: vscode.Disposable | undefined; private semanticTokensProvider: SemanticTokensProvider | undefined; private semanticTokensProviderDisposable: vscode.Disposable | undefined; @@ -838,7 +839,8 @@ export class DefaultClient implements Client { this.onTypeFormattingProviderDisposable = vscode.languages.registerOnTypeFormattingEditProvider(this.documentSelector, new OnTypeFormattingEditProvider(this), ";", "}", "\n"); } if (settings.codeFolding) { - this.codeFoldingProviderDisposable = vscode.languages.registerFoldingRangeProvider(this.documentSelector, new FoldingRangeProvider(this)); + this.codeFoldingProvider = new FoldingRangeProvider(this); + this.codeFoldingProviderDisposable = vscode.languages.registerFoldingRangeProvider(this.documentSelector, this.codeFoldingProvider); } if (settings.enhancedColorization && this.semanticTokensLegend) { this.semanticTokensProvider = new SemanticTokensProvider(this); @@ -1347,16 +1349,18 @@ export class DefaultClient implements Client { } if (changedSettings["codeFolding"]) { if (settings.codeFolding) { - this.codeFoldingProviderDisposable = vscode.languages.registerFoldingRangeProvider(this.documentSelector, new FoldingRangeProvider(this)); + this.codeFoldingProvider = new FoldingRangeProvider(this); + this.codeFoldingProviderDisposable = vscode.languages.registerFoldingRangeProvider(this.documentSelector, this.codeFoldingProvider); } else if (this.codeFoldingProviderDisposable) { this.codeFoldingProviderDisposable.dispose(); this.codeFoldingProviderDisposable = undefined; + this.codeFoldingProvider = undefined; } } if (changedSettings["enhancedColorization"]) { if (settings.enhancedColorization && this.semanticTokensLegend) { this.semanticTokensProvider = new SemanticTokensProvider(this); - this.semanticTokensProviderDisposable = vscode.languages.registerDocumentSemanticTokensProvider(this.documentSelector, new SemanticTokensProvider(this), this.semanticTokensLegend); ; + this.semanticTokensProviderDisposable = vscode.languages.registerDocumentSemanticTokensProvider(this.documentSelector, this.semanticTokensProvider, this.semanticTokensLegend); ; } else if (this.semanticTokensProviderDisposable) { this.semanticTokensProviderDisposable.dispose(); this.semanticTokensProviderDisposable = undefined; @@ -2162,6 +2166,9 @@ export class DefaultClient implements Client { } } } + if (this.codeFoldingProvider) { + this.codeFoldingProvider.refresh(); + } } public logIntellisenseSetupTime(notification: IntelliSenseSetup): void { diff --git a/Extension/yarn.lock b/Extension/yarn.lock index 3b88a15962..46520202e6 100644 --- a/Extension/yarn.lock +++ b/Extension/yarn.lock @@ -204,10 +204,10 @@ dependencies: source-map "^0.6.1" -"@types/vscode@1.49.0": - version "1.49.0" - resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.49.0.tgz#f3731d97d7e8b2697510eb26f6e6d04ee8c17352" - integrity sha512-wfNQmLmm1VdMBr6iuNdprWmC1YdrgZ9dQzadv+l2eSjJlElOdJw8OTm4RU4oGTBcfvG6RZI2jOcppkdSS18mZw== +"@types/vscode@1.52.0": + version "1.52.0" + resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.52.0.tgz#61917968dd403932127fc4004a21fd8d69e4f61c" + integrity sha512-Kt3bvWzAvvF/WH9YEcrCICDp0Z7aHhJGhLJ1BxeyNP6yRjonWqWnAIh35/pXAjswAnWOABrYlF7SwXR9+1nnLA== "@types/webpack-sources@*": version "0.1.6"