Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
d59e57e
poc
zixlin7 Aug 14, 2024
e053541
initial e2e poc
zixlin7 Aug 22, 2024
6776bb6
update to prompt and popup
zixlin7 Sep 20, 2024
a30e825
bugbash
zixlin7 Sep 30, 2024
f60db9b
bugfix and hint popup ux
zixlin7 Oct 11, 2024
3a80178
more bug fixes
zixlin7 Oct 11, 2024
425a375
more fixes
zixlin7 Oct 14, 2024
08f2797
move listeners
zixlin7 Oct 14, 2024
fbe4f62
cleanup
zixlin7 Oct 15, 2024
8795b69
fnf
zixlin7 Oct 15, 2024
06a6f0d
more fnf
zixlin7 Oct 16, 2024
69ce914
update to latest prompt
zixlin7 Oct 16, 2024
15081a2
cleanup
zixlin7 Oct 16, 2024
add9899
better popup position
zixlin7 Oct 16, 2024
fa53173
improve hint location
zixlin7 Oct 17, 2024
751f2bf
cleanup
zixlin7 Oct 17, 2024
f09a5fd
detekt
zixlin7 Oct 17, 2024
611bf64
rebase
zixlin7 Oct 17, 2024
1c9a928
fix after rebase
zixlin7 Oct 17, 2024
22a1dd9
small fix
zixlin7 Oct 17, 2024
52ec61d
remove gutter icon and improve popup location
zixlin7 Oct 18, 2024
e1cb930
fix undo and donot close popup when there is diff
zixlin7 Oct 18, 2024
6e44d76
fix error message and popup location, disable client prompt
zixlin7 Oct 18, 2024
7775724
small fixes
zixlin7 Oct 21, 2024
324ff94
Merge branch 'staging' into inlineChat
zixlin7 Oct 21, 2024
b8839bd
refactor
zixlin7 Oct 22, 2024
cc03925
cleanup
zixlin7 Oct 22, 2024
2988b00
cleanup logs
zixlin7 Oct 22, 2024
49fc2b2
Merge branch 'staging' into inlineChat
zixlin7 Oct 22, 2024
897e3a4
fix build
zixlin7 Oct 23, 2024
cdfdef2
detekt and pr feedback
zixlin7 Oct 23, 2024
cb2a169
refactor new ux
zixlin7 Oct 24, 2024
ad0a3af
fix request and prompt
zixlin7 Oct 25, 2024
562ebb5
Merge branch 'main' into inlineChat
zixlin7 Oct 25, 2024
377385a
fix detekt
zixlin7 Oct 25, 2024
dba54c2
fixes
zixlin7 Oct 27, 2024
7068e26
add to right click context menu
zixlin7 Oct 27, 2024
7f1e9f4
fix error handling
zixlin7 Oct 27, 2024
208bc85
Merge branch 'main' into inlineChat
zixlin7 Oct 28, 2024
1170e9f
telemetry change
zixlin7 Oct 28, 2024
fc0916c
Merge branch 'main' into inlineChat
zixlin7 Oct 28, 2024
cfdc0be
add change log
zixlin7 Oct 28, 2024
f7c7e2c
pr feedback
zixlin7 Oct 28, 2024
3e9781b
add read action to language extractor
zixlin7 Oct 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@

<actions>
<action id="aws.toolkit.open.q.window" class="software.aws.toolkits.jetbrains.services.amazonq.QRefreshPanelAction"/>
<action id="aws.toolkit.jetbrains.core.services.cwc.inline.openChat" class="software.aws.toolkits.jetbrains.services.cwc.inline.OpenChatInputAction">
<keyboard-shortcut first-keystroke="meta I" keymap="$default"/>
<keyboard-shortcut first-keystroke="control I" keymap="$default"/>
</action>
<group id="aws.q.toolwindow.titleBar" popup="false" compact="true">
<reference id="aws.toolkit.open.q.window"/>
</group>
Expand Down Expand Up @@ -83,6 +79,13 @@
class="software.aws.toolkits.jetbrains.services.cwc.commands.SendToPromptAction">
<keyboard-shortcut keymap="$default" first-keystroke="meta alt S" />
</action>

