Skip to content

Commit 9dc36e5

Browse files
committed
feat(language): add support for file function with dynamic file names #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.
1 parent bb1c989 commit 9dc36e5

File tree

10 files changed

+31
-1
lines changed

10 files changed

+31
-1
lines changed

exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/dataprovider/BuiltinCommand.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
package cc.unitmesh.devti.language.dataprovider
22

3+
import cc.unitmesh.devti.language.compiler.model.FileFunc
34
import com.intellij.icons.AllIcons
45
import javax.swing.Icon
56

7+
val filesFuncNames = FileFunc.values().map { it.funcName }
8+
69
enum class BuiltinCommand(
710
val commandName: String,
811
val description: String,
@@ -25,7 +28,13 @@ enum class BuiltinCommand(
2528
RUN("run", "Run the content of a file", AllIcons.Actions.Execute, true, true),
2629
SHELL("shell", "Run shell command", AllIcons.Actions.Execute, true, true),
2730
COMMIT("commit", "Commit the content of a file", AllIcons.Vcs.CommitNode, false),
28-
FILE_FUNC("file-func", "Read the name of a file", AllIcons.Actions.GroupByFile, true, true),
31+
FILE_FUNC(
32+
"file-func",
33+
"Read the name of a file, support for: " + filesFuncNames.joinToString(","),
34+
AllIcons.Actions.GroupByFile,
35+
true,
36+
true
37+
),
2938
;
3039

3140
companion object {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/commit
2+
3+
```markdown
4+
[//]: # (follow Conventional Commits, like feat: add 'graphiteWidth' option)
5+
```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/file:.github/dependabot.yml
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/file-func:regex(".*\.txt")
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/patch
2+
3+
```patch
4+
// the patch to apply
5+
```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/rev:38d23de2
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/run:src/main/cc/unitmesh/PythonPromptStrategyTest.kt
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/shell:execute.sh
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/symbol:cc.unitmesh.devti.language.psi
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/write:src/main/kotlin/cc/unitmesh/context/CppFileContextBuilder.kt
2+
3+
```kotlin
4+
// some code
5+
```

0 commit comments

Comments
 (0)