softwaremill / scala-clippy

Good advice for Scala compiler errors
Apache License 2.0
312 stars 20 forks source link

colors (colours) not working on windows 10 #40

Open cavapoo2 opened 7 years ago

cavapoo2 commented 7 years ago

I followed the instructions on setting up. Seemed to install fine, also running (clippyColorsEnabled) in sbt came back as true. I tried using these terminals cmd, gitmsys and powershell. The colors seems the same as before.

cavapoo2 commented 7 years ago

note it might be partially working. when compile error occurs on long line, then function name is coloured yellow, and towards the end of the line it changes to purple. if I reduce the one long line to 2 lines, then this time the function name is not coloured yellow, the purple towards the end of the line is still purple.

cavapoo2 commented 7 years ago

screenshot 1

kciesielski commented 7 years ago

Thanks for reporting @arobson73 @adamw I did some initial investigation. For some reason the Ammonite highlighter doesn't properly use the fansi.Attr.Reset param passed here: https://github.com/softwaremill/scala-clippy/blob/master/plugin/src/main/scala-2.11/com/softwaremill/clippy/DelegatingPosition.scala#L19 Changing to fansi.color.Reset ot fansi.Color.makeAttr(Console.RESET, 0) doesn't do the trick either.

One possible but risky workaround would be to use the "light gray" color here instead of "Reset". However, this may affect output if someone uses custom terminal colors instead of light gray. I built a snapshot release with this workaround applied. @arobson73 could you try clippy version 0.5.1-SNAPSHOT? First, please make sure you have snapshot resolver added, for example in your .sbt/clippy.sbt file (the same place where you have defined clippyColorsEnabled := true):

resolvers += 
  "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
cavapoo2 commented 7 years ago

import com.softwaremill.clippy.ClippySbtPlugin._ resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots" clippyColorsEnabled := true

the above is now in my ~.sbt\0.13\build.sbt is this correct ? still seems to grab the 0.5.0 version [debug] Calling Scala compiler with arguments (CompilerInterface): [debug] -P:clippy:colors=true [debug] -Xplugin:C:\Users\andy.ivy2\cache\com.softwaremill.clippy\plugin_2.12\jars\plugin_2.12-0.5.0-bundle.jar [debug] -bootclasspath

kciesielski commented 7 years ago

@arobson73 you also need to change version to 0.5.1-SNAPSHOT in .sbt/0.13/plugins/build.sbt

cavapoo2 commented 7 years ago

yes tried that. here is my .sbt/0.13/plugins/build.sbt

addSbtPlugin("com.softwaremill.clippy" % "plugin-sbt" % "0.5.1-SNAPSHOT")

here is my .sbt/0.13/build.sbt

resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots" import com.softwaremill.clippy.ClippySbtPlugin._ clippyColorsEnabled := true

here is the error I keep getting

[info] Loading global plugins from C:\Users\andy.sbt\0.13\plugins [info] Updating {file:/C:/Users/andy/.sbt/0.13/plugins/}global-plugins... [info] Resolving com.softwaremill.clippy#plugin-sbt;0.5.1-SNAPSHOT ... [warn] module not found: com.softwaremill.clippy#plugin-sbt;0.5.1-SNAPSHOT [warn] ==== typesafe-ivy-releases: tried [warn] https://repo.typesafe.com/typesafe/ivy-releases/com.softwaremill.clippy/plugin-sbt/scala_2.10/sbt_0.13/0.5.1-SNAPSHOT/ivys/ivy.xml [warn] ==== sbt-plugin-releases: tried [warn] https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.softwaremill.clippy/plugin-sbt/scala_2.10/sbt_0.13/0.5.1-SNAPSHOT/ivys/ivy.xml [warn] ==== local: tried [warn] C:\Users\andy.ivy2\local\com.softwaremill.clippy\plugin-sbt\scala_2.10\sbt_0.13\0.5.1-SNAPSHOT\ivys\ivy.xml [warn] ==== public: tried [warn] https://repo1.maven.org/maven2/com/softwaremill/clippy/plugin-sbt_2.10_0.13/0.5.1-SNAPSHOT/plugin-sbt-0.5.1-SNAPSHOT.pom [info] Resolving org.fusesource.jansi#jansi;1.4 ... [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: UNRESOLVED DEPENDENCIES :: [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: com.softwaremill.clippy#plugin-sbt;0.5.1-SNAPSHOT: not found [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] [warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes. [warn] com.softwaremill.clippy:plugin-sbt:0.5.1-SNAPSHOT (scalaVersion=2.10, sbtVersion=0.13) [warn] [warn] Note: Unresolved dependencies path: [warn] com.softwaremill.clippy:plugin-sbt:0.5.1-SNAPSHOT (scalaVersion=2.10, sbtVersion=0.13) (C:\Users\andy.sbt\0.13\plugins\build.sbt#L1-2) [warn] +- org.scala-sbt:global-plugins:0.0 (scalaVersion=2.10, sbtVersion=0.13) [trace] Stack trace suppressed: run last :update for the full output. [error] (:update) sbt.ResolveException: unresolved dependency: com.softwaremill.clippy#plugin-sbt;0.5.1-SNAPSHOT: not found Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?

kciesielski commented 7 years ago

@arobson73 looks like snapshots repo is not being used. Could you also add the resolver line:

resolvers +=
 "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"

to .sbt/0.13/plugins/build.sbt ?

cavapoo2 commented 7 years ago

screenshot 2

looks better now. thanks