fix(environment): add setter for editSessionId#318325
Conversation
The editSessionId property was defined as a getter only in both native and browser environment services. Code in editSessions.contribution.ts was assigning to it (to clear the ID after resume), causing 'Cannot set property editSessionId which has only a getter' errors. - Add setter to AbstractNativeEnvironmentService - Add setter to BrowserEnvironmentService with private backing field Fixes microsoft#316633
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds runtime mutability for editSessionId in environment services so the value can be updated after initialization (e.g., after an edit session is established).
Changes:
- Add a setter to
editSessionIdin the browser workbench environment service using a private override field. - Add a setter to
editSessionIdin the native environment service by writing back into parsed args.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/vs/workbench/services/environment/browser/environmentService.ts | Introduces a mutable editSessionId via private backing field + setter. |
| src/vs/platform/environment/common/environmentService.ts | Makes editSessionId writable by updating args['editSessionId']. |
| get profile(): string | undefined { return this.payload?.get('profile'); } | ||
|
|
||
| private _editSessionId: string | undefined; | ||
| @memoize |
| @memoize | ||
| get editSessionId(): string | undefined { return this.options.editSessionId; } | ||
| get editSessionId(): string | undefined { return this._editSessionId ?? this.options.editSessionId; } | ||
| set editSessionId(value: string | undefined) { this._editSessionId = value; } |
|
@SpencerJung please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
1 similar comment
|
@SpencerJung please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
Related Issue
Closes #316633
Summary
The
editSessionIdproperty was defined as a getter only in both native and browser environment services. Code ineditSessions.contribution.tswas assigning to it (to clear the ID after resume), causing "Cannot set property editSessionId which has only a getter" errors.Changes
AbstractNativeEnvironmentService(native)BrowserEnvironmentServicewith private backing field (web)Verification Evidence
npm run compile-check-ts-native: PASSED (no TypeScript errors)Checklist