How to associate types of files in Mac Finder to be opened by IntelliJ IDEA in "LightEdit" mode if I am a JetBrains Toolbox user? - macos

IntelliJ IDEA 2020 can (finally!) simply open a file to be edited, without a project being involved. This is called LightEdit mode.
At this point in a JetBrains video, we see the host platform's file manager app opening a file via IntelliJ while noting that all such files should be opened using that same tool.
No "IntelliJ" application to choose
The problem for me is that I am a happy user of JetBrains Toolbox app to automatically install, upgrade, and open IntelliJ. So in my "Applications" folder on macOS, I have no "IntelliJ" application to choose in the Mac Finder when trying to open a file.
Is there some other way or trick to getting the Finder to know to open files with IntelliJ? And preferably with the latest version, as I believe Toolbox may keep around the older versions.
Basically, I am asking the same as this Question, How to make available “open this project in IntelliJ IDEA” option in Windows context menu, if IntelliJ IDEA has been installed via JetBrains Toolbox?, but for macOS instead of MS Windows. The Answer on that other Question is Windows-specific.

As a Toolbox user you still have access to the "generated shell scripts" (/usr/local/bin/idea, or things like /usr/local/bin/phpstorm, /usr/local/bin/pycharm, etc for individual applications).
But, these are shell scripts, and cannot be used for this because they lack the application identifiers needed by the OS for launching apps.
What you can do is wrap any of this with an Automator application. By wrapping the shell script directly, it should remain updated (since the shell script is itself a Toolbox generated wrapper that points to the latest installed version).
To do so:
Open Automator and click on the "new document" button.
Select "Application".
Add a "Run shell script" action from the library:
Change the "pass input" dropdown from "to stdin" to "as arguments".
Create a script similar to this this (replace phpstorm with idea or whatever IDE you have installed):
for file in "$#"
do
/usr/local/bin/phpstorm -e "$file"
done
Save the application somwhere, with a descriptive name:
Once that one is saved, you'll be able to use it to launch files from Finder, or even set it as default for a file type:

Use the app's menu: IntelliJ IDEA -> Preferences -> Editor -> File Types
Then press the Associate File Types with IntelliJ IDEA button.
A window will open with file groups you could choose from, and then press the OK button, then Apply and another OK.
After this, a MacOS restart is required.

Related

Open folder as project in PhpStorm

When I install PhpStorm from JetBrains Toolbox app I do not have an option to open folders as project when right clicking
Sadly JetBrains Toolbox App does not provide such functionality. Only standalone installer has an option to make them right now. You will have to either use that... or create such entries manually.
https://youtrack.jetbrains.com/issue/TBX-2478 -- watch this ticket (star/vote/comment) to get notified with any progress.
To add an entry to the Windows Explorer's right-click menu:
you can use FileTypesMan by NirSoft or a similar tool.
or create such entry manually, e.g. see this comment for a basic .bat file: https://youtrack.jetbrains.com/issue/IDEA-114307#comment=27-2125363 (at very least it lists Registry keys where to create such an entry).
I found this from Jet Brains :
Click Open on the Welcome screen or select File | Open from the main menu.
In the Select Path dialog, select the directory that contains the project to open.
Drag the desired project from your file chooser right to the Open Project dialog without locating it there. The respective file in the dialog will be found automatically.
Specify whether you want to open the project in a new window, close the current project and reuse the existing window, or open the new project in the same window with the current one. Refer to the Opening multiple projects section for details.
and for the command line you could use this :
<PhpStorm> <path_to_the_project folder>
See Open files from the command line for more information.

Debugging a Quick Look plugin

I'm fairly new to OSX development. I'm currently writing an app which has its own (cross-platform) custom XML-based file type.
I want to write a quick look plugin so that things look good in the finder, and have found the tutorial on how this is supposed to work, but apparently I must be doing something wrong since I see in /var/log/system.log that I get a segfault when my Quick Look plugin is ran. I'd like to see where it's crashing, but I can't for the life of me figure out how to do that.
Where does OSX store core dumps (if it even does that)? Do I need to set some system option or something to enable that?
How do I get Xcode to look at these core dumps?
I'm lost.
EDIT SIP prevents you from debugging protected processes. Because of that, it is currently (at least since SIP was introduced, through Mojave) impossible to debug QuickLook plugins without turning off SIP, at least partially.
As you've probably discovered, since your QuickLook plugin is a plug-in instead of a standalone executable, you need to debug the process that hosts the plugin. To do that, you can hook yourself to the qlmanage executable.
The first step is to make your .qlgenerator plugin available to the Quick Look server. To do that, you need to copy it to ~/Library/QuickLook and run qlmanage -r. The first can be implemented as a post-build action, the second has to be specified in the debug options.
For the post-build action, you should follow these steps:
hit Alt+Cmd+R to open the run configuration window;
unfold the "Build" tab on the left and go to post-actions;
click the plus at the bottom of the window and select "New Run Script Action", and use the following code.
absolutely ensure the "Provide build settings from" is set to your QuickLook extension target.
rm -Rf "~/Library/QuickLook/$FULL_PRODUCT_NAME"
cp -R "$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME" ~/Library/QuickLook
qlmanage -r
Then, you need to configure Xcode to launch qlmanage:
in the same window, go to the "Run" tab, and select "Info";
in the executable drop-down menu, pick "Other...";
hit Shift+Cmd+G to enter a path, put in "/usr/bin/qlmanage", and select that file;
check "Debug executable" if it isn't already;
move to the "Arguments" tab, add a "-p" argument, and then add arguments as you see fit for the files that you need to preview.
Now, when you use the Run action, you'll be able to debug your plugin through qlmanage.
I haven't tried this personally, but this page:
Debugging Quicklook Plugin in Xcode 4.6
has a description of how to debug your plugin in Xcode 4 - 6. That will probably be much more useful than trying to grub through the core file after the fact.

