Reformat code in IntelliJ IDEA (macOS) does not work - macos

Use IntelliJ IDEA for macOS. Problem
Whenever I do ⌥+⌘+L (shortcut to reformat code in macOS), code clean up does not apply.
I noticed that because I turned on the Final Modifier already (Make generated local variables final and Make generated parameters final in Settings: Editor -> Code Style -> Java -> Code Generation). But after shortcut, no finals are added.
However, if I do ⌥+⇧+⌘+L to open the reformat dialog and click run, it does add final to variables and parameters). It also work when I right click the file and choose reformat code.
I don't know why, isn't ⌥+⌘+L a shortcut that should do exactly the same thing?
This bring out my other question, is ⌥+⇧+⌘ really applying all my customize settings in Code Style and Inspections (assume I selected the right scheme (under Code Style) and profile (under inspections)?
My last question is, for example, let's say I have a custom scheme in IDE level for Code Style. Every time when I clone a project from let's say GitHub, how do I make the project automatically using my custom scheme instead of using the Project scheme and the Default scheme? Every time I have to go to Code Style and manually switch from "Stored in Project" to "Stored in IDE", so that I can select my custom scheme and click apply. Is there an easy way? Same for Inspections profile, I have to manually switch.
I have tried to solve these for so long, any help will be appreciated! Below are some links I found, but didn't solve my questions
Reformat code
Reformat file dialog
Code Style

Related

Mimic Sublime's handling of unsaved files in Atom

Sublime has this cool feature where you can create a new file (or modify an existing one) and close the text editor without having to explicitly save the modifications.
Next time the editor is opened, the unsaved modifications will still be there.
Is there a way to mimic this behaviour in atom?
This functionality is already included in Atom by default now.
Settings -> Core Settings uncheck Open Empty Editor on Start
Set Restore Previous Windows on Start to Always.
Settings -> Packages -> autosave. In package settings check Enabled.
Also, restore will not work in Atom unless at least one Project has been added to the Project pane. You can add anything there. You can just add my Documents folder.
This sublime feature is called hot exit. Although atom doesn't has this feature this package claims to implement it.
Note: I haven't tested it, so I don't know if it really works; be careful in order to avoid losing your work.

What's the fastest way to run T4MVC manually in VS 2013?

I'm working on a fairly large project that uses T4MVC. Due to the project size, it takes quite a long time to run my T4MVC template, so using AutoT4MVC is too slow for my scenario.
So every time I change something vital aboutm my action methods, I have to select the T4MVC template, right-click, then click "run custom tool". It's quite tedious and I'm sure there's a better way.
Since AutoT4MVC is not an option, is there any plugin or hack that would allow me to place a button on my IDE that will run the T4MVC template included in my project?
There is a menu item under Build -> Transform all T4 Templates. This will run all the templates in your solution. This command is also available on the Build toolbar, so if you turn that on (View -> Toolbars -> Build) you'll get the button you're looking for.
It should be possible to do basically what AutoT4MVC does, but based on some manual trigger. Or maybe you should suggest on https://github.com/bennor/AutoT4MVC to add a way to turn off automatic mode, and instead rely on a manual action.
I run T4MVC, but AutoT4MVC is a separate project that I'm less familiar with.

Is there a code snippet editor for Intellij Idea 13?

Visual Studio has Snippet Designer extension available for creating and managing custom code snippets. Is there something like this extension for Intellij Idea 13, or a way to simply add custom code snippets?
There's no extension that I'm aware of (and I'm not familiar with Snippet Designer), but that functionality exists in IntelliJ Idea.
Hit Preferences and start typing to find "Live Templates". Expand one of the existing ones to see some of the available functionality. You can set tab stops, cursor position, references to local variables. It's very handy.

Type ahead autocompletion in Eclipse

Do Eclipse have a plugin for type ahead autocompletion like Visual Studio, so I don't have to destroy my spacebar by pressing Ctrl+Space all the time? (If you don't know how it works in Visual Studio, please don't bother answering.)
And also, can I limit the autocomplete to imported packages, rather than every single Java class on earth? It's fustrating seeing suggestions from awt and swing etc., when I'm working with GWT. And I don't want to add every single Java class to the filter, that's just stupid. (Again, like how it's done in Visual Studio!)
Regarding your second part, yes you can
Open Eclipse
Select Window/Preferences from the menu
Expand Java/Appearance/Type Filters from the menu on the left
Click the "Add package" button, enter "java.awt" (without the quotes) and click OK
OK your way out
This will make Eclipse remove any matching classes from the java.awt package from your type ahead list. Very nice...
So "type-ahead" exists in Eclipse (mentioned in this status report in June 2006), but is synonym of auto-completion, most often triggered by CTRL+ Space... (which is not exactly what you are looking for)
To be more specific, the kind of automatic auto-completion (completion while you are typing, with a "Common" or "All" list of possible completions) you have in Visual Studio is not there in Eclipse (actually read below):
Original answer January 2010:
At least, not without a dedicating plugin.
And even with that plugin, it would have to follow a TemplateCompletionProcessor, meaning it would need a list of characters triggering said completion (again, not what you are looking for), by redefining method getCompletionProposalAutoActivationCharacters().
Update November 2011:
Cristi mentions in his answer (upvoted) a great workaround, which consists adding all the letters as Auto activation triggers for java.
See also "Automatically opening completion window in Eclipse".
From the thread "Eclipse auto-completion ":
Windows -> Preferences -> Java -> Editor -> Content Assist
Set delay to: 0 (actually >0 is better: 50, it avoids CPU picks because of constant listening)
Set triggers to:
.(abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV WXYZ#
My answer may come too late, but maybe will help others searching this feature in eclipse.
This workaround works for me (eclipse helios):
Go to Windows -> Preferences -> Java -> Editor -> Content Assist.
Here, enable Auto activation and set Auto activation delay to a low value, let's say 50 ms.
Then comes the workaround: In Auto activation triggers for java, simply put all the characters: abcdefghijklmnopqrstuvwxyz.
And there you go, just type something.
Completion is triggered when pressing ".", if that is what you are referring to as "type-ahead autocompletion". This is what Visual Studio also does, unless you are referring to another Visual Studio feature I'm unaware of.
Limiting completion to only imported packages I think is a somewhat unorthodox thing to do; you are forced to rely on wildcard imports to define the set of types to complete on. I think most users would consider that less than useful. You're welcome to elaborate on your use case for this, though. For example, why would you want to exclude all Java classes from completion?
BTW, using "type filters" (as VonC suggests) doesn't require you to add every single class. I typically (globally) exclude java.awt.*, sun.com.*, org.omd.*, and a few others. Eclipse also sorts completion according to a (type-sensitive) heuristic which usually results in the most relevant types being displayed at the top. For example, auto-completion inside a method call will put the variables which matches the method type signature at the top.
I know that Claus spoke of Java in the second part of his question, but the general question is about any language in Eclipse (no Java tag here), so the following might be of use to python eclipse coders:
Go to Windows -> Preferences -> PyDev -> Editor -> Code Completion. Here, check the box next to "Request completion on all letter chars and '_'?".
(Purposefully similar to Cristi's answer.)

How do I set up a custom build step in Visual Studio 6?

Unfortunately it looks like for various reasons I'm going to have to use Visual Studio 6 instead of a newer version of VS.
It's been a long time since I've used it. I'm looking through its menus and don't see any obvious way to set up any custom build steps (pre-build, post-build, pre-link... anything would help actually).
Can anyone give me instructions on how to set up steps like this?
Open your project, then open the Project Settings screen (Project → Settings or ALT-F7). Alternatively, right click on a file in the FileView and select Settings.
From the Project Settings screen, go to the General tab and check "Always use custom build step". This means that the file you just chose will be an input file for a custom build step. From the "Custom Build" tab you can then give the commands to run and specify what files will be generated.
For pre-link, post-build and such, select an executable (or library) from the Project Settings screen. Then use the little arrow button to scroll to the rightmost tabs. From there you'll find the Pre-link and Post-build steps.
It's quite simple, really, I'm sure this is enough to get you started.

Resources