Compare commits
151
Commits
localization
...
v1.26.5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff2fb7eb65 | ||
|
|
a1fa61e73f | ||
|
|
42f7302d6b | ||
|
|
af326bd298 | ||
|
|
b50bf604fd | ||
|
|
f4f3d8ca8b | ||
|
|
303b838a41 | ||
|
|
36cea36784 | ||
|
|
e4f859dd56 | ||
|
|
97c5f14bd5 | ||
|
|
c4003c07e8 | ||
|
|
c27806e763 | ||
|
|
7cfb2d3316 | ||
|
|
9a03b747c6 | ||
|
|
989cee4414 | ||
|
|
c357224407 | ||
|
|
a636c87f3e | ||
|
|
471cdfecf8 | ||
|
|
97128122b0 | ||
|
|
006ebff619 | ||
|
|
1458694ed6 | ||
|
|
896024ba9c | ||
|
|
779bb080c1 | ||
|
|
97df273fc1 | ||
|
|
7037b070ce | ||
|
|
205e63772c | ||
|
|
e7dff799fd | ||
|
|
ec41c3e481 | ||
|
|
71cf89ce70 | ||
|
|
f7863066f3 | ||
|
|
0c2862c379 | ||
|
|
6026c84c6f | ||
|
|
e3ee2ee76a | ||
|
|
ff1cd88466 | ||
|
|
98696368f4 | ||
|
|
99d98afcec | ||
|
|
784f1450c0 | ||
|
|
7d26dd1c4f | ||
|
|
37950ffb2d | ||
|
|
23b0672837 | ||
|
|
7bafd64cfe | ||
|
|
381d69646b | ||
|
|
bfa36bc662 | ||
|
|
5cbe83ec44 | ||
|
|
dead10ac8a | ||
|
|
ce20613f24 | ||
|
|
86c6c10f18 | ||
|
|
db6e0cb5cf | ||
|
|
f9e067f5d1 | ||
|
|
b137df0bcd | ||
|
|
827db55084 | ||
|
|
8a2324daaa | ||
|
|
d41ccfd497 | ||
|
|
bdd3541f28 | ||
|
|
c8b7f13c1a | ||
|
|
8d0d3601a7 | ||
|
|
e9613ae7ad | ||
|
|
3570705b5c | ||
|
|
096b1463a6 | ||
|
|
812318163d | ||
|
|
225b776d99 | ||
|
|
12d95f4708 | ||
|
|
317df57496 | ||
|
|
f63c3652f8 | ||
|
|
5d62607760 | ||
|
|
26d0932972 | ||
|
|
3cc2650dfa | ||
|
|
fdf9b5bfe0 | ||
|
|
fdd71bc963 | ||
|
|
1d266a9c0e | ||
|
|
f818529a08 | ||
|
|
41a05a90c8 | ||
|
|
e59c6ca759 | ||
|
|
287ee3961b | ||
|
|
8a8fd883ac | ||
|
|
4fe56500a9 | ||
|
|
03911153f9 | ||
|
|
acea31e572 | ||
|
|
bf21e01764 | ||
|
|
30f1361d23 | ||
|
|
825033f768 | ||
|
|
d8426caacc | ||
|
|
8942530744 | ||
|
|
e663939e56 | ||
|
|
1fb5b63ab7 | ||
|
|
03933b0a74 | ||
|
|
fc8eb8632f | ||
|
|
f6722bc8ff | ||
|
|
894db52405 | ||
|
|
abf384619d | ||
|
|
fd482d2169 | ||
|
|
2fafd831e5 | ||
|
|
1ceae9d4ed | ||
|
|
d4d5d4551f | ||
|
|
0ef77b5616 | ||
|
|
efdc8e90f6 | ||
|
|
9f020e9258 | ||
|
|
c058568767 | ||
|
|
8809e69e91 | ||
|
|
7af5c40dd0 | ||
|
|
1d2bd10691 | ||
|
|
dac96fe852 | ||
|
|
a1487e5e79 | ||
|
|
6f19496172 | ||
|
|
ad5d6de4ea | ||
|
|
153e232f2d | ||
|
|
bcd4a7f025 | ||
|
|
3c3d463a81 | ||
|
|
92691929ed | ||
|
|
86a41c9021 | ||
|
|
a71c90c140 | ||
|
|
1d28851ef7 | ||
|
|
1aced54699 | ||
|
|
a8cf39c8b4 | ||
|
|
e037b95926 | ||
|
|
af7f6ce52e | ||
|
|
9a18982440 | ||
|
|
35bf4c8b0f | ||
|
|
23446558cf | ||
|
|
76ccb791ff | ||
|
|
a5a5735089 | ||
|
|
5077edf585 | ||
|
|
f38926f8b1 | ||
|
|
30de9bcc27 | ||
|
|
100e2e0828 | ||
|
|
e3b41771c6 | ||
|
|
3f7f3090f6 | ||
|
|
4149493f2c | ||
|
|
43aad3f65c | ||
|
|
bedcacb0a1 | ||
|
|
a5f8f84b43 | ||
|
|
e53b190380 | ||
|
|
1846fd4001 | ||
|
|
62e09945e3 | ||
|
|
c9b0db02fd | ||
|
|
51da619eec | ||
|
|
3eb50568e9 | ||
|
|
866b145645 | ||
|
|
9762fe5397 | ||
|
|
377896c30a | ||
|
|
98f13a6f11 | ||
|
|
0d85aea687 | ||
|
|
25d2b76514 | ||
|
|
42dfef3f6b | ||
|
|
1ce1e9cd71 | ||
|
|
65163966d5 | ||
|
|
edf8e0a155 | ||
|
|
4083075476 | ||
|
|
b745ebc218 | ||
|
|
b69d17a0f5 | ||
|
|
be8b6fb693 |
@@ -1,5 +1,15 @@
|
||||
# C/C++ for Visual Studio Code Changelog
|
||||
|
||||
## Version 1.26.5: September 10, 2025
|
||||
### Bug Fix
|
||||
* Fix extension activation getting stuck by GitHub Copilot activation. [#13914](https://github.com/microsoft/vscode-cpptools/issues/13914)
|
||||
* Thank you for the contribution. [@dbaeumer (Dirk Bäumer)](https://github.com/dbaeumer) [PR #13918](https://github.com/microsoft/vscode-cpptools/pull/13918)
|
||||
|
||||
## Version 1.26.4: September 8, 2025
|
||||
### Enhancement
|
||||
* Update GitHub Copilot APIs. [PR #13877](https://github.com/microsoft/vscode-cpptools/pull/13877)
|
||||
* Thank you for the contribution. [@dbaeumer (Dirk Bäumer)](https://github.com/dbaeumer)
|
||||
|
||||
## Version 1.26.3: June 24, 2025
|
||||
### New Feature
|
||||
* Improve the context provided for C++ Copilot suggestions.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "cpptools",
|
||||
"displayName": "C/C++",
|
||||
"description": "C/C++ IntelliSense, debugging, and code browsing.",
|
||||
"version": "1.26.3-main",
|
||||
"version": "1.26.5-main",
|
||||
"publisher": "ms-vscode",
|
||||
"icon": "LanguageCCPP_color_128x.png",
|
||||
"readme": "README.md",
|
||||
|
||||
@@ -59,7 +59,7 @@ import { CopilotCompletionContextFeatures, CopilotCompletionContextProvider } fr
|
||||
import { CustomConfigurationProvider1, getCustomConfigProviders, isSameProviderExtensionId } from './customProviders';
|
||||
import { DataBinding } from './dataBinding';
|
||||
import { cachedEditorConfigSettings, getEditorConfigSettings } from './editorConfig';
|
||||
import { CppSourceStr, clients, configPrefix, initializeIntervalTimer, updateLanguageConfigurations, usesCrashHandler, watchForCrashes } from './extension';
|
||||
import { CppSourceStr, clients, configPrefix, initializeIntervalTimer, isWritingCrashCallStack, updateLanguageConfigurations, usesCrashHandler, watchForCrashes } from './extension';
|
||||
import { LocalizeStringParams, getLocaleId, getLocalizedString } from './localization';
|
||||
import { PersistentFolderState, PersistentState, PersistentWorkspaceState } from './persistentState';
|
||||
import { RequestCancelled, ServerCancelled, createProtocolFilter } from './protocolFilter';
|
||||
@@ -942,6 +942,8 @@ export class DefaultClient implements Client {
|
||||
public getShowConfigureIntelliSenseButton(): boolean { return this.showConfigureIntelliSenseButton; }
|
||||
public setShowConfigureIntelliSenseButton(show: boolean): void { this.showConfigureIntelliSenseButton = show; }
|
||||
|
||||
private lastInvokedLspMessage: string = ""; // e.g. cpptools/hover
|
||||
|
||||
/**
|
||||
* don't use this.rootFolder directly since it can be undefined
|
||||
*/
|
||||
@@ -1677,7 +1679,6 @@ export class DefaultClient implements Client {
|
||||
closed: () => {
|
||||
languageClientCrashTimes.push(Date.now());
|
||||
languageClientCrashedNeedsRestart = true;
|
||||
telemetry.logLanguageServerEvent("languageClientCrash");
|
||||
let restart: boolean = true;
|
||||
if (languageClientCrashTimes.length < 5) {
|
||||
void clients.recreateClients();
|
||||
@@ -1691,6 +1692,27 @@ export class DefaultClient implements Client {
|
||||
void clients.recreateClients();
|
||||
}
|
||||
}
|
||||
|
||||
// Wait 1 second to allow time for the file watcher to signal a crash call stack write has occurred.
|
||||
setTimeout(() => {
|
||||
const sanitizedLspMessage = this.lastInvokedLspMessage.replace('/', '.');
|
||||
telemetry.logLanguageServerEvent("languageClientCrash",
|
||||
{
|
||||
lastInvokedLspMessage: sanitizedLspMessage
|
||||
},
|
||||
{
|
||||
restarting: Number(restart),
|
||||
writingCrashCallStack: Number(isWritingCrashCallStack),
|
||||
initializingWorkspace: Number(this.model.isInitializingWorkspace.Value),
|
||||
indexingWorkspace: Number(this.model.isIndexingWorkspace.Value),
|
||||
parsingWorkspace: Number(this.model.isParsingWorkspace.Value),
|
||||
parsingFiles: Number(this.model.isParsingFiles.Value),
|
||||
updatingIntelliSense: Number(this.model.isUpdatingIntelliSense.Value),
|
||||
runningCodeAnalysis: Number(this.model.isRunningCodeAnalysis.Value)
|
||||
}
|
||||
);
|
||||
}, 1000);
|
||||
|
||||
const message: string = restart ? localize('server.crashed.restart', 'The language server crashed. Restarting...')
|
||||
: localize('server.crashed2', 'The language server crashed 5 times in the last 3 minutes. It will not be restarted.');
|
||||
|
||||
@@ -2747,55 +2769,59 @@ export class DefaultClient implements Client {
|
||||
const message: string = notificationBody.status;
|
||||
util.setProgress(util.getProgressExecutableSuccess());
|
||||
const testHook: TestHook = getTestHook();
|
||||
if (message.endsWith("Idle")) {
|
||||
const status: IntelliSenseStatus = { status: Status.Idle };
|
||||
testHook.updateStatus(status);
|
||||
} else if (message.endsWith("Parsing")) {
|
||||
this.model.isParsingWorkspace.Value = true;
|
||||
this.model.isInitializingWorkspace.Value = false;
|
||||
this.model.isIndexingWorkspace.Value = false;
|
||||
const status: IntelliSenseStatus = { status: Status.TagParsingBegun };
|
||||
testHook.updateStatus(status);
|
||||
} else if (message.endsWith("Initializing")) {
|
||||
this.model.isInitializingWorkspace.Value = true;
|
||||
this.model.isIndexingWorkspace.Value = false;
|
||||
this.model.isParsingWorkspace.Value = false;
|
||||
} else if (message.endsWith("Indexing")) {
|
||||
this.model.isIndexingWorkspace.Value = true;
|
||||
this.model.isInitializingWorkspace.Value = false;
|
||||
this.model.isParsingWorkspace.Value = false;
|
||||
} else if (message.endsWith("files")) {
|
||||
this.model.isParsingFiles.Value = true;
|
||||
} else if (message.endsWith("IntelliSense")) {
|
||||
timeStamp = Date.now();
|
||||
this.model.isUpdatingIntelliSense.Value = true;
|
||||
const status: IntelliSenseStatus = { status: Status.IntelliSenseCompiling };
|
||||
testHook.updateStatus(status);
|
||||
} else if (message.endsWith("IntelliSense done")) {
|
||||
getOutputChannelLogger().appendLineAtLevel(6, localize("update.intellisense.time", "Update IntelliSense time (sec): {0}", (Date.now() - timeStamp) / 1000));
|
||||
this.model.isUpdatingIntelliSense.Value = false;
|
||||
const status: IntelliSenseStatus = { status: Status.IntelliSenseReady };
|
||||
testHook.updateStatus(status);
|
||||
} else if (message.endsWith("Parsing done")) { // Tag Parser Ready
|
||||
this.model.isParsingWorkspace.Value = false;
|
||||
const status: IntelliSenseStatus = { status: Status.TagParsingDone };
|
||||
testHook.updateStatus(status);
|
||||
util.setProgress(util.getProgressParseRootSuccess());
|
||||
} else if (message.endsWith("files done")) {
|
||||
this.model.isParsingFiles.Value = false;
|
||||
} else if (message.endsWith("Analysis")) {
|
||||
this.model.isRunningCodeAnalysis.Value = true;
|
||||
this.model.codeAnalysisTotal.Value = 1;
|
||||
this.model.codeAnalysisProcessed.Value = 0;
|
||||
} else if (message.endsWith("Analysis done")) {
|
||||
this.model.isRunningCodeAnalysis.Value = false;
|
||||
} else if (message.includes("Squiggles Finished - File name:")) {
|
||||
const index: number = message.lastIndexOf(":");
|
||||
const name: string = message.substring(index + 2);
|
||||
const status: IntelliSenseStatus = { status: Status.IntelliSenseReady, filename: name };
|
||||
testHook.updateStatus(status);
|
||||
} else if (message.endsWith("No Squiggles")) {
|
||||
util.setIntelliSenseProgress(util.getProgressIntelliSenseNoSquiggles());
|
||||
if (message.startsWith("C_Cpp: ")) {
|
||||
if (message.endsWith("Idle")) {
|
||||
const status: IntelliSenseStatus = { status: Status.Idle };
|
||||
testHook.updateStatus(status);
|
||||
} else if (message.endsWith("Parsing")) {
|
||||
this.model.isParsingWorkspace.Value = true;
|
||||
this.model.isInitializingWorkspace.Value = false;
|
||||
this.model.isIndexingWorkspace.Value = false;
|
||||
const status: IntelliSenseStatus = { status: Status.TagParsingBegun };
|
||||
testHook.updateStatus(status);
|
||||
} else if (message.endsWith("Initializing")) {
|
||||
this.model.isInitializingWorkspace.Value = true;
|
||||
this.model.isIndexingWorkspace.Value = false;
|
||||
this.model.isParsingWorkspace.Value = false;
|
||||
} else if (message.endsWith("Indexing")) {
|
||||
this.model.isIndexingWorkspace.Value = true;
|
||||
this.model.isInitializingWorkspace.Value = false;
|
||||
this.model.isParsingWorkspace.Value = false;
|
||||
} else if (message.endsWith("files")) {
|
||||
this.model.isParsingFiles.Value = true;
|
||||
} else if (message.endsWith("IntelliSense")) {
|
||||
timeStamp = Date.now();
|
||||
this.model.isUpdatingIntelliSense.Value = true;
|
||||
const status: IntelliSenseStatus = { status: Status.IntelliSenseCompiling };
|
||||
testHook.updateStatus(status);
|
||||
} else if (message.endsWith("IntelliSense done")) {
|
||||
getOutputChannelLogger().appendLineAtLevel(6, localize("update.intellisense.time", "Update IntelliSense time (sec): {0}", (Date.now() - timeStamp) / 1000));
|
||||
this.model.isUpdatingIntelliSense.Value = false;
|
||||
const status: IntelliSenseStatus = { status: Status.IntelliSenseReady };
|
||||
testHook.updateStatus(status);
|
||||
} else if (message.endsWith("Parsing done")) { // Tag Parser Ready
|
||||
this.model.isParsingWorkspace.Value = false;
|
||||
const status: IntelliSenseStatus = { status: Status.TagParsingDone };
|
||||
testHook.updateStatus(status);
|
||||
util.setProgress(util.getProgressParseRootSuccess());
|
||||
} else if (message.endsWith("files done")) {
|
||||
this.model.isParsingFiles.Value = false;
|
||||
} else if (message.endsWith("Analysis")) {
|
||||
this.model.isRunningCodeAnalysis.Value = true;
|
||||
this.model.codeAnalysisTotal.Value = 1;
|
||||
this.model.codeAnalysisProcessed.Value = 0;
|
||||
} else if (message.endsWith("Analysis done")) {
|
||||
this.model.isRunningCodeAnalysis.Value = false;
|
||||
} else if (message.includes("Squiggles Finished - File name:")) {
|
||||
const index: number = message.lastIndexOf(":");
|
||||
const name: string = message.substring(index + 2);
|
||||
const status: IntelliSenseStatus = { status: Status.IntelliSenseReady, filename: name };
|
||||
testHook.updateStatus(status);
|
||||
} else if (message.endsWith("No Squiggles")) {
|
||||
util.setIntelliSenseProgress(util.getProgressIntelliSenseNoSquiggles());
|
||||
}
|
||||
} else if (message.includes("/")) {
|
||||
this.lastInvokedLspMessage = message;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||
* See 'LICENSE' in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
import { ContextResolver, ResolveRequest, SupportedContextItem } from '@github/copilot-language-server';
|
||||
import { ContextResolver, ResolveRequest, SupportedContextItem, type ContextProvider } from '@github/copilot-language-server';
|
||||
import { randomUUID } from 'crypto';
|
||||
import * as vscode from 'vscode';
|
||||
import { DocumentSelector } from 'vscode-languageserver-protocol';
|
||||
@@ -11,7 +11,7 @@ import { getOutputChannelLogger, Logger } from '../logger';
|
||||
import * as telemetry from '../telemetry';
|
||||
import { CopilotCompletionContextResult } from './client';
|
||||
import { CopilotCompletionContextTelemetry } from './copilotCompletionContextTelemetry';
|
||||
import { getCopilotApi } from './copilotProviders';
|
||||
import { getCopilotChatApi, getCopilotClientApi, type CopilotContextProviderAPI } from './copilotProviders';
|
||||
import { clients } from './extension';
|
||||
import { CppSettings } from './settings';
|
||||
|
||||
@@ -83,7 +83,7 @@ export class CopilotCompletionContextProvider implements ContextResolver<Support
|
||||
private static readonly defaultMaxSnippetLength = 3 * 1024;
|
||||
private static readonly defaultDoAggregateSnippets = true;
|
||||
private completionContextCancellation = new vscode.CancellationTokenSource();
|
||||
private contextProviderDisposable: vscode.Disposable | undefined;
|
||||
private contextProviderDisposables: vscode.Disposable[] | undefined;
|
||||
static readonly CppContextProviderEnabledFeatures = 'enabledFeatures';
|
||||
static readonly CppContextProviderTimeBudgetMs = 'timeBudgetMs';
|
||||
static readonly CppContextProviderMaxSnippetCount = 'maxSnippetCount';
|
||||
@@ -312,7 +312,12 @@ export class CopilotCompletionContextProvider implements ContextResolver<Support
|
||||
|
||||
public dispose(): void {
|
||||
this.completionContextCancellation.cancel();
|
||||
this.contextProviderDisposable?.dispose();
|
||||
if (this.contextProviderDisposables) {
|
||||
for (const disposable of this.contextProviderDisposables) {
|
||||
disposable.dispose();
|
||||
}
|
||||
this.contextProviderDisposables = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
public removeFile(fileUri: string): void {
|
||||
@@ -444,18 +449,32 @@ ${copilotCompletionContext?.areSnippetsMissing ? "(missing code snippets)" : ""}
|
||||
const properties: Record<string, string> = {};
|
||||
const registerCopilotContextProvider = 'registerCopilotContextProvider';
|
||||
try {
|
||||
const copilotApi = await getCopilotApi();
|
||||
if (!copilotApi) { throw new CopilotContextProviderException("getCopilotApi() returned null, Copilot is missing or inactive."); }
|
||||
const hasGetContextProviderAPI = "getContextProviderAPI" in copilotApi;
|
||||
if (!hasGetContextProviderAPI) { throw new CopilotContextProviderException("getContextProviderAPI() is not available."); }
|
||||
const contextAPI = await copilotApi.getContextProviderAPI("v1");
|
||||
if (!contextAPI) { throw new CopilotContextProviderException("getContextProviderAPI(v1) returned null."); }
|
||||
this.contextProviderDisposable = contextAPI.registerContextProvider({
|
||||
const copilotApi = await getCopilotClientApi();
|
||||
const copilotChatApi = await getCopilotChatApi();
|
||||
if (!copilotApi && !copilotChatApi) { throw new CopilotContextProviderException("getCopilotApi() returned null, Copilot is missing or inactive."); }
|
||||
const contextProvider = {
|
||||
id: CopilotCompletionContextProvider.providerId,
|
||||
selector: CopilotCompletionContextProvider.defaultCppDocumentSelector,
|
||||
resolver: this
|
||||
});
|
||||
properties["cppCodeSnippetsProviderRegistered"] = "true";
|
||||
};
|
||||
type InstallSummary = { hasGetContextProviderAPI: boolean; hasAPI: boolean };
|
||||
const installSummary: { client?: InstallSummary; chat?: InstallSummary } = {};
|
||||
if (copilotApi) {
|
||||
installSummary.client = await this.installContextProvider(copilotApi, contextProvider);
|
||||
}
|
||||
if (copilotChatApi) {
|
||||
installSummary.chat = await this.installContextProvider(copilotChatApi, contextProvider);
|
||||
}
|
||||
if (installSummary.client?.hasAPI || installSummary.chat?.hasAPI) {
|
||||
properties["cppCodeSnippetsProviderRegistered"] = "true";
|
||||
} else {
|
||||
if (installSummary.client?.hasGetContextProviderAPI === false &&
|
||||
installSummary.chat?.hasGetContextProviderAPI === false) {
|
||||
throw new CopilotContextProviderException("getContextProviderAPI() is not available.");
|
||||
} else {
|
||||
throw new CopilotContextProviderException("getContextProviderAPI(v1) returned null.");
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.debug("Failed to register the Copilot Context Provider.");
|
||||
properties["error"] = "Failed to register the Copilot Context Provider";
|
||||
@@ -466,4 +485,18 @@ ${copilotCompletionContext?.areSnippetsMissing ? "(missing code snippets)" : ""}
|
||||
telemetry.logCopilotEvent(registerCopilotContextProvider, { ...properties });
|
||||
}
|
||||
}
|
||||
|
||||
private async installContextProvider(copilotAPI: CopilotContextProviderAPI, contextProvider: ContextProvider<SupportedContextItem>): Promise<{ hasGetContextProviderAPI: boolean; hasAPI: boolean }> {
|
||||
const hasGetContextProviderAPI = typeof copilotAPI.getContextProviderAPI === 'function';
|
||||
if (hasGetContextProviderAPI) {
|
||||
const contextAPI = await copilotAPI.getContextProviderAPI("v1");
|
||||
if (contextAPI) {
|
||||
this.contextProviderDisposables = this.contextProviderDisposables ?? [];
|
||||
this.contextProviderDisposables.push(contextAPI.registerContextProvider(contextProvider));
|
||||
}
|
||||
return { hasGetContextProviderAPI, hasAPI: contextAPI !== undefined };
|
||||
} else {
|
||||
return { hasGetContextProviderAPI: false, hasAPI: false };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,11 @@ export interface CopilotTrait {
|
||||
promptTextOverride?: string;
|
||||
}
|
||||
|
||||
export interface CopilotApi {
|
||||
export interface CopilotContextProviderAPI {
|
||||
getContextProviderAPI(version: string): Promise<ContextProviderApiV1 | undefined>;
|
||||
}
|
||||
|
||||
export interface CopilotApi extends CopilotContextProviderAPI {
|
||||
registerRelatedFilesProvider(
|
||||
providerId: { extensionId: string; languageId: string },
|
||||
callback: (
|
||||
@@ -33,11 +37,10 @@ export interface CopilotApi {
|
||||
cancellationToken: vscode.CancellationToken
|
||||
) => Promise<{ entries: vscode.Uri[]; traits?: CopilotTrait[] } | undefined>
|
||||
): Disposable;
|
||||
getContextProviderAPI(version: string): Promise<ContextProviderApiV1 | undefined>;
|
||||
}
|
||||
|
||||
export async function registerRelatedFilesProvider(): Promise<void> {
|
||||
const api = await getCopilotApi();
|
||||
const api = await getCopilotClientApi();
|
||||
if (util.extensionContext && api) {
|
||||
try {
|
||||
for (const languageId of ['c', 'cpp', 'cuda-cpp']) {
|
||||
@@ -129,7 +132,7 @@ async function getIncludes(uri: vscode.Uri, maxDepth: number): Promise<GetInclud
|
||||
return includes;
|
||||
}
|
||||
|
||||
export async function getCopilotApi(): Promise<CopilotApi | undefined> {
|
||||
export async function getCopilotClientApi(): Promise<CopilotApi | undefined> {
|
||||
const copilotExtension = vscode.extensions.getExtension<CopilotApi>('github.copilot');
|
||||
if (!copilotExtension) {
|
||||
return undefined;
|
||||
@@ -145,3 +148,38 @@ export async function getCopilotApi(): Promise<CopilotApi | undefined> {
|
||||
return copilotExtension.exports;
|
||||
}
|
||||
}
|
||||
|
||||
export async function getCopilotChatApi(): Promise<CopilotContextProviderAPI | undefined> {
|
||||
type CopilotChatApi = { getAPI?(version: number): CopilotContextProviderAPI | undefined };
|
||||
const copilotExtension = vscode.extensions.getExtension<CopilotChatApi>('github.copilot-chat');
|
||||
if (!copilotExtension) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let exports: CopilotChatApi | undefined;
|
||||
if (!copilotExtension.isActive) {
|
||||
try {
|
||||
exports = await Promise.race([
|
||||
copilotExtension.activate(),
|
||||
new Promise<undefined>(resolve => {
|
||||
setTimeout(() => {
|
||||
resolve(undefined);
|
||||
}, 3000);
|
||||
})
|
||||
]);
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
} else {
|
||||
exports = copilotExtension.exports;
|
||||
}
|
||||
if (!exports || typeof exports.getAPI !== 'function') {
|
||||
return undefined;
|
||||
}
|
||||
const result = exports.getAPI(1);
|
||||
return result;
|
||||
}
|
||||
|
||||
interface Disposable {
|
||||
dispose(): void;
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ let languageConfigurations: vscode.Disposable[] = [];
|
||||
let intervalTimer: NodeJS.Timeout;
|
||||
let codeActionProvider: vscode.Disposable;
|
||||
export const intelliSenseDisabledError: string = "Do not activate the extension when IntelliSense is disabled.";
|
||||
export let isWritingCrashCallStack: boolean = false;
|
||||
|
||||
type VcpkgDatabase = Record<string, string[]>; // Stored as <header file entry> -> [<port name>]
|
||||
let vcpkgDbPromise: Promise<VcpkgDatabase>;
|
||||
@@ -1023,9 +1024,11 @@ export function watchForCrashes(crashDirectory: string): void {
|
||||
return;
|
||||
}
|
||||
const crashDate: Date = new Date();
|
||||
isWritingCrashCallStack = true;
|
||||
|
||||
// Wait 5 seconds to allow time for the crash log to finish being written.
|
||||
setTimeout(() => {
|
||||
isWritingCrashCallStack = false;
|
||||
fs.readFile(path.resolve(crashDirectory, filename), 'utf8', (err, data) => {
|
||||
void handleCrashFileRead(crashDirectory, filename, crashDate, err, data);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user