Skip to content

Commit 18c428d

Browse files
committed
refactor(vcsTools): remove unused imports and add toNioPathOrNull extension
- Remove unused imports: GitCommitsIterator and toNioPathOrNull. - Add toNioPathOrNull as an extension function for VirtualFile.
1 parent 03cd25f commit 18c428d

File tree

1 file changed

+7
-3
lines changed
  • exts/ext-git/src/main/kotlin/cc/unitmesh/git/mcp

1 file changed

+7
-3
lines changed

exts/ext-git/src/main/kotlin/cc/unitmesh/git/mcp/vcsTools.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ package cc.unitmesh.git.mcp
33
import cc.unitmesh.devti.mcp.host.AbstractMcpTool
44
import cc.unitmesh.devti.mcp.host.NoArgs
55
import cc.unitmesh.devti.mcp.host.Response
6-
import com.intellij.compiler.cache.git.GitCommitsIterator
76
import com.intellij.openapi.project.Project
87
import com.intellij.openapi.project.guessProjectDir
98
import com.intellij.openapi.vcs.ProjectLevelVcsManager
109
import com.intellij.openapi.vcs.changes.ChangeListManager
11-
import com.intellij.openapi.vfs.toNioPathOrNull
10+
import com.intellij.openapi.vfs.VirtualFile
1211
import git4idea.history.GitHistoryUtils
1312
import git4idea.repo.GitRepositoryManager
1413
import kotlinx.serialization.Serializable
14+
import java.nio.file.Path
1515
import kotlin.io.path.Path
1616

1717
@Serializable
@@ -105,4 +105,8 @@ class GetVcsStatusTool : AbstractMcpTool<NoArgs>() {
105105
"""{"path": "${it.first}", "type": "${it.second}"}"""
106106
})
107107
}
108-
}
108+
}
109+
110+
fun VirtualFile.toNioPathOrNull(): Path? {
111+
return runCatching { toNioPath() }.getOrNull()
112+
}

0 commit comments

Comments
 (0)