shanedell commented on code in PR #990:
URL: https://github.com/apache/daffodil-vscode/pull/990#discussion_r1521780315
##########
debugger/src/main/scala/org.apache.daffodil.debugger.dap/DAPodil.scala:
##########
@@ -748,11 +748,24 @@ object DAPodil extends IOApp {
copy(value = value + (uri.normalize -> lines))
def contains(location: Location): Boolean =
- value.exists {
- // format: off
- case (uri, lines) =>
- uri == location.uri && lines.exists(_ == location.line)
- // format: on
+ value.exists { case (uri, lines) =>
Review Comment:
@mbeckerle Would this work for adding to
`debugger/src/main/scala/org.apache.daffodil.debugger.dap/Portability.scala`
```scala
package org.apache.daffodil.debugger.dap
object Portability {
def osIsWindows(): Boolean =
System.getProperty("os.name").toLowerCase.startsWith("win")
def fixWindowsDriveLetter(uriPath: String): String =
osIsWindows() match {
case true =>
val uriParts = uriPath.split("/")
// item at index 0 is empty string, item at index 1 is drive letter
uriParts(1) = uriParts(1).toUpperCase
uriParts.mkString("/")
case false => uriPath
}
}
```
Then the `contains` would turn into
```scala
def contains(location: Location): Boolean =
value.exists { case (uri, lines) =>
Portability.fixWindowsDriveLetter(uri.getPath) == location.uri.getPath
&& lines.exists(_ == location.line)
}
```
I figured it would be best to make the check if the OS is windows would get
good for future proofing if we ever need to windows specific stuff again.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]