-
Notifications
You must be signed in to change notification settings - Fork 241
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
Add support for Amazon Q chat on remote 242+ #4825
base: main
Are you sure you want to change the base?
Conversation
Conflicts: plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQToolWindowFactory.kt plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/webview/Browser.kt plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/webview/BrowserConnector.kt
…rains into rli/remote-chat-wip
Qodana Community for JVM12 new problems were found
💡 Qodana analysis was run in the pull request mode: only the changed files were checked Contact Qodana teamContact us at [email protected]
|
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.
QDJVMC found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
...src/software/aws/toolkits/jetbrains/services/cwc/editor/context/file/FileContextExtractor.kt
Fixed
Show fixed
Hide fixed
...src/software/aws/toolkits/jetbrains/services/cwc/editor/context/file/FileContextExtractor.kt
Fixed
Show fixed
Hide fixed
...src/software/aws/toolkits/jetbrains/services/cwc/editor/context/file/FileContextExtractor.kt
Fixed
Show fixed
Hide fixed
...src/software/aws/toolkits/jetbrains/services/cwc/editor/context/file/FileContextExtractor.kt
Fixed
Show fixed
Hide fixed
...src/software/aws/toolkits/jetbrains/services/cwc/editor/context/file/FileContextExtractor.kt
Fixed
Show fixed
Hide fixed
) : CefRequestHandlerAdapter() { | ||
private val myResources: MutableMap<String, () -> CefResourceHandler?> = HashMap() | ||
|
||
private val REJECTING_RESOURCE_HANDLER: CefResourceHandler = object : CefResourceHandlerAdapter() { |
Check notice
Code scanning / QDJVMC
Private property naming convention Note
} | ||
} | ||
|
||
private val RESOURCE_REQUEST_HANDLER = resourceHandlerWrapper { path -> |
Check notice
Code scanning / QDJVMC
Private property naming convention Note
private val headers: Map<String, String> = mapOf(), | ||
) : CefResourceHandler, Disposable { | ||
init { | ||
Disposer.register(parent, this) |
Check notice
Code scanning / QDJVMC
Leaking 'this' in constructor Note
private fun streamHandler(path: String, stream: InputStream) = | ||
JBCefStreamResourceHandler( | ||
stream, | ||
if (path.endsWith(".wasm") == true) "application/wasm" else URLConnection.getFileNameMap().getContentTypeFor(path), |
Check notice
Code scanning / QDJVMC
Boolean expression can be simplified Note
} | ||
} | ||
|
||
fun addResource(path: String, stream: InputStream?) = |
Check warning
Code scanning / QDJVMC
Unused symbol Warning
@@ -122,7 +122,7 @@ | |||
|
|||
ApplicationManager.getApplication().invokeAndWait { | |||
selectionRange = ApplicationManager.getApplication().runReadAction<Range?> { | |||
val editor = FileEditorManager.getInstance(project).selectedTextEditor | |||
val editor = FileEditorManager.getInstance(project).selectedTextEditorWithRemotes.firstOrNull() |
Check warning
Code scanning / QDJVMC
Unstable API Usage Warning
@@ -194,7 +194,7 @@ | |||
|
|||
withContext(EDT) { | |||
broadcastQEvent(QFeatureEvent.STARTS_EDITING) | |||
val editor: Editor = FileEditorManager.getInstance(context.project).selectedTextEditor ?: return@withContext | |||
val editor: Editor = FileEditorManager.getInstance(context.project).selectedTextEditorWithRemotes.firstOrNull() ?: return@withContext |
Check warning
Code scanning / QDJVMC
Unstable API Usage Warning
@@ -219,7 +219,7 @@ | |||
override suspend fun processInsertCodeAtCursorPosition(message: IncomingCwcMessage.InsertCodeAtCursorPosition) { | |||
broadcastQEvent(QFeatureEvent.STARTS_EDITING) | |||
withContext(EDT) { | |||
val editor: Editor = FileEditorManager.getInstance(context.project).selectedTextEditor ?: return@withContext | |||
val editor: Editor = FileEditorManager.getInstance(context.project).selectedTextEditorWithRemotes.firstOrNull() ?: return@withContext |
Check warning
Code scanning / QDJVMC
Unstable API Usage Warning
@@ -18,7 +18,7 @@ | |||
private val languageExtractor: LanguageExtractor = LanguageExtractor() | |||
suspend fun extract(): FileContext? { | |||
val editor = computeOnEdt { | |||
FileEditorManager.getInstance(project).selectedTextEditor | |||
FileEditorManager.getInstance(project).selectedTextEditorWithRemotes.firstOrNull() |
Check warning
Code scanning / QDJVMC
Unstable API Usage Warning
@@ -26,7 +26,7 @@ | |||
private val languageExtractor: LanguageExtractor = LanguageExtractor() | |||
suspend fun extract(): FocusAreaContext? { | |||
val editor = computeOnEdt { | |||
FileEditorManager.getInstance(project).selectedTextEditor | |||
FileEditorManager.getInstance(project).selectedTextEditorWithRemotes.firstOrNull() |
Check warning
Code scanning / QDJVMC
Unstable API Usage Warning
@@ -18,7 +18,7 @@ | |||
private var selectionListener: InlineChatSelectionListener? = null | |||
|
|||
init { | |||
val editor = project.let { FileEditorManager.getInstance(it).selectedTextEditor } | |||
val editor = project.let { FileEditorManager.getInstance(it).selectedTextEditorWithRemotes.firstOrNull() } |
Check warning
Code scanning / QDJVMC
Unstable API Usage Warning
Conflicts: plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/popup/CodeWhispererPopupManager.kt
This enables webviews to work over thin client instances by working around
registerSchemeHandlerFactory
being a no-op as described in IJPL-170861.Open issues:This should only be enabled on remote if 242+registerSchemeHandlerFactory
not working correctly -- need further evaluationFQN WASM code doesn't seem to be invoked properlydouble check thatFileEditorManager.getInstance(project).selectedFiles.first().name
andeditor.virtualFile.name
are equivalentShould we just doFileEditorManager#selectedTextEditorWithRemotes
? that is what inline suggestions is usingconsolidate on decision. ChatController/FeatureDevControllerprocessInsertCodeAtCursorPosition
need to be migrated tooFigure out why error inFocusAreaContextExtractor
is not surfaced anywhereLicense
I confirm that my contribution is made under the terms of the Apache 2.0 license.