mill icon indicating copy to clipboard operation
mill copied to clipboard

vscode with bsp: illegal char <:>

Open NPCRUS opened this issue 11 months ago • 7 comments

Hello folks, I have the following issue on windows when trying to use mill with bsp in vscode, this error appears in metals logs:

java.nio.file.InvalidPathException: Illegal char <:> at index 10: mill-build:.metals-buildtarget
    at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:204)
    at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:175)
    at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
    at sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
    at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:231)
    at java.nio.file.Path.resolve(Path.java:516)
    at scala.meta.io.AbsolutePath.resolve(AbsolutePath.scala:41)
    at scala.meta.internal.metals.FileDecoderProvider$.createBuildTargetURI(FileDecoderProvider.scala:788)

seems like it was fixed sometime ago #3203 , maybe degradation?

NPCRUS avatar Jan 19 '25 08:01 NPCRUS

use " " to quote it?

He-Pin avatar Jan 19 '25 08:01 He-Pin

@NPCRUS I Remember it know, I workaround it by rename the file name in cask.

He-Pin avatar Jan 19 '25 08:01 He-Pin

Where is the : coming from? If it comes from a cross value then there is still some more masking needed, as said in this comment: then https://github.com/com-lihaoyi/mill/issues/3203#issuecomment-2161432108 .

lefou avatar Jan 19 '25 10:01 lefou

use " " to quote it?

@He-Pin quote what and where?

NPCRUS avatar Jan 19 '25 11:01 NPCRUS

@NPCRUS Ouch, I remember it, I think there maybe a bug in the normalization, where in Windows it needs to be C:\\ ? What's your mill version.

He-Pin avatar Jan 19 '25 11:01 He-Pin

@He-Pin 0.12.5

NPCRUS avatar Jan 19 '25 11:01 NPCRUS

I also saw this trying to import this project into IntelliJ on windows. Full stack trace is below. Looks like it is adding a second C drive for some reason.

