Skip to content

Implement formatter and use embedded Kotlin compiler #136

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

Merged
merged 8 commits into from
Aug 2, 2019
Merged

Conversation

fwcd
Copy link
Owner

@fwcd fwcd commented Aug 1, 2019

Fixes #27.

This PR integrates ktlint as a formatter. Since ktlint uses the embedded compiler, which is incompatible with the standard compiler (different import paths: com.intellij.* vs org.jetbrains.com.intellij.*), this PR also migrates this project's compiler dependency to the embedded version. Unfortunately, that breaks the Java-to-Kotlin converter.

Possible solutions would include writing our own J2K, using AST visitors, or somehow adapting the import paths of the official converter.

fwcd added 3 commits August 1, 2019 18:29
This ensures that no duplicate JARs are included in the runtime
classpath of the language server.
Provide compatibility with 'ktlint' and temporarily drop J2K support.
@fwcd fwcd added the enhancement New feature or request label Aug 1, 2019
fwcd added 5 commits August 1, 2019 23:09
Create a unit test which verifies that the formatter works as intended.
Formatting options determine the indentation size and style used by
the formatter.
Use embedded Kotlin scripting JVM host.
Additionally, implement Closeable instead of AutoCloseable on classes
which manage resources, so they can be used with Kotlin's
'use'-function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kotlin formatter
1 participant