How to load scripts from a custom folder in InDesign? like from a central repository

I would need a folder to be shared on the server and InDesign CS6 would need to load the scripts from that particular location.
Is this possible?
If you just want to include other scripts in your script you can do this:
$.evalFile(new File(mainscriptloc + "/c/some/folder/central.jsx"));
It will load central.jsx into the executing script just like an "include" file.
On a Mac? I found this solution useful:
http://tewha.net/2012/07/make-a-symbolic-link-from-finder/
The best way I found is to create a folder in any place you want your scripts to be (like a server) which is shared with all the users. Then to setup and run the scripts will be more tricky:
Open ExtendScript Toolkit
Open "Scripts" tab
Click on the top-right button and "Add Favorite"
Choose your path to the script and click ok
Now you can click on the drop down on the left and select "Favorites"
Click on the right drop down and click on your folder name
Double click on your script and run it
Now you are running scripts directly from the custom folder.
The startup script cannot be run from there... so it only works with scripts.
We create links in the users individual scripts folders that link back to the actual script in the central repository on Windows. The downside is of course that users will reasonable often accidentally copy the actual script, rather than a link to the script - and then they miss out on future updates to the script.
Below is an example of a typical users 'scripts panel' folder. Each of the shown shortcuts point at a file in our central repository.
When the user opens InDesign these shortcuts appear in their scripts panel the same way a regular script file would.
On a Mac, I suggest using symlinks (a special kind of OSX shortcut - go here for instructions and an Automator workflow download that will create one whenever you need it).
To create a shortcut, simply select the desired folder (recommended) or file located elsewhere on your computer/server and run the workflow (I suggest making a keyboard shortcut to the workflow as described in the instructions). Drag the shortcut created into your inDesign scripts folder and it will appear and operate exactly as the actual script or folder would in your Scripts Panel. Simply click on the link and inDesign will do the rest - you'll never know what you clicked is not the actual folder/file or that it's located elsewhere.
Note: if you create a shortcut to a script file rather than a folder, be sure to remove the extra text the workflow adds to the name (ie. when applied to "MyScript.jsx", the workflow will create a shortcut named "MyScript.jsx symlink". Remove the " symlink" part so inDesign will recognize the shortcut as a script file. Otherwise it will not run).
I've tested this with inDesign CC on my Mac and it works flawlessly.

Visual Studio Deployment Project Application Shortcut does not allow drag and drop file opening

I'm having an issue with an creating application shortcut on the desktop from a Visual Studio 2010 deployment project. The shortcut is created just fine, but when I go to drag and drop an application-specific file onto the shortcut, it doesn't work (the cursor turns into the red circle with a slash through it). On the other hand, if I go to the application directory and do this on the executable itself it works fine (it opens the file properly). The interesting part is if I manually create a shortcut to the executable after install, it also works to drag and drop files onto that.
Something that might be useful that I discovered when I was trying to fix this is that if I open up the properties dialog of both the shortcuts (the deployment project created one and the one I made manually), the manually created one has as its target the full path of the executable, whereas the other one just has the name of the executable (although its start in directory is correct). They both run the application when I double-click on them and they both have the correct icon displayed.
How do I get the deployment project created shortcut to allow drag and drop of executable files onto it to open them?
I had the same issue.
First i went here, which answers your question:
http://social.msdn.microsoft.com/Forums/en/vssetup/thread/b57f1d84-9b0c-4c29-b140-0555f92ffed8
But apparently support for orca.exe and WiRunSQL.vbs seems to have disappeared because I couldn't find it on msdn anywhere.
Then i found http://www.instedit.com which seems to have done the trick. I liked the automated answer of the vbs script, but oh well.

How do I Create a link to an executable Installed by Visual Studio Setup Project

I am working on a visual studio setup project. I want the setup project to install the executable for a windows forms project, and then put a link to that executable in the Programs Menu on the target machine. In the Setup Project I clicked 'Add'-> Project Output... and selected the Primary Output from my WindowsForms App. So that should install the program right? Ok, so next I went to the File System on the Target Machine, right clicked on the Primary output from WindowsForms App and said Create Shortcut. I then moved that shortcut into the User's Programs Menu folder.
I tried running the installer and it works ok but for some reason whenever I click shortcut that is in the Programs Menu It actually installs the program before running it every time. Why does it do this? Did I add a shortcut to the wrong thing? If I navigate to the directory application directory and click the .exe file it just opens the program without doing any install. Does anyone know what is going on?
I read somewhere that I could actually make a shortcut in windows explorer that targets my output .exe and then add that file to the installer project but I can't see how that would work on every machine it gets installed on.
I think this is how I did it... been a while tho.
Application Folder
Primary Output From MyProjectName (Active)
Right-Click => Create Shortcut
Then
Users Program Menu
Right Click => Add Folder
Go back to "Application Folder"
Move the shortcut over to the program menu
Rename it to whatever you need. The "Type" should say "shortcut"
Is that kinda what it looks like for you right now? Something in
* User's Program Files
* My App Folder
* Start My Application (shortcut)
And need I say, MS's install projects are a nightmare :) Just open the .VDproj and look. I never thought i'd say I like the csproj xml format, but in comparison...
The problem was not actually in how I was creating my shortcut but rather what the shortcut was pointing too. The executable that the shortcut was targeting was not in the main installation folder and for some reason it didn't like that. Restructuring the install directories a bit fixed it.

Resources