alex1701c / jetbrains-api

This plugin provides the API for the base for the Jetbrains Runner and potential Dolphin plugin
3 stars 2 forks source link

Make alias checking more robust #4

Closed realisticen closed 1 year ago

realisticen commented 1 year ago

After upgrading to latest IntelliJ IDEA Community Edition using Jetbrains Toolbox the plugin stopped working.

Plugin logs:

Found /home/bpintar/.local/share/applications/jetbrains-idea-ce.desktop based on entry path
========== Manually Configured Jetbrains Applications ==========
Application path map: 
IntelliJ IDEA Community 2022.2.2 ==> /home/bpintar/.local/share/applications/jetbrains-idea-ce.desktop
========== Find Available Config Folders ==========
IdeaIC /home/bpintar/.config/JetBrains/IdeaIC2022.2
IdeaIC /home/bpintar/.config/JetBrains/IdeaIC2022.1
IdeaIC /home/bpintar/.config/JetBrains/IdeaIC2021.3
IntelliJ IDEA Community 2022.2.2 is not contained in alias
========== Filter Jetbrains Apps ==========
Found not projects for: IntelliJ IDEA Community 2022.2.2

.desktop file content

> bat /home/bpintar/.local/share/applications/jetbrains-idea-ce.desktop
       │ File: /home/bpintar/.local/share/applications/jetbrains-idea-ce.desktop
───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ [Desktop Entry]
   2   │ Name=IntelliJ IDEA Community Edition 2022.2.2
   3   │ Icon=/home/bpintar/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/.icon.svg
   4   │ StartupWMClass=jetbrains-idea-ce
   5   │ Comment=The most intelligent Java IDE
   6   │ Exec="/home/bpintar/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/222.4167.29/bin/idea.sh" %u
   7   │ Version=1.0
   8   │ Type=Application
   9   │ Categories=Development;IDE;
  10   │ Terminal=false
  11   │ StartupNotify=true

I have checked where you log IntelliJ IDEA Community 2022.2.2 is not contained in alias and I found this line: https://github.com/alex1701c/jetbrains-api/blob/e0446b3d536960f467680c475fffb5e0928e972b/SettingsDirectory.cpp#L63

After seeing that I updated Name in .desktop file from IntelliJ IDEA Community Edition 2022.2.2 to IntelliJ IDEA Community Edition and plugin started working again.

It seems that with they have changed on how they do Name in .desktop file. It looks like they attach the version to end of the name.

Would it be possible to make alias checking more robust by checking if string starts with IntelliJ IDEA Community Edition instead of doing full string compare?

alex1701c commented 1 year ago

I will need to investigate this further. Unfortunately I am quite busy with presentations/term papers and also have exams next week. After that I will for sure find the time.

alex1701c commented 1 year ago

@realisticen Can you please check if updating to master and recompiling the KRunner plugin fixes the issue?

In the KRunner plugin you have to go in the src/jetrbains-api subdir

alex1701c commented 1 year ago

@realisticen Unless you provide further feedback, I will release this change in a few days

realisticen commented 1 year ago

@alex1701c your changes fixed the issue. Thank you ❤️