Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions build/hygiene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,19 @@ if (import.meta.main) {
const some = out.split(/\r?\n/).filter((l) => !!l);

if (some.length > 0) {
// Run copilot pre-commit checks if copilot files are staged
if (some.some(f => f.startsWith('extensions/copilot/'))) {
console.log('Running copilot pre-commit checks...');
const result = cp.spawnSync('npx', ['lint-staged'], {
cwd: path.join(process.cwd(), 'extensions', 'copilot'),
stdio: 'inherit',
});
if (result.status !== 0) {
console.error('Copilot pre-commit checks failed');
process.exit(1);
}
}

console.log('Reading git index versions...');

createGitIndexVinyls(some)
Expand Down
8 changes: 8 additions & 0 deletions build/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"@types/mime": "0.0.29",
"@types/minimatch": "^3.0.3",
"@types/minimist": "^1.2.1",
"@types/mocha": "^10.0.10",
"@types/node": "^22.18.10",
"@types/p-all": "^1.0.0",
"@types/pump": "^1.0.1",
Expand Down
3 changes: 3 additions & 0 deletions build/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"lib": [
"ES2024"
],
"types": [
"mocha"
],
"module": "nodenext",
"noEmit": true,
"erasableSyntaxOnly": true,
Expand Down
33 changes: 29 additions & 4 deletions extensions/copilot/.esbuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import * as path from 'path';
const REPO_ROOT = import.meta.dirname;
const isWatch = process.argv.includes('--watch');
const isDev = process.argv.includes('--dev');
const isPreRelease = process.argv.includes('--prerelease');
const generateSourceMaps = process.argv.includes('--sourcemaps');
const sourceMapOutDir = './dist-sourcemaps';

Expand Down Expand Up @@ -323,8 +322,8 @@ async function moveSourceMapsToSeparateDir(): Promise<void> {
}

async function main() {
if (!isDev) {
applyPackageJsonPatch(isPreRelease);
if (!isDev) { // TODO@joaomoreno
applyPackageJsonPatch();
}

await typeScriptServerPluginPackageJsonInstall();
Expand Down Expand Up @@ -426,15 +425,41 @@ async function main() {
}
}

function applyPackageJsonPatch(isPreRelease: boolean) {
function applyPackageJsonPatch() {
const quality = process.env['VSCODE_QUALITY'];

if (!quality) {
throw new Error('VSCODE_QUALITY environment variable is not set. This should be set by the build pipeline to ensure correct versioning and pre-release status in package.json.');
}

const packagejsonPath = path.join(import.meta.dirname, './package.json');
const json = JSON.parse(fs.readFileSync(packagejsonPath).toString());
const isPreRelease = quality !== 'stable';

const rootPackageJsonPath = path.join(import.meta.dirname, '../../package.json');
const rootPackageJson = JSON.parse(fs.readFileSync(rootPackageJsonPath).toString());
const vscodeVersion = rootPackageJson.version;

const [, vscodeMinor, vscodePatch] = vscodeVersion.split('.');
const newMajor = 0; // Keep major version at 0
const newMinor = parseInt(vscodeMinor, 10) - (115 - 43); // VS Code 1.115.x -> Copilot Chat 0.43.x
const newPatch = isPreRelease ? getDateBasedPatch() : vscodePatch; // For stable releases, keep the same patch number as VS Code

const newProps = {
buildType: 'prod',
isPreRelease,
version: `${newMajor}.${newMinor}.${newPatch}`
};

fs.writeFileSync(packagejsonPath, JSON.stringify({ ...json, ...newProps }, null, '\t'));
}

function getDateBasedPatch(): string {
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0');
return `${year}${month}${day}01`; // TODO@joaomoreno fix this asap
}

main();
3 changes: 0 additions & 3 deletions extensions/copilot/.husky/pre-commit

This file was deleted.

5 changes: 0 additions & 5 deletions extensions/copilot/.husky/pre-push

This file was deleted.

17 changes: 0 additions & 17 deletions extensions/copilot/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions extensions/copilot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6230,7 +6230,6 @@
},
"scripts": {
"postinstall": "tsx ./script/postinstall.ts",
"prepare": "husky",
"vscode-dts:update": "node script/build/vscodeDtsUpdate.js",
"vscode-dts:check": "node script/build/vscodeDtsCheck.js",
"vscode-dts:dev": "node node_modules/@vscode/dts/index.js dev && node script/build/moveProposedDts.js",
Expand Down Expand Up @@ -6328,7 +6327,6 @@
"eslint-plugin-no-only-tests": "^3.3.0",
"fastq": "^1.19.1",
"glob": "^11.1.0",
"husky": "^9.1.7",
"js-yaml": "^4.1.1",
"keyv": "^5.3.2",
"lint-staged": "15.2.9",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,8 @@ export class NextEditProvider extends Disposable implements INextEditProvider<Ne
telemetryBuilder.setStatus('emptyEditsButHasNextCursorPosition');
return new NextEditResult(logContext.requestId, req, { jumpToPosition: error.nextCursorPosition, targetDocumentId: error.nextCursorDocumentId, documentBeforeEdits: documentAtInvocationTime, isFromCursorJump: false, isSubsequentEdit: false });
}
} else if (error instanceof NoNextEditReason.GotCancelled) {
logContext.setIsSkipped();
}

const emptyResult = new NextEditResult(logContext.requestId, req, undefined);
Expand Down Expand Up @@ -1279,10 +1281,13 @@ export class NextEditProvider extends Disposable implements INextEditProvider<Ne
const capturingToken = new CapturingToken(label, undefined);

void this._requestLogger.captureInvocation(capturingToken, async () => {
this._addLiveLogContextEntry(logContext, label);
try {
await this._runSpeculativeProviderCall(nextEditRequest, projectedDocuments, curDocId, req, logger);
} catch (e) {
logContext.setError(e);
} finally {
this._addLogContextEntry(logContext, label);
logContext.markCompleted();
}
});

Expand Down Expand Up @@ -1324,6 +1329,7 @@ export class NextEditProvider extends Disposable implements INextEditProvider<Ne
Result.error(res.value.v),
res.value.telemetryBuilder
));
logContext.markAsNoSuggestions();
logger.trace('speculative request completed with no edits');
} else {

Expand Down Expand Up @@ -1372,6 +1378,7 @@ export class NextEditProvider extends Disposable implements INextEditProvider<Ne
res.value.telemetryBuilder
)
);
logContext.setResponseResults([nextEditReplacement]);
}

