-
Notifications
You must be signed in to change notification settings - Fork 76
Insert kdocs #1406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Insert kdocs #1406
Conversation
* ### Examples: | ||
* ```kotlin | ||
* // Insert a new column "age" under the column group with path ("info", "personal"). | ||
* df.insert(age).under(pathOf("info", "personal")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love the examples, the main problem as usual - the update of these examples, but if we are close to the 1.0 - let's practice with it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One day we can move it to tests and add to KDocs using kodex ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually yes! That's already possible. You can use @sample [link.to.sample]
; KoDEx even recognizes // SampleStart
etc, so we can reuse Korro samples even :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just never used this before because I preferred the examples be clickable, but maybe this kdoc/dokka team is working on that!
* }.under("math") | ||
* ``` | ||
* | ||
* @param name The name of the new column to be created and inserted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, for the gods of readability I'd prefer @param [name] The name
with brackets - it helps me to read KDocs in the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good job :)
@@ -83,7 +83,7 @@ internal class InsertAfter0 : AbstractInterpreter<PluginDataFrameSchema>() { | |||
|
|||
override fun Arguments.interpret(): PluginDataFrameSchema { | |||
return receiver.df.asDataFrame() | |||
.insert(receiver.column.asDataColumn()).after(column.col.path) | |||
.insert(receiver.column.asDataColumn()).after { column.col.path } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this does nothing, the compiler plugin lives in kotlin now ;P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just like the whole project be able to build. May be we should disable build of plugin module then?
@@ -137,6 +137,11 @@ internal const val COL_TYPE_INSTANT = | |||
"kotlinx.datetime.Instant is deprecated in favor of kotlin.time.Instant. Either migrate to kotlin.time.Instant and use ColType.StdlibInstant or use ColType.DeprecatedInstant. $MESSAGE_1_0 and migrated to kotlin.time.Instant in 1.1." | |||
internal const val COL_TYPE_INSTANT_REPLACE = "ColType.DeprecatedInstant" | |||
|
|||
internal const val INSERT_AFTER_COL_PATH = | |||
"This `after()` overload will be removed in favor of `after { }` with Column Selection" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary line break
* ### Examples: | ||
* ```kotlin | ||
* // Insert a new column "age" under the column group with path ("info", "personal"). | ||
* df.insert(age).under(pathOf("info", "personal")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually yes! That's already possible. You can use @sample [link.to.sample]
; KoDEx even recognizes // SampleStart
etc, so we can reuse Korro samples even :)
* // for subsequent rows, it's the sum of the two previous Fibonacci values. | ||
* val dfWithFibonacci = df.insert("fibonacci") { | ||
* if (index() < 2) 1 | ||
* else prev()!!.newValue<Int>() + prev()!!.prev()!!.newValue<Int>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eyy! Now possible because of the switch to AddExpression, nice ;)
*/ | ||
interface InsertSelectingOptions | ||
|
||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget everything explicitly written in Kotlin code needs to be bold. You forgot one insert
and all braces and commas should also be bold
* **[`insert`][insert]**`(column: `[`DataColumn`][DataColumn]`)` | ||
* | ||
* {@include [Indent]} | ||
* `| `[`insert`][insert]`(name: `[`String`][String]`, infer: `[`Infer`][Infer]`, rowExpression: `[`RowExpression`][RowExpression]` }` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm this 'or' looks a bit weird. I think it would look better on the same line as the previous insert
, but then the line might be a bit too long. Or it could have grouping braces ()
* | ||
* Works only with existing column groups. | ||
* To insert into a new column group, use the overloads: | ||
* `under(path: ColumnPath)` or `under(column: String)`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you create and link to an issue if we're gonna fix this?
* ### Examples: | ||
* ```kotlin | ||
* // Insert a new column "age" under the column group with path ("info", "personal"). | ||
* df.insert(age).under(pathOf("info", "personal")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just never used this before because I preferred the examples be clickable, but maybe this kdoc/dokka team is working on that!
closes #1386