Brais Gabin
08/21/2022, 3:55 PM.trimMargin()
after a KtStringTemplateExpression
but I don’t know how to manipulate the psi to do that. I tried to find an example in the ktlint code base but the ones that I find doesn’t work for my use case.jlleitschuh
08/24/2022, 10:58 PMLucas Mo
08/27/2022, 12:04 AMStylianos Gakis
08/30/2022, 3:43 PMDavid Smith
09/05/2022, 12:56 PMwhere A: X, A: Y
does anyone know how I can find this information out from the PSI? There seems to be zero documentation on the PSI?Paul Dingemans
09/08/2022, 5:49 AMAlex
09/14/2022, 10:20 AMPaul Dingemans
09/14/2022, 11:54 AMshaktiman_droid
09/19/2022, 7:10 PM-----------
* What went wrong:
Execution failed for task ':sample-android:runKtlintCheckOverKotlinScripts'.
> A failure occurred while executing org.jlleitschuh.gradle.ktlint.worker.KtLintWorkAction
> com/pinterest/ktlint/core/KtLint$Params
eygraber
09/21/2022, 4:47 AMcontinuation_indent_size
ever going to be properly implemented? I feel like every other year I have this massive changeset because ktlint can't decide if it will or won't allow it.
I would very much appreciate if it worked though because Intellij/AS provides a value for it in their formatter, and since I have it set to 2 there, I'd like to be able to do the same with ktlint.Paul Dingemans
09/21/2022, 5:48 AMeygraber
09/21/2022, 6:03 AMnbadal
09/27/2022, 4:30 PMParseException
is deprecated with a note about letting you know if there's a valid use case 😄 Does KtLint.lint(params)
no longer throw this exception externally? If it does, I'd love to continue catching it as an exclusion for error reporting.Paul Dingemans
09/27/2022, 4:50 PMnbadal
09/27/2022, 6:44 PMRule(id: String)
has been removed at some point (though I do see the second parameter has a default). If I try to load a pre-0.44 ruleset JAR into 0.44-0.47, it complains of:
java.lang.NoSuchMethodError: 'void com.pinterest.ktlint.core.Rule. (java.lang.String)'
Perhaps it requires a @JvmOverloads
annotation?Sha Sha Chu
09/27/2022, 7:34 PMmy-custom-ruleset:my-custom-rule
. now it seems we explicitly put the ruleset name in the Rule
(e.g. https://github.com/pinterest/ktlint/blame/master/ktlint-ruleset-experimental/src/m[…]t/ktlint/ruleset/experimental/DiscouragedCommentLocationRule.kt) which seems to make any given Rule
class less portable. can you describe why we made that change?epool
10/07/2022, 12:43 AM.editconfig
like
[*/something/*.kt]
ktlint_disabled_rules = all
Piotr Krzemiński
10/17/2022, 7:35 AMSha Sha Chu
10/31/2022, 8:37 PMindent
rule to make it easier to understand and maintain. We've both locally run it on a few large codebases and haven't noticed any issues, but we would really appreciate if you all would try out the latest SNAPSHOT
build and file any bugs that you see so that we can get them fixed before the next release.Stylianos Gakis
11/07/2022, 10:36 AMPaul Dingemans
11/07/2022, 5:30 PMPiotr Krzemiński
11/30/2022, 2:41 PMPiotr Krzemiński
12/02/2022, 2:21 PMChanging log factory from com.pinterest.ktlint.core.internal.LoggerFactory to com.pinterest.ktlint.core.internal.LoggerFactory
java.lang.Throwable
at org.jetbrains.kotlin.com.intellij.openapi.diagnostic.Logger.logFactoryChanged(Logger.java:76)
...40 other lines
which is mildly annoying 🙂
related issues:
• https://github.com/jeremymailen/kotlinter-gradle/issues/254
• https://github.com/jeremymailen/kotlinter-gradle/issues/110
• https://github.com/pinterest/ktlint/issues/1497
All issues point to some kind of non-determinism, and I didn’t manage to pin down when it exactly happens and when it doesn’t.
The stack trace goes through this place in ktlint and this place in intellij-community which actually prints the stack trace: ExceptionUtil.getThrowableText(new Throwable())
. It’s generally unusual to print such stack trace unless some debug API is called.
How about we try to remove this track trace, i.e. contribute to intellij-community? Then this log will produce a single line which won’t be painful. Alternatively, we can try to use a proper logger and print the stack trace if DEBUG level is enabled, but it might be a chicken-egg problem since we’re changing logger factories, so which logger should we use?
WDYT?Paul Dingemans
12/02/2022, 4:56 PMSha Sha Chu
12/16/2022, 1:13 AMPaul Dingemans
12/17/2022, 8:15 PM0.48.0
release regarding incorrect removal of the semicolon in an enumeration which contains code after the semicolon. Although this only occurs in enumerations having a primary constructor, it leads to code which no longer compiles. A fix will be made available via a snapshot build soon. If you do no want to use a snapshot build, you can suppress the no-semi rule temporarily (see issue description).
We will wait a couple of days to see if more bugs are reported before we decide when a patch release will be released. Due to holidays, it might happen that this has to wait till early January.Matt Groth
12/20/2022, 6:05 PM.kts
kotlin code:
ExperimentalParams(
text = code,
script = true,
cb = { _: LintError, _: Boolean ->
}
But now that this is deprecated, its unclear how I would format kts
code. KtLintRuleEngine.format
internally creates a Code
instance as seen below:
public fun format(
code: String,
filePath: Path? = null,
callback: (LintError, Boolean) -> Unit = { _, _ -> },
): String =
format(
Code(
text = code,
fileName = filePath?.absolutePathString(),
),
callback,
)
The script
property of Code
is false by default. However, both the function above and the Code
class is internal. So I don’t know what the proper way is to format .kts
code strings since I can’t find a public property or argument for setting script
to true any more.Paul Dingemans
12/20/2022, 6:48 PMMatt Groth
12/20/2022, 6:53 PMMatt Groth
12/20/2022, 6:55 PM