What is LightEdit Mode?
As we talked about in an earlier blog post, LightEdit mode lets you use IntelliJ IDEA’s text editing features without creating or opening a dedicated project. In LightEdit mode, a file is opened in a separate editor window which may coexist with other (project) windows.
The mode has certain limitations: it offers simpler code completion (or sometimes none at all), no code inspections, only basic code highlighting that doesn’t require sophisticated code analysis, and so on. But if you just need to open a single file, make a few changes, and save, LightEdit is the quickest way to do it, and you don’t have to use a third-party editor either.
How does it work?
If you have an `idea` launcher script (Linux/MacOS) or `idea(64).exe` (Windows), you can open any file just by passing it as a parameter to the launcher:
The same can be accomplished if a file is associated with the launcher script or executable in a system file manager. Then, click on a file, for example in Windows Explorer or Finder, to launch IntelliJ IDEA with the file opened in LightEdit mode:
There is one exception though: if the project to which the file belongs is already open, it will be opened in the project window as usual, that is, LightEdit mode will not activate.
Note: When IntelliJ IDEA is already running, the launcher doesn’t start another instance, but only makes the already running process create an editor window.
Basic Git integration is available at the moment. If you open a file in the Git repository, you’ll see a widget showing the current Git branch. Changes to the file are also shown in the editor, similar to usual project mode. Expect more things to come in the future such as Git history, commits, and so on.
Switching to Project mode
Whenever you feel a few simple changes won’t be enough, and you need to use the capabilities of a full-blown IDE, you can switch to project mode right away. Go to File | Open File in Project…, or select Open File in Project… from the context menu, or choose the “Open File in Project” intention by using Alt+Enter:
If the file is already under a project root, the project will be opened and an editor tab with the file will appear there. If not, you will be prompted to choose a root directory where an IntelliJ IDEA project will be created. The IDE will attempt to find a good location for the project root based on the presence of a Git repository, Gradle build files, and so on. But in any case, you can change it before creating the project.
We will continue to enhance LightEdit in future IntelliJ IDEA releases so that you can do even more in a projectless mode. And of course, hearing back from you is really important. If you have an improvement idea or run into a usability problem, please let us know by creating a YouTrack ticket. Thanks!