-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: decorator for Python files in project tree (#26)
- Loading branch information
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/main/kotlin/com/github/catppuccin/jetbrains_icons/ProjectViewNodeDecorator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.github.catppuccin.jetbrains_icons | ||
|
||
import com.github.catppuccin.jetbrains_icons.settings.PluginSettingsState | ||
import com.intellij.ide.projectView.ProjectViewNode | ||
import com.intellij.ide.projectView.PresentationData | ||
import com.intellij.ide.projectView.ProjectViewNodeDecorator | ||
import com.intellij.packageDependencies.ui.PackageDependenciesNode | ||
import com.intellij.ui.ColoredTreeCellRenderer | ||
|
||
// hack: pycharm python plugin overrides .py icons in files tree | ||
// by using ProjectViewNodeDecorator we can override it with our icon | ||
class ProjectViewNodeDecorator: ProjectViewNodeDecorator { | ||
private var icons = Icons(PluginSettingsState.instance.variant) | ||
|
||
override fun decorate(node: ProjectViewNode<*>, data: PresentationData) { | ||
val file_type = node.getVirtualFile()?.name?.split(".")?.last() | ||
|
||
if (file_type.equals("py")) { | ||
data.setIcon(icons.EXT_TO_ICONS["py"]) | ||
} | ||
} | ||
|
||
// deprecated | ||
override fun decorate(node: PackageDependenciesNode, cellRender: ColoredTreeCellRenderer) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters