mirror of
https://github.com/chylex/Rider-VCS-Group-By-Project.git
synced 2025-09-16 08:24:52 +02:00
Compare commits
8 Commits
b523fa46d8
...
main
Author | SHA1 | Date | |
---|---|---|---|
eb1a4dfdad
|
|||
ce55d81a0e
|
|||
fdc20aa4ed
|
|||
58165311be
|
|||
b560c67a34
|
|||
1ea1088150
|
|||
2493fd01f1
|
|||
8055375330
|
8
.gitignore
vendored
8
.gitignore
vendored
@@ -1,9 +1,5 @@
|
|||||||
/.idea/dictionaries
|
/.idea/*
|
||||||
/.idea/inspectionProfiles
|
!/.idea/runConfigurations
|
||||||
/.idea/jarRepositories.xml
|
|
||||||
/.idea/misc.xml
|
|
||||||
/.idea/*.iml
|
|
||||||
/.idea/.name
|
|
||||||
|
|
||||||
/.gradle/
|
/.gradle/
|
||||||
/build/
|
/build/
|
||||||
|
2
.idea/compiler.xml
generated
2
.idea/compiler.xml
generated
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="CompilerConfiguration">
|
<component name="CompilerConfiguration">
|
||||||
<bytecodeTargetLevel target="11" />
|
<bytecodeTargetLevel target="17" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
3
.idea/gradle.xml
generated
3
.idea/gradle.xml
generated
@@ -4,9 +4,6 @@
|
|||||||
<component name="GradleSettings">
|
<component name="GradleSettings">
|
||||||
<option name="linkedExternalProjectsSettings">
|
<option name="linkedExternalProjectsSettings">
|
||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
<option name="delegatedBuild" value="true" />
|
|
||||||
<option name="testRunner" value="GRADLE" />
|
|
||||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
<option name="modules">
|
<option name="modules">
|
||||||
<set>
|
<set>
|
||||||
|
@@ -1,26 +1,31 @@
|
|||||||
|
@file:Suppress("ConvertLambdaToReference")
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm") version "1.6.10"
|
kotlin("jvm") version "1.8.0"
|
||||||
id("org.jetbrains.intellij") version "1.6.0"
|
id("org.jetbrains.intellij") version "1.15.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "com.chylex.intellij.rider.vcsgroupbyproject"
|
group = "com.chylex.intellij.rider.vcsgroupbyproject"
|
||||||
version = "1.0.0"
|
version = "1.0.3"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
jvmToolchain(17)
|
||||||
|
}
|
||||||
|
|
||||||
intellij {
|
intellij {
|
||||||
type.set("RD")
|
type.set("RD")
|
||||||
version.set("2022.1")
|
version.set("2023.2-SNAPSHOT")
|
||||||
updateSinceUntilBuild.set(false)
|
updateSinceUntilBuild.set(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.patchPluginXml {
|
tasks.patchPluginXml {
|
||||||
sinceBuild.set("211")
|
sinceBuild.set("232")
|
||||||
untilBuild.set("222") // 222 requires a rebuild
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.buildSearchableOptions {
|
tasks.buildSearchableOptions {
|
||||||
@@ -28,8 +33,7 @@ tasks.buildSearchableOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<KotlinCompile> {
|
tasks.withType<KotlinCompile> {
|
||||||
kotlinOptions.jvmTarget = "11"
|
|
||||||
kotlinOptions.freeCompilerArgs = listOf(
|
kotlinOptions.freeCompilerArgs = listOf(
|
||||||
"-Xjvm-default=enable"
|
"-Xjvm-default=all"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@@ -8,6 +8,7 @@ import com.intellij.openapi.vcs.changes.ui.ChangesBrowserNodeRenderer
|
|||||||
import com.jetbrains.rider.model.RdCustomLocation
|
import com.jetbrains.rider.model.RdCustomLocation
|
||||||
import com.jetbrains.rider.model.RdProjectModelItemDescriptor
|
import com.jetbrains.rider.model.RdProjectModelItemDescriptor
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import java.io.Serial
|
||||||
|
|
||||||
class ChangesBrowserProjectNode(private val descriptor: RdProjectModelItemDescriptor) : ChangesBrowserNode<RdProjectModelItemDescriptor>(descriptor) {
|
class ChangesBrowserProjectNode(private val descriptor: RdProjectModelItemDescriptor) : ChangesBrowserNode<RdProjectModelItemDescriptor>(descriptor) {
|
||||||
private val type = getType(descriptor)
|
private val type = getType(descriptor)
|
||||||
@@ -30,6 +31,7 @@ class ChangesBrowserProjectNode(private val descriptor: RdProjectModelItemDescri
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@Serial
|
||||||
private const val serialVersionUID = 2641007635909904963L
|
private const val serialVersionUID = 2641007635909904963L
|
||||||
|
|
||||||
private fun getType(descriptor: RdProjectModelItemDescriptor): FileType? {
|
private fun getType(descriptor: RdProjectModelItemDescriptor): FileType? {
|
||||||
|
@@ -8,14 +8,20 @@ import com.intellij.openapi.vcs.changes.ui.ChangesBrowserNode
|
|||||||
import com.intellij.openapi.vcs.changes.ui.ChangesGroupingPolicyFactory
|
import com.intellij.openapi.vcs.changes.ui.ChangesGroupingPolicyFactory
|
||||||
import com.intellij.openapi.vcs.changes.ui.StaticFilePath
|
import com.intellij.openapi.vcs.changes.ui.StaticFilePath
|
||||||
import com.intellij.openapi.vcs.changes.ui.TreeModelBuilder
|
import com.intellij.openapi.vcs.changes.ui.TreeModelBuilder
|
||||||
|
import com.intellij.openapi.vfs.VirtualFile
|
||||||
|
import com.intellij.platform.backend.workspace.WorkspaceModel
|
||||||
import com.intellij.vcsUtil.VcsUtil
|
import com.intellij.vcsUtil.VcsUtil
|
||||||
import com.jetbrains.rider.model.RdCustomLocation
|
import com.jetbrains.rider.model.RdCustomLocation
|
||||||
import com.jetbrains.rider.model.RdProjectDescriptor
|
import com.jetbrains.rider.model.RdProjectDescriptor
|
||||||
import com.jetbrains.rider.model.RdProjectModelItemDescriptor
|
import com.jetbrains.rider.model.RdProjectModelItemDescriptor
|
||||||
import com.jetbrains.rider.model.RdUnloadProjectDescriptor
|
import com.jetbrains.rider.model.RdUnloadProjectDescriptor
|
||||||
import com.jetbrains.rider.projectView.workspace.ProjectModelEntity
|
import com.jetbrains.rider.projectView.workspace.ProjectModelEntity
|
||||||
import com.jetbrains.rider.projectView.workspace.containingEntity
|
|
||||||
import com.jetbrains.rider.projectView.workspace.containingProjectEntity
|
import com.jetbrains.rider.projectView.workspace.containingProjectEntity
|
||||||
|
import com.jetbrains.rider.projectView.workspace.getProjectModelEntities
|
||||||
|
import com.jetbrains.rider.projectView.workspace.isProject
|
||||||
|
import com.jetbrains.rider.projectView.workspace.isProjectFile
|
||||||
|
import com.jetbrains.rider.projectView.workspace.isProjectFolder
|
||||||
|
import com.jetbrains.rider.projectView.workspace.isUnloadedProject
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import javax.swing.tree.DefaultTreeModel
|
import javax.swing.tree.DefaultTreeModel
|
||||||
|
|
||||||
@@ -28,7 +34,7 @@ class ProjectChangesGroupingPolicy(private val project: Project, private val mod
|
|||||||
return nextPolicyParent
|
return nextPolicyParent
|
||||||
}
|
}
|
||||||
|
|
||||||
val descriptor = file.containingEntity(project)?.let(ProjectModelEntity::containingProjectEntity)?.descriptor
|
val descriptor = getSingleProjectEntity(file, project)?.descriptor
|
||||||
if (descriptor !is RdProjectDescriptor && descriptor !is RdUnloadProjectDescriptor) {
|
if (descriptor !is RdProjectDescriptor && descriptor !is RdUnloadProjectDescriptor) {
|
||||||
return nextPolicyParent
|
return nextPolicyParent
|
||||||
}
|
}
|
||||||
@@ -58,10 +64,44 @@ class ProjectChangesGroupingPolicy(private val project: Project, private val mod
|
|||||||
}
|
}
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
private val NODE_CACHE = NotNullLazyKey.create<MutableMap<RdProjectModelItemDescriptor?, ChangesBrowserNode<*>>, ChangesBrowserNode<*>>("ChangesTree.ProjectCache") {
|
private val NODE_CACHE = NotNullLazyKey.createLazyKey<MutableMap<RdProjectModelItemDescriptor?, ChangesBrowserNode<*>>, ChangesBrowserNode<*>>("ChangesTree.ProjectCache") {
|
||||||
mutableMapOf()
|
mutableMapOf()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun getSingleProjectEntity(file: VirtualFile, project: Project): ProjectModelEntity? {
|
||||||
|
val workspaceModel = WorkspaceModel.getInstance(project)
|
||||||
|
val entities = walkFileParentsUntilResultIsNotEmpty(file) { workspaceModel.getProjectModelEntities(it, project) }
|
||||||
|
if (entities == null) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
return entities
|
||||||
|
.filter(::isProjectOrProjectFile)
|
||||||
|
.map(ProjectModelEntity::containingProjectEntity)
|
||||||
|
.toSet()
|
||||||
|
.singleOrNull()
|
||||||
|
}
|
||||||
|
|
||||||
|
private inline fun <T> walkFileParentsUntilResultIsNotEmpty(leafFile: VirtualFile, getValue: (VirtualFile) -> List<T>?): List<T>? {
|
||||||
|
var file: VirtualFile? = leafFile
|
||||||
|
|
||||||
|
while (file != null) {
|
||||||
|
val value = getValue(file)
|
||||||
|
if (value.isNullOrEmpty()) {
|
||||||
|
file = file.parent
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun isProjectOrProjectFile(entity: ProjectModelEntity): Boolean {
|
||||||
|
return entity.isProjectFile() || entity.isProjectFolder() || entity.isProject() || entity.isUnloadedProject()
|
||||||
|
}
|
||||||
|
|
||||||
private fun getFolder(descriptor: RdProjectModelItemDescriptor): FilePath? {
|
private fun getFolder(descriptor: RdProjectModelItemDescriptor): FilePath? {
|
||||||
val location = descriptor.location
|
val location = descriptor.location
|
||||||
if (location !is RdCustomLocation) {
|
if (location !is RdCustomLocation) {
|
||||||
|
@@ -11,6 +11,21 @@
|
|||||||
Click the 'Group By' icon in the panel's toolbar and select 'Project' to group files by project, or both 'Project' and 'Directory' to first group by project and then by directory.
|
Click the 'Group By' icon in the panel's toolbar and select 'Project' to group files by project, or both 'Project' and 'Directory' to first group by project and then by directory.
|
||||||
]]></description>
|
]]></description>
|
||||||
|
|
||||||
|
<change-notes><![CDATA[
|
||||||
|
<b>Version 1.0.3</b>
|
||||||
|
<ul>
|
||||||
|
<li>Updated for Rider 2023.2 EAP.</li>
|
||||||
|
</ul>
|
||||||
|
<b>Version 1.0.2</b>
|
||||||
|
<ul>
|
||||||
|
<li>Updated for Rider 2022.2.</li>
|
||||||
|
</ul>
|
||||||
|
<b>Version 1.0.1</b>
|
||||||
|
<ul>
|
||||||
|
<li>Fixed grouping files belonging to multiple projects under a random project.</li>
|
||||||
|
</ul>
|
||||||
|
]]></change-notes>
|
||||||
|
|
||||||
<depends>com.intellij.modules.rider</depends>
|
<depends>com.intellij.modules.rider</depends>
|
||||||
|
|
||||||
<extensions defaultExtensionNs="com.intellij">
|
<extensions defaultExtensionNs="com.intellij">
|
||||||
|
Reference in New Issue
Block a user