Skip to content

Commit

Permalink
Add codegen configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
fwcd committed Jul 28, 2024
1 parent febdf6b commit 8b3eafc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server/src/main/kotlin/org/javacs/kt/Configuration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ public data class SnippetsConfiguration(
var enabled: Boolean = true
)

public data class CodegenConfiguration(
/** Whether to enable code generation to a temporary build directory for Java interoperability. */
var enabled: Boolean = true
)

public data class CompletionConfiguration(
val snippets: SnippetsConfiguration = SnippetsConfiguration()
)
Expand Down Expand Up @@ -100,6 +105,7 @@ class GsonPathConverter : JsonDeserializer<Path?> {
}

public data class Configuration(
val codegen: CodegenConfiguration = CodegenConfiguration(),
val compiler: CompilerConfiguration = CompilerConfiguration(),
val completion: CompletionConfiguration = CompletionConfiguration(),
val diagnostics: DiagnosticsConfiguration = DiagnosticsConfiguration(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ class KotlinWorkspaceService(
sf.updateExclusions()
}

// Update code generation options
get("codegen")?.asJsonObject?.apply {
val codegen = config.codegen
get("enabled")?.asBoolean?.let { codegen.enabled = it }
}

// Update code-completion options
get("completion")?.asJsonObject?.apply {
val completion = config.completion
Expand Down

0 comments on commit 8b3eafc

Please sign in to comment.