Skip to content
This repository was archived by the owner on Oct 15, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions jetbrains_projects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,21 @@ class Editor:
config_dir_prefix: str
binary: str

def __init__(self, name: str, icon: Path, config_dir_prefix: str, binaries: list[str]):
# Rider calls recentProjects.xml -> recentSolutions.xml and in it RecentProjectsManager -> RiderRecentProjectsManager
is_rider: bool

def __init__(
self,
name: str,
icon: Path,
config_dir_prefix: str,
binaries: list[str],
is_rider = False):
self.name = name
self.icon = icon
self.config_dir_prefix = config_dir_prefix
self.binary = self._find_binary(binaries)
self.is_rider = is_rider

def _find_binary(self, binaries: list[str]) -> Union[str, None]:
for binary in binaries:
Expand All @@ -77,12 +87,19 @@ def list_projects(self) -> list[Project]:
if not dirs:
return []
latest = sorted(dirs)[-1]
return self._parse_recent_projects(Path(latest) / "options" / "recentProjects.xml")
if not self.is_rider:
recent_projects_xml = "recentProjects.xml"
else:
recent_projects_xml = "recentSolutions.xml"
return self._parse_recent_projects(Path(latest) / "options" / recent_projects_xml)

def _parse_recent_projects(self, recent_projects_file: Path) -> list[Project]:
try:
root = ElementTree.parse(recent_projects_file).getroot()
entries = root.findall(".//component[@name='RecentProjectsManager']//entry[@key]")
if not self.is_rider:
entries = root.findall(".//component[@name='RecentProjectsManager']//entry[@key]")
else:
entries = root.findall(".//component[@name='RiderRecentProjectsManager']//entry[@key]")

projects = []
for entry in entries:
Expand Down Expand Up @@ -172,7 +189,8 @@ def __init__(self):
name="Rider",
icon=plugin_dir / "icons" / "rider.svg",
config_dir_prefix="JetBrains/Rider",
binaries=["rider", "rider-eap"]),
binaries=["rider", "rider-eap"],
is_rider=True),
Editor(
name="RubyMine",
icon=plugin_dir / "icons" / "rubymine.svg",
Expand Down