Exception in thread "main" java.nio.file.InvalidPathException: Illegal char <:> at index 4: C:/C:/Users/aelfr/AppData/Local/Coursier/cache/v1/https/repo1.maven.org/maven2/com/lihaoyi/mill-bsp-worker_3/0.13.0-M1-43-b217bc/mill-bsp-worker_3-0.13.0-M1-43-b217bc.jar
	at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
	at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
	at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
	at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
	at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:232)
	at java.base/java.nio.file.Path.of(Path.java:147)
	at java.base/java.nio.file.Paths.get(Paths.java:69)
	at os.Path$.apply(Path.scala:465)
	at mill.bsp.BspClasspathWorker$.$anonfun$2$$anonfun$1(BspClasspathWorker.scala:44)
	at scala.collection.Iterator$$anon$9.next(Iterator.scala:584)
	at scala.collection.immutable.List.prependedAll(List.scala:153)
	at scala.collection.immutable.List$.from(List.scala:685)
	at scala.collection.immutable.List$.from(List.scala:682)
	at scala.collection.SeqFactory$Delegate.from(Factory.scala:306)
	at scala.collection.immutable.Seq$.from(Seq.scala:42)
	at scala.collection.IterableOnceOps.toSeq(IterableOnce.scala:1473)
	at scala.collection.IterableOnceOps.toSeq$(IterableOnce.scala:1473)
	at scala.collection.AbstractIterator.toSeq(Iterator.scala:1306)
	at mill.bsp.BspClasspathWorker$.$anonfun$2(BspClasspathWorker.scala:44)
	at scala.Option.getOrElse(Option.scala:201)
	at mill.bsp.BspClasspathWorker$.apply(BspClasspathWorker.scala:45)
	at mill.runner.MillMain$.runBspSession$$anonfun$1(MillMain.scala:329)
	at mill.define.SystemStreams$.withStreams$$anonfun$1$$anonfun$1$$anonfun$1$$anonfun$1$$anonfun$1$$anonfun$1$$anonfun$1(SystemStreams.scala:86)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
	at mill.define.SystemStreams$.withStreams$$anonfun$1$$anonfun$1$$anonfun$1$$anonfun$1$$anonfun$1$$anonfun$1(SystemStreams.scala:87)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
	at mill.define.SystemStreams$.withStreams$$anonfun$1$$anonfun$1$$anonfun$1$$anonfun$1$$anonfun$1(SystemStreams.scala:88)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
	at mill.define.SystemStreams$.withStreams$$anonfun$1$$anonfun$1$$anonfun$1$$anonfun$1(SystemStreams.scala:89)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
	at scala.Console$.withErr(Console.scala:193)
	at mill.define.SystemStreams$.withStreams$$anonfun$1$$anonfun$1$$anonfun$1(SystemStreams.scala:90)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
	at scala.Console$.withOut(Console.scala:164)
	at mill.define.SystemStreams$.withStreams$$anonfun$1$$anonfun$1(SystemStreams.scala:91)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
	at scala.Console$.withIn(Console.scala:227)
	at mill.define.SystemStreams$.withStreams$$anonfun$1(SystemStreams.scala:92)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
	at mill.define.SystemStreams$.withStreams(SystemStreams.scala:93)
	at mill.runner.MillMain$.runBspSession(MillMain.scala:375)
	at mill.runner.MillMain$.$anonfun$6(MillMain.scala:252)
	at scala.util.Using$.resource(Using.scala:296)
	at mill.runner.MillMain$.main0$$anonfun$1$$anonfun$1(MillMain.scala:284)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
	at mill.runner.MillMain$.main0$$anonfun$1(MillMain.scala:299)
	at mill.define.SystemStreams$.withStreams$$anonfun$1$$anonfun$1$$anonfun$1$$anonfun$1$$anonfun$1$$anonfun$1$$anonfun$1(SystemStreams.scala:86)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
	at mill.define.SystemStreams$.withStreams$$anonfun$1$$anonfun$1$$anonfun$1$$anonfun$1$$anonfun$1$$anonfun$1(SystemStreams.scala:87)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
	at mill.define.SystemStreams$.withStreams$$anonfun$1$$anonfun$1$$anonfun$1$$anonfun$1$$anonfun$1(SystemStreams.scala:88)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
	at mill.define.SystemStreams$.withStreams$$anonfun$1$$anonfun$1$$anonfun$1$$anonfun$1(SystemStreams.scala:89)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
	at scala.Console$.withErr(Console.scala:193)
	at mill.define.SystemStreams$.withStreams$$anonfun$1$$anonfun$1$$anonfun$1(SystemStreams.scala:90)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
	at scala.Console$.withOut(Console.scala:164)
	at mill.define.SystemStreams$.withStreams$$anonfun$1$$anonfun$1(SystemStreams.scala:91)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
	at scala.Console$.withIn(Console.scala:227)
	at mill.define.SystemStreams$.withStreams$$anonfun$1(SystemStreams.scala:92)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
	at mill.define.SystemStreams$.withStreams(SystemStreams.scala:93)
	at mill.runner.MillMain$.main0(MillMain.scala:300)
	at mill.runner.MillMain$.main$$anonfun$1(MillMain.scala:73)
	at mill.runner.MillMain$.main$$anonfun$adapted$1(MillMain.scala:78)
	at mill.define.SystemStreams$.withTopLevelSystemStreamProxy(SystemStreams.scala:111)
	at mill.runner.MillMain$.main(MillMain.scala:78)
	at mill.runner.MillMain.main(MillMain.scala)

aelfric avatar Apr 16 '25 01:04 aelfric

Just tried importing com-lihaoyi/mill in VSCode using Metals 1.6.0 and it worked without a hitch. Likely this error was fixed in the recent BSP overhaul

lihaoyi avatar Jul 07 '25 10:07 lihaoyi