GithubHelp home page GithubHelp logo

Comments (6)

cgrushko avatar cgrushko commented on May 7, 2024

Interesting. I can't reproduce this using a very similar command line on a mac. (I didn't test it on Windows, I'm glad it works fine, usually).

1/ Can you post a hexdump of your file, so I'm sure I have exactly the same file?

This is what I have:

$ cat main.kt
fun main(){
println("test")
}
$ hexdump main.kt
0000000 66 75 6e 20 6d 61 69 6e 28 29 7b 0a 70 72 69 6e
0000010 74 6c 6e 28 22 74 65 73 74 22 29 0a 7d 0a
000001e

2/ And to be sure, the extension is .kt, right?
3/ Is this the minimal repro? can you remove the println and keep it failing?

from ktfmt.

russellw avatar russellw commented on May 7, 2024

from ktfmt.

cgrushko avatar cgrushko commented on May 7, 2024

Weird; this means that kotlin-compiler chokes on CRLF? does IntelliJ not produce CRLF under certain circumstances?

Anyway, sounds like we can fix it by converting CRLF (and CR) to LF before feeding it to kotlin-compiler. IIRC google-java-format's engine (which ktfmt is using) will produce only LF anyway.

Is this something you'd like to try to tackle?

from ktfmt.

arturbosch avatar arturbosch commented on May 7, 2024

You could use org.jetbrains.kotlin.com.intellij.openapi.util.text.StringUtilRt.convertLineSeparators(content) to normalize the content before parsing it to a KtFile.

from ktfmt.

russellw avatar russellw commented on May 7, 2024

from ktfmt.

cgrushko avatar cgrushko commented on May 7, 2024

from ktfmt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.