<action id="aws.toolkit.jetbrains.core.services.cwc.inline.openChat"
class="software.aws.toolkits.jetbrains.services.cwc.inline.OpenChatInputAction">
<keyboard-shortcut keymap="Mac OS X" first-keystroke="meta I"/>
<keyboard-shortcut keymap="Mac OS X 10.5+" first-keystroke="meta I"/>
<keyboard-shortcut keymap="$default" first-keystroke="control I"/>
</action>
</group>
</actions>
</idea-plugin>
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class ChatController private constructor(

editor.document.insertString(offset, message.code)

ReferenceLogController.addReferenceLog(message.code, message.codeReference, editor, context.project)
ReferenceLogController.addReferenceLog(message.code, message.codeReference, editor, context.project, null)

CodeWhispererUserModificationTracker.getInstance(context.project).enqueue(
InsertedCodeModificationEntry(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import software.amazon.awssdk.services.codewhispererruntime.model.Reference
import software.amazon.awssdk.services.codewhispererruntime.model.Span
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.session.CodeReferenceGenerated
import software.aws.toolkits.jetbrains.services.codewhisperer.editor.CodeWhispererEditorUtil
import software.aws.toolkits.jetbrains.services.codewhisperer.model.CaretPosition
import software.aws.toolkits.jetbrains.services.codewhisperer.toolwindow.CodeWhispererCodeReferenceManager
import software.aws.toolkits.jetbrains.services.cwc.messages.CodeReference

object ReferenceLogController {
fun addReferenceLog(originalCode: String, codeReferences: List<CodeReference>?, editor: Editor, project: Project) {
fun addReferenceLog(originalCode: String, codeReferences: List<CodeReference>?, editor: Editor, project: Project, inlineChatStartPosition: CaretPosition?) {
codeReferences?.let { references ->
val cwReferences = references.map { reference ->
Reference.builder()
Expand All @@ -36,7 +37,7 @@ object ReferenceLogController {
originalCode,
cwReferences,
editor,
CodeWhispererEditorUtil.getCaretPosition(editor),
inlineChatStartPosition ?: CodeWhispererEditorUtil.getCaretPosition(editor),
null,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,12 @@ class TelemetryHelper(private val project: Project, private val sessionStorage:
numSuggestionAddLines: Int?,
numSuggestionDelChars: Int?,
numSuggestionDelLines: Int?,
charactersAdded: Int?,
charactersRemoved: Int?,
programmingLanguage: String?,
) {
CodeWhispererClientAdaptor.getInstance(project).sendInlineChatTelemetry(
requestId, inputLength, numSelectedLines, codeIntent, userDecision,
responseStartLatency, responseEndLatency, numSuggestionAddChars, numSuggestionAddLines, numSuggestionDelChars, numSuggestionDelLines,
charactersAdded, charactersRemoved
programmingLanguage
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class FileContextExtractor(private val fqnWebviewAdapter: FqnWebviewAdapter?, pr
} ?: return null

val fileLanguage = computeOnEdt {
languageExtractor.extractLanguageNameFromCurrentFile(editor, project)
languageExtractor.extractLanguageNameFromCurrentFile(editor)
}
val fileText = computeOnEdt {
editor.document.text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,9 @@

package software.aws.toolkits.jetbrains.services.cwc.editor.context.file.util

import com.intellij.openapi.application.runReadAction
import com.intellij.openapi.editor.Document
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiDocumentManager
import com.intellij.psi.PsiFile
import software.aws.toolkits.jetbrains.services.codewhisperer.language.programmingLanguage

class LanguageExtractor {
fun extractLanguageNameFromCurrentFile(editor: Editor, project: Project): String? =
runReadAction {
val doc: Document = editor.document
val psiFile: PsiFile? = PsiDocumentManager.getInstance(project).getPsiFile(doc)
psiFile?.fileType?.name?.lowercase()
}
fun extractLanguageNameFromCurrentFile(editor: Editor): String = editor.virtualFile.programmingLanguage().languageId
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class FocusAreaContextExtractor(private val fqnWebviewAdapter: FqnWebviewAdapter

// Retrieve <codeNames> from trimmedFileText
val fileLanguage = computeOnEdt {
languageExtractor.extractLanguageNameFromCurrentFile(editor, project)
languageExtractor.extractLanguageNameFromCurrentFile(editor)
}
val fileText = editor.document.text
val fileName = FileEditorManager.getInstance(project).selectedFiles.first().name
Expand Down Expand Up @@ -141,7 +141,8 @@ class FocusAreaContextExtractor(private val fqnWebviewAdapter: FqnWebviewAdapter
val requestString = ChatController.objectMapper.writeValueAsString(extractNamesRequest)

codeNames = try {
fqnWebviewAdapter?.let { ChatController.objectMapper.readValue(it.extractNames(requestString), CodeNamesImpl::class.java)
fqnWebviewAdapter?.let {
ChatController.objectMapper.readValue(it.extractNames(requestString), CodeNamesImpl::class.java)
} ?: CodeNamesImpl(simpleNames = emptyList(), fullyQualifiedNames = FullyQualifiedNames(used = emptyList()))
} catch (e: Exception) {
getLogger<FocusAreaContextExtractor>().warn(e) { "Failed to extract names from file" }
Expand Down
Loading
Loading