bchatard / alfred-jetbrains

Alfred5 workflow to easily open your projects with your favorite JetBrains product.
MIT License
624 stars 49 forks source link

Toolbox v2 #331

Open bchatard opened 1 year ago

bchatard commented 1 year ago

TODO: check if any issue with this version

bchatard commented 1 year ago

https://blog.jetbrains.com/toolbox-app/2023/08/toolbox-app-2-0-overhauls-installations-and-updates/

tronto20 commented 1 year ago

In Toolbox v2, script is changed but replaced just one word from 'ideaargs' to 'intellij_args'

declare -a ideargs=() declare -- wait=""

for o in "$@"; do if [[ "$o" = "--wait" || "$o" = "-w" ]]; then wait="-W" o="--wait" fi if [[ "$o" =~ " " ]]; then ideargs+=("\"$o\"") else ideargs+=("$o") fi done

open -na "~~" $wait --args "${ideargs[@]}"


- Toolbox v2 script
```bash
#!/bin/bash
#Generated by JetBrains Toolbox 2.0.2.16660

declare -a intellij_args=()
declare -- wait=""

for o in "$@"; do
  if [[ "$o" = "--wait" || "$o" = "-w" ]]; then
    wait="-W"
    o="--wait"
  fi
  if [[ "$o" =~ " " ]]; then
    intellij_args+=("\"$o\"")
  else
    intellij_args+=("$o")
  fi
done

open -na "~~" $wait --args "${intellij_args[@]}"

So I just fix findProduct.js (in alfred-jetbrains v1.9.7) and solved error

  // Toolbox case
  const patternV1 = new RegExp(
    'open\\s-(n)?a\\s"(.*)"(?:\\s\\$wait)?(\\s--args)\\s"\\$(?:{ideargs\\[)?@(?:]})?"'
  );
  const patternV2 = new RegExp(
    'open\\s-(n)?a\\s"(.*)"(?:\\s\\$wait)?(\\s--args)\\s"\\$(?:{intellij_args\\[)?@(?:]})?"'
  );
  const matchV1 = patternV1.exec(binContent);
  const match = matchV1 ? matchV1 : patternV2.exec(binContent);
  const matchLength = match ? match.length : 0;
tronto20 commented 1 year ago

In alred-jetbrains v2.0.7, Intellij Ultimate and WebStrom is fine. but pycharm Professional throw error..

image
bchatard commented 1 year ago

hi, v1 (JS based) is no more supported

about you last comment, please provide log file (enable debug in Alfred)

tronto20 commented 1 year ago

thank you for your reply

below is my log file (alfred_jetbrains_cli_2023-09-05.log) I deleted some lines that seemed irrelevant.

10:28:03.597 (+0:00:00.000529)
Search projects for PyCharmProfessional with filter ''
10:28:03.597 (+0:00:00.000592)
Locate Settings Directory for pyCharmProfessional
10:28:03.597 (+0:00:00.000632)
Custom Config: {}
10:28:03.597 (+0:00:00.000739)
Search in [~/Library/Application Support/Google, ~/Library/Application Support/JetBrains, ~/Library/Preferences]
10:28:03.597 (+0:00:00.000755)
Looking in Directory: '/Users/user/Library/Application Support/Google'
10:28:03.597 (+0:00:00.000889)
Application Support: /Users/user/Library/Application Support/Google/PyCharm
10:28:03.597 (+0:00:00.001270)
Looking in Directory: '/Users/user/Library/Application Support/JetBrains'
10:28:03.597 (+0:00:00.001290)
Application Support: /Users/user/Library/Application Support/JetBrains/PyCharm
10:28:03.599 (+0:00:00.002773)
Settings Paths: [Directory: '/Users/user/Library/Application Support/JetBrains/PyCharm2023.1']
10:28:03.599 (+0:00:00.002785)
Use Directory: '/Users/user/Library/Application Support/JetBrains/PyCharm2023.1'
10:28:03.599 (+0:00:00.002824)
Use recentProjects.xml
10:28:03.603 (+0:00:00.007249)
Locate Application for PyCharmProfessional
10:28:03.603 (+0:00:00.007267)
Search in [/Applications, ~/Applications, ~/Applications/JetBrains Toolbox]
10:28:03.603 (+0:00:00.007275)
Search applications [PyCharm, PyCharm Professional, PyCharm Professional, PyCharm Professional Edition]
10:28:03.603 (+0:00:00.007282)
Looking in Directory: '/Applications'
...
10:28:03.604 (+0:00:00.007818)
Check application Alfred 5
10:28:03.604 (+0:00:00.007830)
Check application JetBrains Toolbox
10:28:03.604 (+0:00:00.007871)
Looking in Directory: '/Users/user/Applications'
10:28:03.604 (+0:00:00.007971)
Check application CLion 2023.2.1
10:28:03.604 (+0:00:00.007980)
Check application .DS_Store
10:28:03.604 (+0:00:00.007987)
Check application Chrome Apps
10:28:03.604 (+0:00:00.007991)
Check application Fleet
10:28:03.604 (+0:00:00.007998)
Check application IntelliJ IDEA Ultimate
10:28:03.604 (+0:00:00.008004)
Check application PyCharm Professional
10:28:03.604 (+0:00:00.008010)
Check application WebStorm
10:28:03.604 (+0:00:00.008017)
Check application MPS
10:28:03.604 (+0:00:00.008023)
Check application DataGrip
10:28:03.604 (+0:00:00.008029)
Check application CLion
10:28:03.604 (+0:00:00.008036)
Looking in Directory: '/Users/user/Applications/JetBrains Toolbox'
10:28:03.604 (+0:00:00.008046)
Directory: '/Users/user/Applications/JetBrains Toolbox' doesn't exists
10:28:03.604 (+0:00:00.008052)
Can't locate application for pyCharmProfessional
bchatard commented 1 year ago

sorry I forgot this issue.

I can't reproduce your case and it's weird we see an application "PyCharm Professional" in your Applications folder. No clue on this, sorry

I'll try to put more log on next release

eranor commented 11 months ago

Hi, I've encountered the same issue with PyCharm Professional Edition. And I verified that the binary exists in the ~/Applications path.

Logs ``` 11:30:41.822 (+0:00:00.021448) Can't locate application for pyCharmProfessional 11:33:18.148 (+0:00:00.004318) Search projects for PyCharmProfessional with filter '' 11:33:18.149 (+0:00:00.005440) Locate Settings Directory for pyCharmProfessional 11:33:18.150 (+0:00:00.006128) Custom Config: {} 11:33:18.151 (+0:00:00.007434) Search in [~/Library/Application Support/Google, ~/Library/Application Support/JetBrains, ~/Library/Preferences] 11:33:18.151 (+0:00:00.007670) Looking in Directory: '/Users/user/Library/Application Support/Google' 11:33:18.151 (+0:00:00.007946) Application Support: /Users/user/Library/Application Support/Google/PyCharm 11:33:18.153 (+0:00:00.009330) Looking in Directory: '/Users/user/Library/Application Support/JetBrains' 11:33:18.153 (+0:00:00.009342) Application Support: /Users/user/Library/Application Support/JetBrains/PyCharm 11:33:18.153 (+0:00:00.010057) Settings Paths: [Directory: '/Users/user/Library/Application Support/JetBrains/PyCharm2023.3', Directory: '/Users/user/Library/Application Support/JetBrains/PyCharm2023.2'] 11:33:18.154 (+0:00:00.010065) Use Directory: '/Users/user/Library/Application Support/JetBrains/PyCharm2023.3' 11:33:18.154 (+0:00:00.010126) Use recentProjects.xml 11:33:18.165 (+0:00:00.021321) Locate Application for PyCharmProfessional 11:33:18.165 (+0:00:00.021336) Search in [~/Applications, /Applications, ~/Applications/JetBrains Toolbox] 11:33:18.165 (+0:00:00.021341) Search applications [PyCharm, PyCharm Professional, PyCharm Professional Edition] 11:33:18.165 (+0:00:00.021348) Looking in Directory: '/Users/user/Applications' 11:33:18.165 (+0:00:00.021490) Check application PyCharm Professional Edition 11:33:18.165 (+0:00:00.021544) Check application .DS_Store 11:33:18.165 (+0:00:00.021549) Check application Mac Mouse Fix 11:33:18.165 (+0:00:00.021554) Check application .localized 11:33:18.165 (+0:00:00.021559) Check application Chrome Apps 11:33:18.165 (+0:00:00.021563) Check application LinearMouse 11:33:18.165 (+0:00:00.021569) Check application CLion Nova 11:33:18.165 (+0:00:00.021573) Check application Spotify 11:33:18.165 (+0:00:00.021577) Check application PyCharm 11:33:18.165 (+0:00:00.021581) Looking in Directory: '/Applications' 11:33:18.165 (+0:00:00.021825) Check application Visual Studio Code 11:33:18.165 (+0:00:00.021829) Check application VLC ... 11:33:18.165 (+0:00:00.022056) Check application Pinta 11:33:18.166 (+0:00:00.022062) Looking in Directory: '/Users/user/Applications/JetBrains Toolbox' 11:33:18.166 (+0:00:00.022104) Can't locate application for pyCharmProfessional ```