Skip to content

Commit 11ac6f4

Browse files
joshspicerCopilot
andauthored
Change default value for codingAgent.codeLens setting (#7980)
* Change default value for codingAgent.codeLens setting While #7962 is under discussion * [WIP] Fix test for codingAgent.codeLens setting (#7982) * Initial plan * Fix IssueTodoProvider test by enabling codeLens setting Co-authored-by: joshspicer <23246594+joshspicer@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: joshspicer <23246594+joshspicer@users.noreply.github.com> --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
1 parent 45d42a8 commit 11ac6f4

File tree

2 files changed

+42
-10
lines changed

2 files changed

+42
-10
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@
617617
},
618618
"githubPullRequests.codingAgent.codeLens": {
619619
"type": "boolean",
620-
"default": true,
620+
"default": false,
621621
"description": "%githubPullRequests.codingAgent.codeLens.description%"
622622
},
623623
"githubIssues.createInsertFormat": {

src/test/issues/issueTodoProvider.test.ts

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,54 @@ describe('IssueTodoProvider', function () {
6363
lineCount: 4
6464
} as vscode.TextDocument;
6565

66-
const codeLenses = await provider.provideCodeLenses(document, new vscode.CancellationTokenSource().token);
66+
const originalGetConfiguration = vscode.workspace.getConfiguration;
67+
vscode.workspace.getConfiguration = (section?: string) => {
68+
if (section === ISSUES_SETTINGS_NAMESPACE) {
69+
return {
70+
get: (key: string, defaultValue?: any) => {
71+
if (key === CREATE_ISSUE_TRIGGERS) {
72+
return ['TODO', 'todo', 'BUG', 'FIXME', 'ISSUE', 'HACK'];
73+
}
74+
return defaultValue;
75+
}
76+
} as any;
77+
} else if (section === CODING_AGENT) {
78+
return {
79+
get: (key: string, defaultValue?: any) => {
80+
if (key === SHOW_CODE_LENS) {
81+
return true;
82+
}
83+
return defaultValue;
84+
}
85+
} as any;
86+
}
87+
return originalGetConfiguration(section);
88+
};
89+
90+
try {
91+
// Update triggers to ensure the expression is set
92+
(provider as any).updateTriggers();
93+
94+
const codeLenses = await provider.provideCodeLenses(document, new vscode.CancellationTokenSource().token);
6795

68-
assert.strictEqual(codeLenses.length, 1);
96+
assert.strictEqual(codeLenses.length, 1);
6997

70-
// Verify the code lenses
71-
const startAgentLens = codeLenses.find(cl => cl.command?.title === 'Delegate to coding agent');
98+
// Verify the code lenses
99+
const startAgentLens = codeLenses.find(cl => cl.command?.title === 'Delegate to coding agent');
72100

73-
assert.ok(startAgentLens, 'Should have Delegate to coding agent CodeLens');
101+
assert.ok(startAgentLens, 'Should have Delegate to coding agent CodeLens');
74102

75-
assert.strictEqual(startAgentLens?.command?.command, 'issue.startCodingAgentFromTodo');
103+
assert.strictEqual(startAgentLens?.command?.command, 'issue.startCodingAgentFromTodo');
76104

77-
// Verify the range points to the TODO text
78-
assert.strictEqual(startAgentLens?.range.start.line, 1);
105+
// Verify the range points to the TODO text
106+
assert.strictEqual(startAgentLens?.range.start.line, 1);
107+
} finally {
108+
// Restore original configuration
109+
vscode.workspace.getConfiguration = originalGetConfiguration;
110+
}
79111
});
80112

81-
it('should respect the setting', async function () {
113+
it('should not provide code lenses when codeLens setting is disabled', async function () {
82114
const mockContext = {
83115
subscriptions: []
84116
} as any as vscode.ExtensionContext;

0 commit comments

Comments
 (0)