Skip to content

Commit bce72d1

Browse files
committed
rename
1 parent b50da4f commit bce72d1

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/editor/CodeWhispererEditorUtil.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ object CodeWhispererEditorUtil {
111111
/**
112112
* Checks if the language is json and checks if left context contains keywords
113113
*/
114-
fun isConfigFileIfJsonFile(fileName: String, leftContext: String, language: CodeWhispererProgrammingLanguage): Boolean =
114+
fun isSupportedJsonFormat(fileName: String, leftContext: String, language: CodeWhispererProgrammingLanguage): Boolean =
115115
(language is CodeWhispererJson) &&
116116
(
117117
JsonConfigFileNamingConvention.contains(fileName) ||

plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/service/CodeWhispererService.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ import software.aws.toolkits.jetbrains.services.codewhisperer.credentials.CodeWh
5656
import software.aws.toolkits.jetbrains.services.codewhisperer.customization.CodeWhispererModelConfigurator
5757
import software.aws.toolkits.jetbrains.services.codewhisperer.editor.CodeWhispererEditorManager
5858
import software.aws.toolkits.jetbrains.services.codewhisperer.editor.CodeWhispererEditorUtil.getCaretPosition
59-
import software.aws.toolkits.jetbrains.services.codewhisperer.editor.CodeWhispererEditorUtil.isConfigFileIfJsonFile
59+
import software.aws.toolkits.jetbrains.services.codewhisperer.editor.CodeWhispererEditorUtil.isSupportedJsonFormat
6060
import software.aws.toolkits.jetbrains.services.codewhisperer.explorer.CodeWhispererExplorerActionManager
6161
import software.aws.toolkits.jetbrains.services.codewhisperer.explorer.isCodeWhispererEnabled
6262
import software.aws.toolkits.jetbrains.services.codewhisperer.model.CaretPosition
@@ -171,7 +171,7 @@ class CodeWhispererService(private val cs: CoroutineScope) : Disposable {
171171

172172
val language = requestContext.fileContextInfo.programmingLanguage
173173
val leftContext = requestContext.fileContextInfo.caretContext.leftFileContext
174-
if (!language.isCodeCompletionSupported() || !isConfigFileIfJsonFile(requestContext.fileContextInfo.filename, leftContext, language)) {
174+
if (!language.isCodeCompletionSupported() || !isSupportedJsonFormat(requestContext.fileContextInfo.filename, leftContext, language)) {
175175
LOG.debug { "Programming language $language is not supported by CodeWhisperer" }
176176
if (triggerTypeInfo.triggerType == CodewhispererTriggerType.OnDemand) {
177177
showCodeWhispererInfoHint(

plugins/amazonq/codewhisperer/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/codewhisperer/CodeWhispererEditorUtilTest.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ class CodeWhispererEditorUtilTest {
8080
}
8181

8282
@Test
83-
fun `test for keyword check for json and yaml`() {
84-
val result = CodeWhispererEditorUtil.isConfigFileIfJsonFile("foo.json", leftContext_success_Iac, CodeWhispererJson.INSTANCE)
83+
fun `test for keyword check for json`() {
84+
val result = CodeWhispererEditorUtil.isSupportedJsonFormat("foo.json", leftContext_success_Iac, CodeWhispererJson.INSTANCE)
8585
assertThat(result).isEqualTo(true)
8686
}
8787

@@ -101,17 +101,17 @@ class CodeWhispererEditorUtilTest {
101101
"vcpkg.json"
102102
]
103103
)
104-
fun `isConfigFileIfJsonFile should return true by file name`(fileName: String) {
105-
val result = CodeWhispererEditorUtil.isConfigFileIfJsonFile(fileName, "", CodeWhispererJson.INSTANCE)
104+
fun `isSupportedJsonFormat should return true by file name`(fileName: String) {
105+
val result = CodeWhispererEditorUtil.isSupportedJsonFormat(fileName, "", CodeWhispererJson.INSTANCE)
106106
assertThat(result).isEqualTo(true)
107107
}
108108

109109
@Test
110-
fun `isConfigFileIfJsonFile should retrun false due to no match`() {
111-
var result = CodeWhispererEditorUtil.isConfigFileIfJsonFile("foo.json", "", CodeWhispererJson.INSTANCE)
110+
fun `isSupportedJsonFormat should return false due to no match`() {
111+
var result = CodeWhispererEditorUtil.isSupportedJsonFormat("foo.json", "", CodeWhispererJson.INSTANCE)
112112
assertThat(result).isEqualTo(false)
113113

114-
result = CodeWhispererEditorUtil.isConfigFileIfJsonFile("package.json", "", CodeWhispererYaml.INSTANCE)
114+
result = CodeWhispererEditorUtil.isSupportedJsonFormat("package.json", "", CodeWhispererYaml.INSTANCE)
115115
assertThat(result).isEqualTo(false)
116116
}
117117
}

0 commit comments

Comments
 (0)