In Intellij, if I have an error in a source file, then when building I can choose "Exclude from Compile" by right-clicking on the file in the build output.
But, now I would like to include the file again. Where is the menu item that lets me put it back into the build? (The file shows in the Project window, and has a small 'x' in its icon to show it is excluded, but I see no way to get this to go away.)
Edit - I found there is a compiler.xml file, and I found I can delete the file from the "excludeFromCompile" section, but still, there must be a menu item somewhere to do this.
Settings | Compiler | Excludes.
For Intellij 14.0 on Windows, undo excludes from compilation
File -> Settings
Then inside Settings -> Build, Execution, Deployment -> Compiler -> Excludes
or just search for "excludes" to find it.
Note in IDEA v12, there is no longer a File | Settings menu option.
I'm not sure how to exclude/re-include individual files, but this is how it works for folders...
Now the menu item is File | Project Structure... and that brings up a multi-column dialog.
In the rightmost column, click Modules, then select the directory that contains the excluded folder in the second column.
If it is a folder you are trying to re-include, it is listed in the third column's directory list, and excluded folders are at the bottom, in red.
If you click on the red 'X' to the right of the folder name, it will remove the folder from the "excluded" list which has the effect of including it back in the project. Awkward and counter-intuitive, but that's how it works.
I found that johnkaplantech's answer didn't work because Idea would complain about multiple modules sharing the same root.
So I manually edited the project files to remove the exclusion. File modified was %ProjectRoot%/.idea/modules/<ModuleName>.iml. Inside module/component/content of this XML file was a tag excludeFolder. Remove that.
In IntelliJ IDEA 15.0.3 File | Settings | Build, Execution, Deployment | Compiler | Excludes | (Remove path from right list).
For Mac it would be :
1) Go to Preferences:
2) Expand Build, Execution,Deployment section
3) Expand Compiler sub section
4) All the excluded classes will be available in the Excludes
5) Delete the classes you want include for compilation and press Ok.
Hope it helps.
From menu:
File | Settings | Compiler | Excludes: you can add/remove excluded files to be compiled in the dialog.
For me excluded folders did not appear neither under File > Settings> Compiler > Excludes nor File > Project Structure > Modules > Sources > Exclude.
What I did was: I clicked on the excluded folder with right-click of the mouse. In the menu which opened there is an option "Mark Directory as". I chose "Not Excluded".
A simple workflow is to create a directory in your project and exclude the entire directory.. For example, create a directory called, 'excluded'... add files to exclude... right click directory > mark directory as excluded... If you want to add or remove files from that directory reverse the process... cancel exclusion on the directory, get/put files... mark as excluded again.
To configure classes to be excluded from import open:
Editor / General node, then click Auto-Import.
This works for me. You can also find this in the documentation:
IntelliJ was still excluding a file after I removed it from the compiler exclude folder. It turns out I had also excluded it in File > Project Structure > Modules > Sources > Exclude files (at the bottom of the window).
Nothing to worry about. Simply follow this steps Mac/ windows
File > Settings >
Build, execution, deployment > Excludes
Select the file that you selected as exclude from compile (mistakenly)
Finally delete it and Press ok.
Now you can run the program/code again.
Congratulations!! Problem solved
I had the same problem of exclude things, and my solutions where:
Tuve el mismo problema de sacar sin querer cosas que no debía y mi soluciones fueron:
Case 1:
IntelliJ IDEA ->Preferences -> Build,Excecution, Deployment ->Build Tools (my case) -> Maven -> Maven ->IgnoredFiles (uncheck the relevant option )
Caso 1:
Me pasó lo mismo y mi solución fue ir (en Mac) a:
IntelliJ IDEA ->Preferences -> Build,Excecution, Deployment ->Build Tools (en mi caso) -> Maven -> IgnoredFiles (destildar la opción, en mi caso el file en cuestión
Case 2:
IntelliJ IDEA ->Preferences -> Build,Excecution, Deployment -> Compiler -> Excludes and select the relevant option -> minus or plus
Caso 2:
IntelliJ IDEA ->Preferences -> Build,Excecution, Deployment -> Compiler -> Excludes and select the relevant option -> clickear en el signo más o en menos según corresponda
Up-to-date in 2023:
Go to Editor > File Types > Ignored Files and Folders tab
Remove the file/folder pattern you want to include again.
Related
How to exclude a single file from module output? I have seen the field "excluded files" in the module configuration (File -> Project structure -> modules) and tried to enter a pattern like that one:
path\to\file\*Server*
in order to exclude the class
path.to.file.MyServer
but it doesn't work
You should go to Settings | Build, Execution, Deployment | Compiler | Excludes and add your file name to the list.
Is there any way how to open/navigate certain file in current project just by hitting one key? How to map the shortcut to do this?
For example I have three files "file-one.php", "file-two.php" and "file-three.php" and when I press F12, editor would open file "file-three.php" and focus main editor window.
You can do this -- using Bookmarks with mnemonics.
You can bookmark actual file instead of particular line (yes, you can do it -- just do it while focus is in Project View panel) -- you will see assigned mnemonic symbol next to the file name.
In general:
Shortcuts are rather predefined and limited to 10 only ("Bookmark 0" ... "Bookmark 9").
By default it will be Ctrl + 1 on Windows (depends on keymap used) .. but you may replace them by another one (look for Other | Bookmarks | Go to Bookmark 0 and so on in Settings/Preferences | Keymap).
Obviously ... bookmarks are project specific while shortcuts are IDE-wide setting.
Useful links:
Creating bookmarks with mnemonics
Navigating across the project
Keymap
NOTE: if you delete such bookmarked file (e.g. a log file that gets deleted on daily basis etc) .. then such association/bookmark will be lost once IDE will not be able to locate that file/target.
So either always keep that file present (make empty instead of deleting it) .. or re-bookmark it again.
Maybe you should try Recent Files function! Press ⌘E or ^E and you will get a list of recent files, then just type file name and it will filter redundant files.
Document:
https://www.jetbrains.com/help/phpstorm/navigating-to-recent-file.html
How do you auto-indent your code in the Atom editor? In other editors you can usually select some code and auto-indent it.
Is there a keyboard shortcut as well?
I found the option in the menu, under Edit > Lines > Auto Indent. It doesn't seem to have a default keymap bound.
You could try to add a key mapping (Atom > Open Your Keymap [on Windows: File > Settings > Keybindings > "your keymap file"]) like this one:
'atom-text-editor':
'cmd-alt-l': 'editor:auto-indent'
It worked for me :)
For Windows:
'atom-text-editor':
'ctrl-alt-l': 'editor:auto-indent'
The accepted answer works, but you have to do a "Select All" first -- every time -- and I'm way too lazy for that.
And it turns out, it's not super trivial -- I figured I'd post this here in an attempt to save like-minded individuals the 30 minutes it takes to track all this down. -- Also note: this approach restores the original selection when it's done (and it happens so fast, you don't even notice the selection was ever changed).
1.) First, add a custom command to your init script (File->Open Your Init Script, then paste this at the bottom):
atom.commands.add 'atom-text-editor', 'custom:reformat', ->
editor = atom.workspace.getActiveTextEditor();
oldRanges = editor.getSelectedBufferRanges();
editor.selectAll();
atom.commands.dispatch(atom.views.getView(editor), 'editor:auto-indent')
editor.setSelectedBufferRanges(oldRanges);
2.) Bind "custom:reformat" to a key (File->Open Your Keymap, then paste this at the bottom):
'atom-text-editor':
'ctrl-alt-d': 'custom:reformat'
3.) Restart Atom (the init.coffee script only runs when atom is first launched).
Package auto-indent exists to apply auto-indent to entire file with this shortcuts :
ctrl+shift+i
or
cmd+shift+i
Package url : https://atom.io/packages/auto-indent
I prefer using atom-beautify, CTRL+ALT+B (in linux, may be in windows also) handles better al kind of formats and it is also customizable per file format.
more details here: https://atom.io/packages/atom-beautify
You can just quickly open up the command palette and do it there
Cmd + Shift + p and search for Editor: Auto Indent:
This works for me:
'atom-workspace atom-text-editor':
'ctrl-alt-a': 'editor:auto-indent'
You have to select all with ctrl-a first.
This is the best help that I found:
https://atom.io/packages/atom-beautify
This package can be installed in Atom and then CTRL+ALT+B solve the problem.
On Linux
(tested in Ununtu KDE)
There is the option in the menu, under Edit > Lines > Auto Indent or press Cmd + Shift + p, search for Editor: Auto Indent by entering just "ai"
Note: In KDE ctrl-alt-l is already globally set for "lock screen" so better use ctrl-alt-i instead.
You can add a key mapping in Atom:
Cmd + Shift + p, search for "Settings View: Show Keybindings"
click on "your keymap file"
Add a section there like this one:
'atom-text-editor':
'ctrl-alt-i': 'editor:auto-indent'
If the indention is not working, it can be a reason, that the file-ending is not recognized by Atom. Add the support for your language then, for example for "Lua" install the package "language-lua".
If a File is not recognized for your language:
open the ~/.atom/config.cson file (by CTRL+SHIFT+p: type ``open config'')
add/edit a customFileTypes section under core for example like the following:
core:
customFileTypes:
"source.lua": [
"conf"
]
"text.html.php": [
"thtml"
]
(You find the languages scope names ("source.lua", "text.html.php"...) in the language package settings see here)
If you have troubles with hotkeys, try to open Key Binding Resolver Window with Cmd + .. It will show you keys you're pressing in the realtime.
For example, Cmd + Shift + ' is actually Cmd + "
You could also try to add a key mapping witch auto select all the code in file and indent it:
'atom-text-editor':
'ctrl-alt-l': 'auto-indent:apply'
I was working on some groovy code, which doesn't auto-format on save. What I did was right-click on the code pane, then chose ESLint Fix. That fixed my indents.
If you are used to the Eclipse IDE or the Netbeans, you can use the package eclipse-keybindings (https://atom.io/packages/eclipse-keybindings):
This Atom package provides Eclipse IDE key mappings for Atom. Currently, the Eclipse shortcuts are directly mapped to existing Atom commands.
To format all lines from a file, just use: Ctrl+Shift+F.
Ctrl+Shift+i worked for me in PHP under Windows ... but some files did not react. Not being the brightest it took me a while to work out that it was the include files that were the problem. If you are using echo(' ... PHP ...') then the PHP does not get re-formatted. To get over this, create a temporary PHP file, say t.php, copy the PHP part into that, reindent it (Ctrl+Shift+i ... did I mention that?) and then copy the newly reformatted PHP back into the original file. Whilst this is a pain, it does give you correctly formatted PHP.
How do I make IntelliJ IDEA insert a new line at every end of file,
so that GitHub doesn't complain for example?
Change your Editor settings:
Settings → Editor → General → Ensure line feed at file end on Save
For MAC users:
Preferences > Editor > General > Ensure every saved file ends with a line break
IntelliJ IDEA 2016.3
Approach 1
File > Settings... > Editor > General > Ensure line feed at file end on Save
Approach 2
Help > Find Action... (Ctrl+Shift+A) > type "Ensure line feed" > switch the toggle to ON (using the mouse click or Enter) for "Other: Ensure line feed at file end on Save" line
Possible alternative with a number of handy features is EditorConfig
Just submit an .editorconfig file to your repo
[*]
insert_final_newline = true
And it will work natively not only in Idea, but in all major IDEs (some require a plugin).
Now all team members would have same configuration, eol, eof, and no more tabs vs spaces :)
For Mac Users: IntelliJ Idea version 2020.2
Option1:
IntelliJ Idea -> Preferences -> General -> Ensure an empty line at the end of a file on save
Option2:
⬆️ + ⌘ + A or Or just click on Help from menu bar -> Find Action and then type Ensu and choose Ensure an empty line at the end of a file on save
General -> Save Files For IntelliJ IDEA 2020.
Check the Bottom Right Corner:
In latest versions of IntelliJ, the setting has been renamed to 'Ensure an empty line at the end of a file on save', and it has been moved under Setting>Editor>General>Save Files
This should have been a comment, but I wanted to add the screenshot as well so wrote as an answer.
As Rider (IDEA's cousin for .NET) is driving me crazy, this might be helpful for those writing C# as Ensure line feed at file end on Save alone won't work. It needs
File → Settings → Editor → Code Style → C# → Line Breaks and Wrapping → Line feed at end of file.
I don't remember changing it and I haven't imported any settings for sure, so I guess it's by default disabled.
With the IntelliJ Idea version 2020.3:
Go to File > Sttings > Editor > General > On Save
And then select/deselect "Ensure every saved file ends with a line break"
With the Intellij version 2022.3.1
Preferences (cmd + ,) > Editor > General > Ensure every saved file ends with a line break
Check, apply, and click ok
intellij
I am using IDEA 12. I cannot include /out directory into my project.
I tried Project Structure -> Modules -> MyModule -> Sources and then click on Exclude, but nothing happens. /out directory still remains excluded and red-colored.
Is this a bug or I am doing it wrongly?
Screenshot
I can't deselect Exclude to make folder included.
'Exclude output paths' option on 'Paths' tab relates to the module output path. The project output specified in File | Project Structure | Project | 'Project compiler output' is always excluded. If you really need to include it you can do the following:
Switch to 'Use module compile output path' option on 'Paths' tab for all modules.
Select 'Project' item in the left list and clear 'Project compiler output' field.
Reopen the project.
After that 'out' directory should become visible in the 'Project View'. However I recommend you to exclude actual module output subdirectories in the 'Sources' tab by hand. Otherwise IDEA may rescan and reindex output files generated by the compiler after each compilation and this can lead to performance problems.
It looks like Android specific bug, I've created a new issue, please vote:
IDEA-97776 Output is excluded from the project view regardless the "excluded folders" and "exclude output paths" settings