-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Open Chat instruction selects range of code in active editor #187
Conversation
return contentMsg | ||
.replace("%CURRENT_FILE%", relativePath?.toString() ?: filePath.toString()) | ||
.replace("%CURSOR_LINE%", line1.toString()) | ||
.replace("%CODE_SELECTION%", text) | ||
} | ||
|
||
@OptIn(DelicateCoroutinesApi::class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, is DelicateCoroutinesApi
OptIn?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any other way to implement setTimeout
functionality? Without that, sometimes chat is not ready yet and file is not getting attached
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OptIn
was kindly suggested by IDE when I tried to use GlobalScope.launch
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, changed GlobalScope
to CoroutineScope
, now we should be fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Timer().schedule(500) {
val pos1 = LogicalPosition(line1, 0)
val pos2 = LogicalPosition(line2, editor.document.getLineEndOffset(line2))
editor.selectionModel.setSelection(
editor.logicalPositionToOffset(pos1),
editor.logicalPositionToOffset(pos2)
)
}
Might work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is CoroutineScope
undesirable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be fine since we use coroutines else where :)
Added logic of lines selection in active editor's tab, if
contentMsg
is empty (no messages were provided)