Skip to content

Commit

Permalink
1.2.18
Browse files Browse the repository at this point in the history
  • Loading branch information
acharneski committed Nov 10, 2023
1 parent e807680 commit 847da44
Show file tree
Hide file tree
Showing 31 changed files with 58 additions and 581 deletions.
9 changes: 4 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fun environment(key: String) = providers.environmentVariable(key).get()
plugins {
id("java") // Java support
id("groovy")
id("org.jetbrains.kotlin.jvm") version "1.7.22"
id("org.jetbrains.kotlin.jvm") version "1.9.20"
id("org.jetbrains.intellij") version "1.14.1"
id("org.jetbrains.changelog") version "2.0.0"
id("org.jetbrains.qodana") version "0.1.13"
Expand All @@ -22,15 +22,14 @@ repositories {
maven(url = "https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
}

val kotlin_version = "1.7.22"
val kotlin_version = "1.9.20"
val jetty_version = "11.0.15"
val slf4j_version = "2.0.9"
val skyenet_version = "1.0.21"
val skyenet_version = "1.0.23"
dependencies {

implementation(group = "com.simiacryptus", name = "joe-penai", version = "1.0.24")
implementation(group = "com.simiacryptus", name = "joe-penai", version = "1.0.25")

implementation(group = "com.simiacryptus.skyenet", name = "util", version = skyenet_version)
implementation(group = "com.simiacryptus.skyenet", name = "core", version = skyenet_version)
implementation(group = "com.simiacryptus.skyenet", name = "webui", version = skyenet_version)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import com.simiacryptus.openai.APIClientBase
import java.io.File

abstract class FileContextAction<T : Any>(
val supportsFiles: Boolean = true,
val supportsFolders: Boolean = true,
private val supportsFiles: Boolean = true,
private val supportsFolders: Boolean = true,
) : BaseAction() {

data class SelectionState(
Expand Down Expand Up @@ -68,7 +68,7 @@ abstract class FileContextAction<T : Any>(

open fun getConfig(project: Project?): T? = null

var isDevAction = false
private var isDevAction = false
override fun isEnabled(event: AnActionEvent): Boolean {
if (!super.isEnabled(event)) return false
if (UITools.isSanctioned()) return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ import com.intellij.psi.PsiManager
import com.intellij.psi.PsiRecursiveElementVisitor

abstract class SelectionAction<T : Any>(
val requiresSelection: Boolean = true
private val requiresSelection: Boolean = true
) : BaseAction() {

open fun getConfig(project: Project?): T? = null

fun retarget(
private fun retarget(
editorState: EditorState,
selectedText: @NlsSafe String?,
selectionStart: Int,
Expand Down Expand Up @@ -129,7 +129,7 @@ abstract class SelectionAction<T : Any>(
)
}

fun contextRanges(
private fun contextRanges(
psiFile: PsiFile?,
editor: Editor
): Array<ContextRange> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import org.slf4j.LoggerFactory
import java.net.InetSocketAddress

class AppServer(
val localName: String,
val port: Int,
private val localName: String,
private val port: Int,
project: Project?
) {

val log by lazy { LoggerFactory.getLogger(javaClass) }

var domainName: String = "http://$localName:$port"
private var domainName: String = "http://$localName:$port"

private val contexts by lazy {
val contexts = ContextHandlerCollection()
Expand All @@ -43,7 +43,7 @@ class AppServer(
}
}

fun newWebAppContext(server: WebSocketServer, path: String): WebAppContext {
private fun newWebAppContext(server: WebSocketServer, path: String): WebAppContext {
val context = WebAppContext()
JettyWebSocketServletContainerInitializer.configure(context, null)
context.baseResource = server.baseResource
Expand Down Expand Up @@ -86,7 +86,7 @@ class AppServer(
}
}

fun isRunning(it: ProgressIndicator) = synchronized(serverLock) { !it.isCanceled && server.isRunning }
private fun isRunning(it: ProgressIndicator) = synchronized(serverLock) { !it.isCanceled && server.isRunning }
fun start() {
server.start()
progressThread.start()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class CodeChatServer(
model = AppSettingsState.instance.defaultChatModel()
) {

val rootOperationID = (0..5).map { ('a'..'z').random() }.joinToString("")
var rootMessageTrail: String = ""
private val rootOperationID = (0..5).map { ('a'..'z').random() }.joinToString("")
private var rootMessageTrail: String = ""

override fun newSession(sessionId: String): CodeChatSession {
val newSession = CodeChatSession(sessionId)
Expand Down Expand Up @@ -63,7 +63,7 @@ rootMessageTrail =
)
).toMutableList()

val chatRequest: OpenAIClient.ChatRequest
private val chatRequest: OpenAIClient.ChatRequest
get() {
val chatRequest = OpenAIClient.ChatRequest()
val model = AppSettingsState.instance.defaultChatModel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ class ConvertFileTo : ActionGroup() {
}

companion object {
private val log = Logger.getInstance(
ConvertFileTo::class.java
)

fun getNewFile(project: Project?, file: VirtualFile, language: ComputerLanguage): VirtualFile {
val newFileRef = AtomicReference<VirtualFile>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class LaunchSkyenetAction : BaseAction() {
}

companion object {
private val log = org.slf4j.LoggerFactory.getLogger(LaunchSkyenetAction::class.java)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.intellij.openapi.vfs.VirtualFile
import com.simiacryptus.skyenet.Heart
import com.simiacryptus.skyenet.OutputInterceptor
import com.simiacryptus.skyenet.body.ClasspathResource
import com.simiacryptus.skyenet.body.SessionServerUtil.asJava
import com.simiacryptus.skyenet.util.SessionServerUtil.asJava
import com.simiacryptus.skyenet.body.SkyenetCodingSessionServer
import com.simiacryptus.skyenet.heart.WeakGroovyInterpreter
import org.eclipse.jetty.util.resource.Resource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class DictationAction : BaseAction() {
companion object {
val log = Logger.getInstance(DictationAction::class.java)

val pool = Executors.newFixedThreadPool(1)
private val pool = Executors.newFixedThreadPool(1)

val targetDataLine: Future<TargetDataLine?> by lazy {
pool.submit<TargetDataLine?> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import java.util.stream.Collectors
class ActionSettingsRegistry {

val actionSettings: MutableMap<String, ActionSettings> = HashMap()
val version = 1.91
private val version = 1.91

fun edit(superChildren: Array<out AnAction>): Array<AnAction> {
val children = superChildren.toList().toMutableList()
Expand Down Expand Up @@ -77,7 +77,7 @@ class ActionSettingsRegistry {
return children.toTypedArray()
}

class DynamicActionException(cause: Throwable, val msg: String, val file: File, val actionSetting: ActionSettings) : Exception(msg, cause)
class DynamicActionException(cause: Throwable, private val msg: String, val file: File, val actionSetting: ActionSettings) : Exception(msg, cause)

data class ActionSettings(
val id: String, // Static property
Expand Down Expand Up @@ -112,7 +112,7 @@ class ActionSettingsRegistry {
}
}

val packageName: String get() = id.substringBeforeLast('.')
private val packageName: String get() = id.substringBeforeLast('.')
val className: String get() = id.substringAfterLast('.')

val file: File
Expand Down Expand Up @@ -146,7 +146,7 @@ class ActionSettingsRegistry {

}

fun getActionConfig(action: AnAction): ActionSettings {
private fun getActionConfig(action: AnAction): ActionSettings {
return actionSettings.getOrPut(action.javaClass.name) {
val actionConfig = ActionSettings(action.javaClass.name)
actionConfig.displayText = action.templatePresentation.text
Expand Down Expand Up @@ -176,10 +176,10 @@ class ActionSettingsRegistry {
val log = org.slf4j.LoggerFactory.getLogger(ActionSettingsRegistry::class.java)

val actionCache = HashMap<String, AnAction>()
fun load(actionPackage: String, actionName: String, language: String) =
private fun load(actionPackage: String, actionName: String, language: String) =
load("/sources/${language}/$actionPackage/$actionName.$language")

fun load(path: String) =
private fun load(path: String) =
EditorMenu::class.java.getResourceAsStream(path)?.readAllBytes()?.toString(Charsets.UTF_8)

fun load(clazz: Class<AnAction>, language: String) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ActionTable(
private val log = Logger.getInstance(ActionTable::class.java)
}

val buttonPanel = JPanel()
private val buttonPanel = JPanel()
val columnNames = arrayOf("Enabled", "Display Text", "ID")

val rowData = actionSettings.map {
Expand Down Expand Up @@ -85,9 +85,9 @@ class ActionTable(

val jtable = JBTable(dataModel)

val scrollpane = JBScrollPane(jtable)
private val scrollpane = JBScrollPane(jtable)

val cloneButton = JButton(object : AbstractAction("Clone") {
private val cloneButton = JButton(object : AbstractAction("Clone") {
override fun actionPerformed(e: ActionEvent?) {

if (jtable.selectedRows.size != 1) {
Expand Down Expand Up @@ -154,7 +154,7 @@ class ActionTable(
}
})

val editButton = JButton((object : AbstractAction("Edit") {
private val editButton = JButton((object : AbstractAction("Edit") {
override fun actionPerformed(e: ActionEvent?) {
val id = dataModel.getValueAt(jtable.selectedRow, 2)
val actionSetting = actionSettings.find { it.id == id }
Expand All @@ -174,7 +174,7 @@ class ActionTable(
}
}))

val removeButton = JButton(object : AbstractAction("Remove") {
private val removeButton = JButton(object : AbstractAction("Remove") {
override fun actionPerformed(e: ActionEvent?) {
if (jtable.selectedRows.size != 1) {
JOptionPane.showMessageDialog(null, "Please select a single row to clone")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import javax.swing.JComponent
import javax.swing.JPanel

class AppSettingsConfigurable : Configurable {
var settingsComponent: AppSettingsComponent? = null
private var settingsComponent: AppSettingsComponent? = null

@Volatile
private var mainPanel: JPanel? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import java.util.stream.Collectors

class MRUItems {
val mostUsedHistory: MutableMap<String, Int> = HashMap()
val mostRecentHistory: MutableList<String> = ArrayList()
var historyLimit = 10
private val mostRecentHistory: MutableList<String> = ArrayList()
private var historyLimit = 10
fun addInstructionToHistory(instruction: CharSequence) {
synchronized(mostRecentHistory) {
if(mostRecentHistory.contains(instruction.toString())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import java.util.*
import java.util.stream.Collectors

class BlockComment(
val blockPrefix: CharSequence,
val linePrefix: CharSequence,
val blockSuffix: CharSequence,
private val blockPrefix: CharSequence,
private val linePrefix: CharSequence,
private val blockSuffix: CharSequence,
indent: CharSequence,
vararg textBlock: CharSequence
) :
IndentedText(indent, *textBlock) {
class Factory(val blockPrefix: String, val linePrefix: String, val blockSuffix: String) :
class Factory(private val blockPrefix: String, private val linePrefix: String, private val blockSuffix: String) :
TextBlockFactory<BlockComment?> {
override fun fromString(text: String?): BlockComment {
var text = text!!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ enum class ComputerLanguage(configuration: Configuration) {
val docStyle: String
val lineComment: TextBlockFactory<*>
val blockComment: TextBlockFactory<*>
val docComment: TextBlockFactory<*>
private val docComment: TextBlockFactory<*>

init {
extensions = listOf(*configuration.fileExtensions)
Expand All @@ -407,15 +407,6 @@ enum class ComputerLanguage(configuration: Configuration) {
docComment = configuration.getDocComments()!!
}

fun psiLanguage(): Language? {
return Language.findLanguageByID(name)
}

val multilineCommentSuffix: CharSequence?
get() = if (docComment is BlockComment.Factory) {
docComment.blockSuffix
} else null

fun getCommentModel(text: String?): TextBlockFactory<*> {
if (Objects.requireNonNull(docComment)!!.looksLike(text)) return docComment
return if (Objects.requireNonNull(blockComment)!!.looksLike(text)) blockComment else lineComment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class IdeaOpenAIClient : OpenAIClient(
key = AppSettingsState.instance.apiKey,
apiBase = AppSettingsState.instance.apiBase,
) {
val isInRequest = AtomicBoolean(false)
private val isInRequest = AtomicBoolean(false)

override fun incrementTokens(totalTokens: Int) {
AppSettingsState.instance.tokenCounter += totalTokens
Expand Down Expand Up @@ -123,7 +123,7 @@ class IdeaOpenAIClient : OpenAIClient(

val api: OpenAIClient get() = IdeaOpenAIClient()
var lastEvent: AnActionEvent? = null
fun uiEdit(
private fun uiEdit(
project: Project? = null,
title: String = "Edit Request",
jsonTxt: String
Expand Down Expand Up @@ -164,7 +164,7 @@ class IdeaOpenAIClient : OpenAIClient(
} ?: jsonTxt
}

fun <T : Any> execute(
private fun <T : Any> execute(
fn: () -> T
): T? {
val application = ApplicationManager.getApplication()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import java.util.stream.Collectors

class LineComment(private val commentPrefix: CharSequence, indent: CharSequence?, vararg lines: CharSequence) :
IndentedText(indent!!, *lines) {
class Factory(val commentPrefix: String) : TextBlockFactory<LineComment?> {
class Factory(private val commentPrefix: String) : TextBlockFactory<LineComment?> {
override fun fromString(text: String?): LineComment {
var text = text
text = text!!.replace(Regex("\t"), TextBlock.TAB_REPLACEMENT.toString())
Expand Down Expand Up @@ -52,4 +52,4 @@ class LineComment(private val commentPrefix: CharSequence, indent: CharSequence?
override fun withIndent(indent: CharSequence?): LineComment {
return LineComment(commentPrefix, indent, *lines)
}
}
}
Loading

0 comments on commit 847da44

Please sign in to comment.