logger.trace(`cached speculative edit ${ithEdit}`);
Expand All @@ -1390,6 +1397,7 @@ export class NextEditProvider extends Disposable implements INextEditProvider<Ne
res.value.telemetryBuilder
)
);
logContext.markAsNoSuggestions();
}
});
}
Expand Down Expand Up @@ -1468,16 +1476,15 @@ export class NextEditProvider extends Disposable implements INextEditProvider<Ne
this._snippyService.handlePostInsertion(docId.toUri(), suggestion.result.documentBeforeEdits, suggestion.result.edit);
}

private _addLogContextEntry(logContext: InlineEditRequestLogContext, debugNameOverride?: string): void {
if (!logContext.includeInLogTree) {
return;
}
private _addLiveLogContextEntry(logContext: InlineEditRequestLogContext, debugNameOverride?: string): void {
this._requestLogger.addEntry({
type: LoggedRequestKind.MarkdownContentRequest,
debugName: debugNameOverride ?? logContext.getDebugName(),
icon: logContext.getIcon(),
icon: () => logContext.getIcon(),
startTimeMs: logContext.time,
markdownContent: logContext.toLogDocument(),
markdownContent: () => logContext.toLogDocument(),
onDidChange: logContext.onDidChange,
isVisible: () => logContext.includeInLogTree,
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { ConfigKey, IConfigurationService } from '../../../platform/configuratio
import { ICAPIClientService } from '../../../platform/endpoint/common/capiClient';
import { IEnvService, isScenarioAutomation } from '../../../platform/env/common/envService';
import { IVSCodeExtensionContext } from '../../../platform/extContext/common/extensionContext';
import { collectErrorMessages, collectSingleLineErrorMessage, ILogService } from '../../../platform/log/common/logService';
import { collectErrorMessages, collectSingleLineErrorMessage, ILogService, sanitizeNetworkErrorForTelemetry } from '../../../platform/log/common/logService';
import { outputChannel } from '../../../platform/log/vscode/outputChannelLogTarget';
import { FetchEvent, IFetcherService } from '../../../platform/networking/common/fetcherService';
import { IFetcher, userAgentLibraryHeader } from '../../../platform/networking/common/networking';
Expand Down Expand Up @@ -520,7 +520,7 @@ function collectFetcherTelemetry(accessor: ServicesAccessor): void {
probeResults[key] = `Status: ${response.status}`;
logService.debug(`Fetcher telemetry probe: ${library} ${probeResults[key]} (${Date.now() - requestStartTime}ms)`);
} catch (e) {
probeResults[key] = `Error: ${collectSingleLineErrorMessage(e, true)}`;
probeResults[key] = `Error: ${sanitizeNetworkErrorForTelemetry(collectSingleLineErrorMessage(e, true))}`;
logService.debug(`Fetcher telemetry probe: ${library} ${probeResults[key]} (${Date.now() - requestStartTime}ms)`);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -619,16 +619,12 @@ class ChatRequestProvider extends Disposable implements vscode.TreeDataProvider<
// whose debugName matches the token label), associate it directly with the
// parent ChatPromptItem — don't add it as a child. The entry stays in the
// request logger for virtual document serving; only tree nesting changes.
// Only wire the main entry if it is visible — for live NES/Ghost entries,
// isVisible() can be false (e.g. skipped/cancelled); wiring a hidden entry
// would make it visible again via the parent's icon and click command.
// Always wire the main entry so the parent node is clickable and shows the
// current icon (e.g. loading, lightbulb, skipped, circleSlash, etc.).
if (currReq.kind === LoggedInfoKind.Request &&
currReq.entry.type === LoggedRequestKind.MarkdownContentRequest &&
currReq.entry.debugName === currReq.token.label) {
const isHidden = currReq.entry.isVisible && !currReq.entry.isVisible();
if (!isHidden) {
prompt.setMainEntry(currReq);
}
prompt.setMainEntry(currReq);
continue;
}

Expand Down
Loading
Loading