extensions: [JetBrains Toolbox Recent Projects] Plugin not working after updated JetBrains Toolbox to 2.0.x

Extension

https://www.raycast.com/gdsmith/jetbrains

Description

Error:

TypeError: Cannot read properties of undefined (reading 'find')

pd:util.ts:244:43

---
241:   if (channel.tool.toolName === undefined) {
242:     return undefined
image

Steps To Reproduce

I updated JB Toolbox to 2.0.2 and found this plugin not working. Upon checking https://github.com/raycast/extensions/pull/7799, I updated my raycast to the latest 1.57.1, and still not working.

Current Behaviour

No response

Expected Behaviour

No response

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Comments: 38 (15 by maintainers)

Most upvoted comments

Ok,

Local debug setup with the following values didn’t work:

  • Shell scripts location: ~/bin
  • Tools Install location: `` # leave it blank

If I set explicitly to be the same hinted, it fails showing cannot find the shell scripts:

  • Shell scripts location: ~/bin
  • Tools Install location: ~/Library/Application Support/JetBrains/Toolbox

I was debugging a little bit more, and without uninstalling Fleet I was able to make it work with the following changes

# src/util.ts#330

export const getV2History = async (): Promise<AppHistory[]> => {
-  const scriptDir = (await getSettings())?.shell_scripts.location ?? bin;
+ const scriptDir = (await getSettings())?.shell_scripts.location.replace("~", homedir()) ?? bin; 
  return (

Inside the getV2History function the shell_scripts location is not properly transformed 😃

That’s great, thanks so much for helping debug that. I’ll get a release sorted that handles that properly. I see the issue with Space, Fleet and dotTrace, so the fix above applies for those three applications until I get that out.

One thing worth mentioning, it seems to me the GLOB search can be failing. As the way Toolbox 2.x works with the installed tools differs from previous versions:

const ICON_GLOB = resolve(homedir(), "Applications/JetBrains Toolbox/*/Contents/Resources/icon.icns");
const HISTORY_GLOB = resolve(toolsInstall, "apps/**/.history.json");
const CHANNEL_GLOB = resolve(toolsInstall, "channels/*.json");
const APP_GLOB = resolve(toolsInstall, "apps/**/*.app");
const SETTINGS_GLOB = resolve(toolsInstall, ".settings.json");

console.log(toolsInstall)
console.log(ICON_GLOB)
console.log(HISTORY_GLOB)
console.log(CHANNEL_GLOB)
console.log(APP_GLOB)
console.log(SETTINGS_GLOB)

# Output:

# 00:29:38.627 /Users/roi/Applications
# 00:29:38.627 /Users/roi/Applications/JetBrains Toolbox/*/Contents/Resources/icon.icns
# 00:29:38.627 /Users/roi/Applications/apps/**/.history.json
# 00:29:38.627 /Users/roi/Applications/channels/*.json
# 00:29:38.628 /Users/roi/Applications/apps/**/*.app
# 00:29:38.628 /Users/roi/Applications/.settings.json

I was able to fix it while debugging the extension locally by adjusting the CHANNEL_GLOB to the proper path:

export const toolboxAppSupport = "~/Library/Application Support/JetBrains/Toolbox".replace("~", homedir())
const CHANNEL_GLOB = resolve(toolboxAppSupport, "channels/*.json");

I would say that an easy fix would be to add a third configuration option pointing to ~Library/Application Support/JetBrains/Toolbox folder. Worth mentioning too, Fleet has a very different folder layout and thus not gonna be compatible.