-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPicoCodeSettings.kt
More file actions
39 lines (32 loc) · 1.11 KB
/
PicoCodeSettings.kt
File metadata and controls
39 lines (32 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.picocode
import com.intellij.openapi.components.PersistentStateComponent
import com.intellij.openapi.components.State
import com.intellij.openapi.components.Storage
import com.intellij.openapi.components.Service
import com.intellij.openapi.project.Project
import com.intellij.util.xmlb.XmlSerializerUtil
/**
* Project-level settings for PicoCode plugin
* Stores backend server host and port configuration
*/
@State(
name = "PicoCodeSettings",
storages = [Storage("picocode.xml")]
)
@Service(Service.Level.PROJECT)
class PicoCodeSettings : PersistentStateComponent<PicoCodeSettings.SettingsState> {
data class SettingsState(
var serverHost: String = "localhost",
var serverPort: Int = 8000
)
private var state = SettingsState()
override fun getState(): SettingsState = state
override fun loadState(state: SettingsState) {
XmlSerializerUtil.copyBean(state, this.state)
}
companion object {
fun getInstance(project: Project): PicoCodeSettings {
return project.getService(PicoCodeSettings::class.java)
}
}
}