-
Notifications
You must be signed in to change notification settings - Fork 273
feat(amazonq): loosen inline suggestion restriction for json/yaml files #4928
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
Merged
Changes from 11 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
a01a618
loose inline suggestion support for json/yaml files
Will-ShaoHua 253dffb
patch
Will-ShaoHua dddeac6
detekt
Will-ShaoHua b50da4f
Merge remote-tracking branch 'upstream/main' into yaml
Will-ShaoHua bce72d1
rename
Will-ShaoHua 6c5f966
changelog
Will-ShaoHua 736da64
case ignore
Will-ShaoHua f7420ff
Merge remote-tracking branch 'upstream/main' into yaml
Will-ShaoHua 73c19cf
fix test
Will-ShaoHua dcb092a
detekt
Will-ShaoHua b44943b
tst
Will-ShaoHua 577195e
Update .changes/next-release/feature-fd316552-7161-43bf-aaa5-e1ac1330…
Will-ShaoHua d058bc2
address comments
Will-ShaoHua 267ca18
Merge remote-tracking branch 'upstream/main' into yaml
Will-ShaoHua 0edb0a0
Merge branch 'main' into yaml
Will-ShaoHua 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
4 changes: 4 additions & 0 deletions
4
.changes/next-release/feature-fd316552-7161-43bf-aaa5-e1ac1330b939.json
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,4 @@ | ||
| { | ||
| "type" : "feature", | ||
| "description" : "Loose inline completion support limitation for yaml/json files" | ||
| } | ||
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 |
|---|---|---|
|
|
@@ -12,13 +12,16 @@ import com.intellij.openapi.util.TextRange | |
| import com.intellij.openapi.vfs.VfsUtilCore | ||
| import com.intellij.psi.PsiFile | ||
| import com.intellij.ui.popup.AbstractPopup | ||
| import software.aws.toolkits.jetbrains.services.codewhisperer.language.CodeWhispererProgrammingLanguage | ||
| import software.aws.toolkits.jetbrains.services.codewhisperer.language.languages.CodeWhispererJson | ||
| import software.aws.toolkits.jetbrains.services.codewhisperer.language.languages.CodeWhispererYaml | ||
| import software.aws.toolkits.jetbrains.services.codewhisperer.language.programmingLanguage | ||
| import software.aws.toolkits.jetbrains.services.codewhisperer.model.CaretContext | ||
| import software.aws.toolkits.jetbrains.services.codewhisperer.model.CaretPosition | ||
| import software.aws.toolkits.jetbrains.services.codewhisperer.model.FileContextInfo | ||
| import software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhispererConstants | ||
| import software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhispererConstants.AWSTemplateCaseInsensitiveKeyWordsRegex | ||
| import software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhispererConstants.AWSTemplateKeyWordsRegex | ||
| import software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhispererConstants.JsonConfigFileNamingConvention | ||
| import software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhispererConstants.LEFT_CONTEXT_ON_CURRENT_LINE | ||
| import java.awt.Point | ||
| import java.util.Locale | ||
|
|
@@ -106,16 +109,14 @@ object CodeWhispererEditorUtil { | |
| } | ||
|
|
||
| /** | ||
| * Checks if the language is json or yaml and checks if left context contains keywords | ||
| * Checks if the language is json and checks if left context contains keywords | ||
| */ | ||
| fun checkLeftContextKeywordsForJsonAndYaml(leftContext: String, language: String): Boolean = ( | ||
| (language == CodeWhispererJson.INSTANCE.languageId) || | ||
| (language == CodeWhispererYaml.INSTANCE.languageId) | ||
| ) && | ||
| ( | ||
| (!CodeWhispererConstants.AWSTemplateKeyWordsRegex.containsMatchIn(leftContext)) && | ||
| (!CodeWhispererConstants.AWSTemplateCaseInsensitiveKeyWordsRegex.containsMatchIn(leftContext.lowercase(Locale.getDefault()))) | ||
| ) | ||
| fun isSupportedJsonFormat(fileName: String, leftContext: String, language: CodeWhispererProgrammingLanguage): Boolean { | ||
| assert(language is CodeWhispererJson) | ||
|
||
| return JsonConfigFileNamingConvention.contains(fileName.lowercase()) || | ||
| AWSTemplateKeyWordsRegex.containsMatchIn(leftContext) || | ||
| AWSTemplateCaseInsensitiveKeyWordsRegex.containsMatchIn(leftContext.lowercase(Locale.getDefault())) | ||
| } | ||
|
|
||
| /** | ||
| * Checks if the [otherRange] overlaps this TextRange. Note that the comparison is `<` because the endOffset of TextRange is exclusive. | ||
|
|
||
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
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.