Skip to content

Commit 2dc4f6a

Browse files
authored
add doc behind feature flag (#1248)
Put /doc behind a temporary flag (hard coded) until the next release. ## Test plan <!-- Required. See https://docs.sourcegraph.com/dev/background-information/testing_principles. --> Try the /doc command, smart selection will not work and you will have to highlight code before running the /doc command
1 parent 0d6a347 commit 2dc4f6a

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

vscode/CHANGELOG.md

-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ Starting from `0.2.0`, Cody is using `major.EVEN_NUMBER.patch` for release versi
88

99
### Added
1010

11-
- Executed the `/doc` command now automatically adds the documentation directly above your selected code in your editor, instead of shown in chat. [pull/1116](https://github.com/sourcegraph/cody/pull/1116)
12-
- New `mode` field in the Custom Commands config file enables a command to be configured on how the prompt should be run by Cody. Currently supports `inline` (run command prompt in inline chat), `edit` (run command prompt on selected code for refactoring purpose), and `insert` (run command prompt on selected code where Cody's response will be inserted on top of the selected code) modes. [pull/1116](https://github.com/sourcegraph/cody/pull/1116)
13-
- Experimentally added `smart selection` which removes the need to manually highlight code before running the `/doc` and `/test` commands. [pull/1116](https://github.com/sourcegraph/cody/pull/1116)
1411
- New "Save Code to File.." button on code blocks. [pull/1119](https://github.com/sourcegraph/cody/pull/1119)
1512
- Add logging for partially accepting completions. [pull/1214](https://github.com/sourcegraph/cody/pull/1214)
1613

vscode/src/custom-prompts/CommandRunner.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import { getCursorFoldingRange } from '../editor/utils'
66
import { logDebug } from '../log'
77
import { telemetryService } from '../services/telemetry'
88

9+
const release = false
10+
911
/**
1012
* CommandRunner class implements disposable interface.
1113
* Manages executing a Cody command and optional fixup.
@@ -58,7 +60,7 @@ export class CommandRunner implements vscode.Disposable {
5860
}
5961

6062
// Run fixup if this is a edit command
61-
const insertMode = command.mode === 'insert'
63+
const insertMode = command.mode === 'insert' && release
6264
const fixupMode = command.mode === 'edit' || instruction?.startsWith('/edit ')
6365
this.isFixupRequest = isFixupRequest || fixupMode || insertMode
6466
if (this.isFixupRequest) {
@@ -139,8 +141,8 @@ export class CommandRunner implements vscode.Disposable {
139141
range,
140142
instruction,
141143
document: doc,
142-
auto: true,
143-
insertMode,
144+
auto: release,
145+
insertMode: release,
144146
},
145147
source
146148
)

vscode/src/custom-prompts/CommandsController.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export class CommandsController implements VsCodeCommandsController, vscode.Disp
108108
*/
109109
private async createCodyCommand(command: CodyPrompt, input = ''): Promise<string> {
110110
const commandKey = command.slashCommand
111-
const defaultEditCommands = new Set(['/edit', '/fix', '/doc'])
111+
const defaultEditCommands = new Set(['/edit', '/fix'])
112112
const isFixupRequest = defaultEditCommands.has(commandKey) || command.prompt.startsWith('/edit')
113113

114114
logDebug('CommandsController:createCodyCommand:creating', commandKey)

vscode/src/editor/vscode-editor.ts

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import { InlineController } from '../services/InlineController'
1919
import { EditorCodeLenses } from './EditorCodeLenses'
2020
import { getCursorFoldingRange } from './utils'
2121

22+
const release = false
23+
2224
export class VSCodeEditor implements Editor<InlineController, FixupController, CommandsController> {
2325
constructor(
2426
public readonly controllers: ActiveTextEditorViewControllers<
@@ -134,6 +136,9 @@ export class VSCodeEditor implements Editor<InlineController, FixupController, C
134136
* @returns The smart selection for the active editor, or null if none can be determined.
135137
*/
136138
public async getActiveTextEditorSmartSelection(): Promise<ActiveTextEditorSelection | null> {
139+
if (!release) {
140+
return this.getActiveTextEditorSelection()
141+
}
137142
const activeEditor = this.getActiveTextEditorInstance()
138143
if (!activeEditor) {
139144
return null

0 commit comments

Comments
 (0)