Specify also the initial selection option inside of the editorChat.start options (#189137)

* extending the api to also be able to include the selection

* cleaning the code

* cleaning the code

* Set the initial editor selection if it's provided

---------
This commit is contained in:
Aiday Marlen Kyzy
2023-08-02 12:23:30 +02:00
committed by GitHub
parent 7a606ee393
commit 7248433faf
3 changed files with 11 additions and 1 deletions

View File

@@ -22,6 +22,7 @@ import { IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/
import { IUntitledTextResourceEditorInput } from 'vs/workbench/common/editor';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { Range } from 'vs/editor/common/core/range';
import { Selection } from 'vs/editor/common/core/selection';
import { fromNow } from 'vs/base/common/date';
import { IInlineChatSessionService, Recording } from 'vs/workbench/contrib/inlineChat/browser/inlineChatSession';
import { runAccessibilityHelpAction } from 'vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp';
@@ -52,11 +53,12 @@ export class StartSessionAction extends EditorAction2 {
}
private _isInteractivEditorOptions(options: any): options is InlineChatRunOptions {
const { initialRange, message, autoSend, position } = options;
const { initialSelection, initialRange, message, autoSend, position } = options;
if (
typeof message !== 'undefined' && typeof message !== 'string'
|| typeof autoSend !== 'undefined' && typeof autoSend !== 'boolean'
|| typeof initialRange !== 'undefined' && !Range.isIRange(initialRange)
|| typeof initialSelection !== 'undefined' && !Selection.isISelection(initialSelection)
|| typeof position !== 'undefined' && !Position.isIPosition(position)) {
return false;
}