Skip to content

Commit dc6aadd

Browse files
Copilotphilmillman
andauthored
intellij-plugin: address automated review feedback (#474)
* Initial plan * Implement all review feedback: paren tokens, decorator filtering, key patterns, .idea gitignore Co-authored-by: philmillman <3722211+philmillman@users.noreply.github.com> Agent-Logs-Url: https://github.com/dmno-dev/varlock/sessions/45f827c0-165e-457c-83dc-538993ffa1bd --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: philmillman <3722211+philmillman@users.noreply.github.com>
1 parent b6f6952 commit dc6aadd

17 files changed

Lines changed: 52 additions & 98 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ framework-tests/.packed
1717
framework-tests/.test-projects
1818
.magent
1919
eslint-output.txt
20+
21+
.idea/
22+
*.iml

.idea/.gitignore

Lines changed: 0 additions & 10 deletions
This file was deleted.

.idea/codeStyles/Project.xml

Lines changed: 0 additions & 10 deletions
This file was deleted.

.idea/codeStyles/codeStyleConfig.xml

Lines changed: 0 additions & 5 deletions
This file was deleted.

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.idea/modules.xml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.idea/varlock.iml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.idea/vcs.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

packages/intellij-plugin/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Inspired by the [VS Code / Open VSX extension](../../vscode-plugin):
7171

7272
### Troubleshooting
7373

74-
**Build fails with "What went wrong: 25"** — You're using Java 25, which Gradle 8.x doesn't support. Use Java 17:
74+
**Build fails with "What went wrong: 25"** — You're using Java 25, which isn't supported by the Gradle/toolchain used for this plugin. Use Java 17:
7575

7676
```bash
7777
# Homebrew (openjdk@17)

packages/intellij-plugin/src/main/kotlin/dev/dmno/envspec/EnvSpecCompletionContributor.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,26 @@ class EnvSpecCompletionContributor : CompletionContributor() {
2626
}
2727

2828
companion object {
29-
private val ENV_KEY_PATTERN = Pattern.compile("^\\s*([A-Za-z_][A-Za-z0-9_]*)\\s*=")
29+
private val ENV_KEY_PATTERN = Pattern.compile("^\\s*(?:export\\s+)?([A-Za-z_][A-Za-z0-9_.-]*)\\s*=")
3030
private val KOTLIN_ESCAPED_DOLLAR_RE = Regex("\\$\\{'\\$'\\}")
3131
private val CHOICE_SNIPPET_RE = Regex("""\$\{\d+\|([^}]*)\|\}""")
3232
private val DEFAULT_SNIPPET_RE = Regex("""\$\{\d+:([^}]*)\}""")
3333
private val TABSTOP_SNIPPET_RE = Regex("""\$\{\d+\}""")
3434
private val SIMPLE_TABSTOP_SNIPPET_RE = Regex("""\$\d+""")
3535
}
3636

37+
private fun getDecoratorCommentPrefix(linePrefix: String): String? {
38+
return EnvSpecDiagnosticsCore.getDecoratorCommentText(linePrefix)
39+
}
40+
3741
private fun doAddCompletions(params: CompletionParameters, result: CompletionResultSet) {
3842
val file = params.originalFile as? EnvSpecFile ?: return
3943
val document = params.editor.document
4044
val offset = params.offset
4145
val line = document.getLineNumber(offset)
4246
val lineStart = document.getLineStartOffset(line)
4347
val linePrefix = document.getText(com.intellij.openapi.util.TextRange(lineStart, offset))
44-
val commentStart = linePrefix.indexOf('#')
45-
val commentPrefix = if (commentStart >= 0) linePrefix.substring(commentStart + 1) else ""
48+
val commentPrefix = getDecoratorCommentPrefix(linePrefix)
4649

4750
val lineDocument = object : LineDocument {
4851
override val lineCount: Int get() = document.lineCount
@@ -63,7 +66,7 @@ class EnvSpecCompletionContributor : CompletionContributor() {
6366
return
6467
}
6568

66-
if (commentStart >= 0) {
69+
if (commentPrefix != null) {
6770
val existingDecoratorNames = EnvSpecCompletionCore.getExistingDecoratorNames(lineDocument, line, commentPrefix)
6871

6972
// Type option completion

0 commit comments

Comments
 (0)