1 /* 2 * Copyright (c) Meta Platforms, Inc. and affiliates. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.facebook.ktfmt.intellij 18 19 import com.facebook.ktfmt.format.Formatter.GOOGLE_FORMAT 20 import com.facebook.ktfmt.format.Formatter.KOTLINLANG_FORMAT 21 import com.facebook.ktfmt.format.Formatter.META_FORMAT 22 import com.facebook.ktfmt.format.FormattingOptions 23 24 /** Configuration options for the formatting style. */ 25 internal enum class UiFormatterStyle(private val description: String) { 26 Meta("Meta (default)"), 27 Google("Google (internal)"), 28 KotlinLang("Kotlinlang"), 29 Custom("Custom"); 30 toStringnull31 override fun toString(): String = description 32 33 companion object { 34 internal fun getStandardFormattingOptions(style: UiFormatterStyle): FormattingOptions = 35 when (style) { 36 Meta -> META_FORMAT 37 Google -> GOOGLE_FORMAT 38 KotlinLang -> KOTLINLANG_FORMAT 39 Custom -> error("Custom style formatting options should be retrieved separately") 40 } 41 } 42 } 43