1 /* 2 * Copyright (c) Tor Norbye. 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.kdoc 18 19 class FormattingTask( 20 /** Options to format with */ 21 var options: KDocFormattingOptions, 22 23 /** The original comment to be formatted */ 24 var comment: String, 25 26 /** 27 * The initial indentation on the first line of the KDoc. The reformatted comment will prefix 28 * each subsequent line with this string. 29 */ 30 var initialIndent: String, 31 32 /** 33 * Indent to use after the first line. 34 * 35 * This is useful when the comment starts the end of an existing code line. For example, 36 * something like this: 37 * ``` 38 * if (foo.bar.baz()) { // This comment started at column 25 39 * // but the second and subsequent lines are indented 8 spaces 40 * // ... 41 * ``` 42 * 43 * (This doesn't matter much for KDoc comments, since the formatter will always push these into 44 * their own lines so the indents will match, but for line and block comments it can matter.) 45 */ 46 var secondaryIndent: String = initialIndent, 47 48 /** 49 * Optional list of parameters associated with this doc; if set, and if 50 * [KDocFormattingOptions.orderDocTags] is set, parameter doc tags will be sorted to match this 51 * order. (The intent is for the tool invoking KDocFormatter to pass in the parameter names in 52 * signature order here.) 53 */ 54 var orderedParameterNames: List<String> = emptyList(), 55 56 /** The type of comment being formatted. */ 57 val type: CommentType = comment.commentType() 58 ) 59