Skip to main content

Intellij CheatSheet

Select File in Project View

Allow you to highlight and select the file in editor in the project view sidebar. Useful when have the file open but the folders closed in project view. There is no default shortcut for this action, so I normally set it to Alt + 0 In Settings > Keymap, under Other > Bookmarks -> Select File in Project View.

Editor Tabs

Show tabs in multiple rows: Settings > Editor > General > Editor Tabs > Apperance > Show tabs in: change from the default One row to Multiple rows.

Define custom folding regions

Use //region and //endregion to define custom folding regions in the code.

public class CommonFields {

//region Time Start

public static void timestamp(Field.FieldsBuilder builder, SchemaContext context, String name, String comment) {
MessageRef timestamp = new FirestoreTimestampModel(context).toMessage().reference();
builder.message(name, timestamp, comment);
}

/**
* All the firestore document has create and update time
*/
public static void createUpdateTime(Field.FieldsBuilder builder, SchemaContext context) {
MessageRef timestamp = new FirestoreTimestampModel(context).toMessage().reference();
builder.createdAt(timestamp)
.updatedAt(timestamp);
}

public static void startEndTimeDuration(Field.FieldsBuilder builder, SchemaContext context) {
MessageRef timestamp = new FirestoreTimestampModel(context).toMessage().reference();
builder.message("startTime", timestamp, "Start time of event in epoch milliseconds")
.message("endTime", timestamp, "End time of event in epoch milliseconds")
.integer("duration", "Duration of event in minute");
}

//endregion
}