Skip to content

Commit 0c18df3

Browse files
committed
feat(amazonq): support Dockerfile files in /dev
1 parent 91d5a0c commit 0c18df3

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "feature",
3+
"description" : "Amazon Q /dev: support `Dockerfile` files"
4+
}

plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/FeatureDevSessionContext.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ class FeatureDevSessionContext(val project: Project, val maxProjectSizeBytes: Lo
6868
"dist/?"
6969
).map { Regex(it) }
7070

71+
// well known source files that do not have extensions
72+
private val wellKnownSourceFiles = setOf(
73+
"Dockerfile",
74+
"Dockerfile.build"
75+
)
76+
7177
// projectRoot: is the directory where the project is located when selected to open a project.
7278
val projectRoot = project.guessProjectDir() ?: error("Cannot guess base directory for project ${project.name}")
7379

@@ -117,6 +123,10 @@ class FeatureDevSessionContext(val project: Project, val maxProjectSizeBytes: Lo
117123
return deferredResults.any { it.await() }
118124
}
119125

126+
private fun wellKnown(file: VirtualFile): Boolean {
127+
return wellKnownSourceFiles.contains(file.name)
128+
}
129+
120130
suspend fun zipFiles(projectRoot: VirtualFile): File = withContext(getCoroutineBgContext()) {
121131
val files = mutableListOf<VirtualFile>()
122132
val ignoredExtensionMap = mutableMapOf<String, Long>().withDefault { 0L }
@@ -126,8 +136,9 @@ class FeatureDevSessionContext(val project: Project, val maxProjectSizeBytes: Lo
126136
projectRoot,
127137
object : VirtualFileVisitor<Unit>() {
128138
override fun visitFile(file: VirtualFile): Boolean {
139+
val isWellKnown = runBlocking { wellKnown(file) }
129140
val isFileIgnoredByExtension = runBlocking { ignoreFileByExtension(file) }
130-
if (isFileIgnoredByExtension) {
141+
if (!isWellKnown && isFileIgnoredByExtension) {
131142
val extension = file.extension.orEmpty()
132143
ignoredExtensionMap[extension] = (ignoredExtensionMap[extension] ?: 0) + 1
133144
return false

plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/services/telemetry/TelemetryUtils.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ val ALLOWED_CODE_EXTENSIONS = setOf(
4040
"d",
4141
"dart",
4242
"dfm",
43+
"dockerfile",
4344
"dpr",
4445
"e",
4546
"el",

0 commit comments

Comments
 (0)