- 
                Notifications
    
You must be signed in to change notification settings  - Fork 273
 
feat(amazonq): client emits insertToCursorPosition when user selects option from chat #5590
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
          
     Merged
      
      
            samgst-amazon
  merged 28 commits into
  feature/q-lsp-chat
from
samgst/q-chat-insertToCursorPosition
  
      
      
   
  Apr 25, 2025 
      
    
  
     Merged
                    Changes from 17 commits
      Commits
    
    
            Show all changes
          
          
            28 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      fe7738d
              
                Set up Flare chat connection
              
              
                manodnyab c09368c
              
                Merge branch 'feature/q-lsp' into manodnyb/setupChatComponentsWithFlare
              
              
                manodnyab 9d037cf
              
                Partial chat results
              
              
                manodnyab e259071
              
                Merge remote-tracking branch 'origin/manodnyb/setupChatComponentsWith…
              
              
                manodnyab bc6823b
              
                feedback
              
              
                manodnyab b833b6c
              
                resolved merge conflict
              
              
                manodnyab fb9fd25
              
                detekt
              
              
                manodnyab 46b9a82
              
                Merge branch 'feature/q-lsp-chat' into manodnyb/setupChatComponentsWi…
              
              
                manodnyab 06dc03d
              
                syntax error
              
              
                manodnyab 0f16cd4
              
                Merge remote-tracking branch 'origin/manodnyb/setupChatComponentsWith…
              
              
                manodnyab 21e4885
              
                detekt
              
              
                manodnyab 06e0966
              
                detekt
              
              
                manodnyab 8640432
              
                Add quick actions to chat
              
              
                manodnyab 930fff6
              
                merge conflicts resolved
              
              
                manodnyab 28a199e
              
                adding commands from initialize result
              
              
                manodnyab 98a43b5
              
                added trace logging
              
              
                manodnyab a7cc967
              
                emit copyCodeToClipboard for chat
              
              
                samgst-amazon 0ad53e6
              
                emit insertToCursorPosition for chat
              
              
                samgst-amazon 69e05e2
              
                Merge remote-tracking branch 'origin/feature/q-lsp-chat' into samgst/…
              
              
                samgst-amazon a2b80df
              
                feedback
              
              
                samgst-amazon ab2100c
              
                Merge remote-tracking branch 'origin/feature/q-lsp-chat' into samgst/…
              
              
                samgst-amazon 46c12b6
              
                feedback
              
              
                samgst-amazon 3a1d52d
              
                Merge remote-tracking branch 'origin/feature/q-lsp-chat' into samgst/…
              
              
                samgst-amazon 18f1567
              
                Merge remote-tracking branch 'origin/feature/q-lsp-chat' into samgst/…
              
              
                samgst-amazon 418ad45
              
                Merge branch 'feature/q-lsp-chat' into samgst/q-chat-copy-to-clipboard
              
              
                samgst-amazon df033c2
              
                Merge branch 'samgst/q-chat-copy-to-clipboard' into samgst/q-chat-ins…
              
              
                samgst-amazon e654064
              
                Merge branch 'feature/q-lsp-chat' into samgst/q-chat-insertToCursorPo…
              
              
                samgst-amazon 9793814
              
                Merge branch 'feature/q-lsp-chat' into samgst/q-chat-insertToCursorPo…
              
              
                samgst-amazon File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
          
            42 changes: 42 additions & 0 deletions
          
          42 
        
  ...are/aws/toolkits/jetbrains/services/amazonq/lsp/flareChat/AmazonQLspTypeAdapterFactory.kt
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| @file:Suppress("BannedImports") | ||
| package software.aws.toolkits.jetbrains.services.amazonq.lsp.flareChat | ||
| 
     | 
||
| import com.google.gson.Gson | ||
| import com.google.gson.TypeAdapter | ||
| import com.google.gson.TypeAdapterFactory | ||
| import com.google.gson.stream.JsonReader | ||
| import com.google.gson.stream.JsonWriter | ||
| import org.eclipse.lsp4j.InitializeResult | ||
| import java.io.IOException | ||
| 
     | 
||
| class AmazonQLspTypeAdapterFactory : TypeAdapterFactory { | ||
| override fun <T : Any?> create(gson: Gson, type: com.google.gson.reflect.TypeToken<T>): TypeAdapter<T>? { | ||
| if (type.rawType === InitializeResult::class.java) { | ||
| val delegate: TypeAdapter<InitializeResult?> = gson.getDelegateAdapter(this, type) as TypeAdapter<InitializeResult?> | ||
| 
     | 
||
| return object : TypeAdapter<InitializeResult>() { | ||
| @Throws(IOException::class) | ||
| override fun write(out: JsonWriter?, value: InitializeResult?) { | ||
| delegate.write(out, value) | ||
| } | ||
| 
     | 
||
| @Throws(IOException::class) | ||
| override fun read(`in`: JsonReader?): InitializeResult = | ||
| gson.fromJson(`in`, AwsExtendedInitializeResult::class.java) | ||
| } as TypeAdapter<T> | ||
| } | ||
| return null | ||
| } | ||
| } | ||
| 
     | 
||
| class AwsExtendedInitializeResult : InitializeResult() { | ||
| private var awsServerCapabilities: AwsServerCapabilities? = null | ||
| 
     | 
||
| fun getAwsServerCapabilities(): AwsServerCapabilities? = awsServerCapabilities | ||
| 
     | 
||
| fun setAwsServerCapabilities(awsServerCapabilities: AwsServerCapabilities?) { | ||
| this.awsServerCapabilities = awsServerCapabilities | ||
| } | ||
| } | 
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.