Skip to content

Commit

Permalink
feat(language): add support for file function with dynamic file names #…
Browse files Browse the repository at this point in the history
…100

- Added support for dynamic file names in the FILE_FUNC command by importing FileFunc and using its values to dynamically generate the description.
- Also added new files for various tool examples: write, symbol, rev, file, commit, shell, run, patch, and file-func.
  • Loading branch information
phodal committed Mar 21, 2024
1 parent bb1c989 commit 9dc36e5
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 1 deletion.
@@ -1,8 +1,11 @@
package cc.unitmesh.devti.language.dataprovider

import cc.unitmesh.devti.language.compiler.model.FileFunc
import com.intellij.icons.AllIcons
import javax.swing.Icon

val filesFuncNames = FileFunc.values().map { it.funcName }

enum class BuiltinCommand(
val commandName: String,
val description: String,
Expand All @@ -25,7 +28,13 @@ enum class BuiltinCommand(
RUN("run", "Run the content of a file", AllIcons.Actions.Execute, true, true),
SHELL("shell", "Run shell command", AllIcons.Actions.Execute, true, true),
COMMIT("commit", "Commit the content of a file", AllIcons.Vcs.CommitNode, false),
FILE_FUNC("file-func", "Read the name of a file", AllIcons.Actions.GroupByFile, true, true),
FILE_FUNC(
"file-func",
"Read the name of a file, support for: " + filesFuncNames.joinToString(","),
AllIcons.Actions.GroupByFile,
true,
true
),
;

companion object {
Expand Down
@@ -0,0 +1,5 @@
/commit

```markdown
[//]: # (follow Conventional Commits, like feat: add 'graphiteWidth' option)
```
@@ -0,0 +1 @@
/file:.github/dependabot.yml
@@ -0,0 +1 @@
/file-func:regex(".*\.txt")
@@ -0,0 +1,5 @@
/patch

```patch
// the patch to apply
```
@@ -0,0 +1 @@
/rev:38d23de2
@@ -0,0 +1 @@
/run:src/main/cc/unitmesh/PythonPromptStrategyTest.kt
@@ -0,0 +1 @@
/shell:execute.sh
@@ -0,0 +1 @@
/symbol:cc.unitmesh.devti.language.psi
@@ -0,0 +1,5 @@
/write:src/main/kotlin/cc/unitmesh/context/CppFileContextBuilder.kt

```kotlin
// some code
```

0 comments on commit 9dc36e5

Please sign in to comment.