Settings service. This includes appearance, editor, terminal, and file tree settings.
Settings service
private val settings: Settings by plugin()
Reading settings
// Get the current settings as a flow
val currentSettings: Flow<AppSettings> = settings.settings
// Read the current value once
val appSettings: AppSettings = settings.settings.first()
Updating settings
// Update any subset of settings
settings.updateSettings { current ->
current.copy(
appearance = current.appearance.copy(
theme = AppTheme.Dark
)
)
}
Update helper functions
// Appearance
settings.updateAppearanceSettings { appearance ->
appearance.copy(theme = AppTheme.Dark)
}
// Editor
settings.updateEditorSettings { editor ->
editor.copy(fontSize = 14)
}
// Terminal
settings.updateTerminalSettings { terminal ->
terminal.copy(fontSize = 12)
}
// File tree
settings.updateFileTreeSettings { fileTree ->
fileTree.copy(showHiddenFiles = true)
}
Shortcut extensions
settings.setTheme(AppTheme.Dark)
settings.setDarkMode(true)
AppSettings model
@Serializable
data class AppSettings(
val appearance: AppearanceSettings,
val editor: EditorSettings,
val terminal: TerminalSettings,
val fileTree: FileTreeSettings
)
AppearanceSettings
data class AppearanceSettings(
val theme: AppTheme, // System, Dark, Light
val amoledDarkMode: Boolean, // True black dark mode
val immersiveMode: Boolean, // Hide system bars
val reduceMotion: Boolean // Reduce animations
)
EditorSettings
data class EditorSettings(
val fontSize: Int, // Font size in sp
val pinLineNumbers: Boolean, // Always show line numbers
val tabSize: Int, // Tab width in spaces
val customFontUri: String?, // Custom font URI
val deleteEmptyLineFast: Boolean,
val deleteMultiSpaces: Boolean,
val symbolPairAutoCompletion: Boolean,
val autoIndent: Boolean,
val disallowSuggestions: Boolean,
val highlightMatchingDelimiters: Boolean,
val boldMatchingDelimiters: Boolean,
val stickyScroll: Boolean, // Scroll to keep context
val stickyScrollMaxLines: Int,
val inlayHints: Boolean // Show inlay hints
// ... and more
)
TerminalSettings
data class TerminalSettings(
val cursorStyle: CursorStyle,
val bellEnabled: Boolean,
val bellVolume: Float,
val fontSize: Int,
val cursorBlink: Boolean,
val scrollbackLines: Int,
val showMotd: Boolean
// ... and more
)
FileTreeSettings
data class FileTreeSettings(
val showHiddenFiles: Boolean
)