Skip to content
This repository was archived by the owner on Oct 15, 2025. It is now read-only.

Commit a8507e5

Browse files
authored
[jetbrains_projects] Fix Rider config
1 parent 41f93b9 commit a8507e5

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

jetbrains_projects/__init__.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,21 @@ class Editor:
5656
config_dir_prefix: str
5757
binary: str
5858

59-
def __init__(self, name: str, icon: Path, config_dir_prefix: str, binaries: list[str]):
59+
# Rider calls recentProjects.xml -> recentSolutions.xml and in it RecentProjectsManager -> RiderRecentProjectsManager
60+
is_rider: bool
61+
62+
def __init__(
63+
self,
64+
name: str,
65+
icon: Path,
66+
config_dir_prefix: str,
67+
binaries: list[str],
68+
is_rider = False):
6069
self.name = name
6170
self.icon = icon
6271
self.config_dir_prefix = config_dir_prefix
6372
self.binary = self._find_binary(binaries)
73+
self.is_rider = is_rider
6474

6575
@staticmethod
6676
def _find_binary(binaries: list[str]) -> Union[str, None]:
@@ -78,13 +88,20 @@ def list_projects(self) -> List[Project]:
7888
if not dirs:
7989
return []
8090
latest = sorted(dirs)[-1]
81-
return self._parse_recent_projects(Path(latest) / "options" / "recentProjects.xml")
91+
if not self.is_rider:
92+
recent_projects_xml = "recentProjects.xml"
93+
else:
94+
recent_projects_xml = "recentSolutions.xml"
95+
return self._parse_recent_projects(Path(latest) / "options" / recent_projects_xml)
8296

8397
@staticmethod
8498
def _parse_recent_projects(recent_projects_file: Path) -> list[Project]:
8599
try:
86100
root = ElementTree.parse(recent_projects_file).getroot()
87-
entries = root.findall(".//component[@name='RecentProjectsManager']//entry[@key]")
101+
if not self.is_rider:
102+
entries = root.findall(".//component[@name='RecentProjectsManager']//entry[@key]")
103+
else:
104+
entries = root.findall(".//component[@name='RiderRecentProjectsManager']//entry[@key]")
88105

89106
projects = []
90107
for entry in entries:
@@ -173,7 +190,8 @@ def __init__(self):
173190
name="Rider",
174191
icon=plugin_dir / "icons" / "rider.svg",
175192
config_dir_prefix="JetBrains/Rider",
176-
binaries=["rider", "rider-eap"]),
193+
binaries=["rider", "rider-eap"],
194+
is_rider=True),
177195
Editor(
178196
name="RubyMine",
179197
icon=plugin_dir / "icons" / "rubymine.svg",

0 commit comments

Comments
 (0)