Skip to content

Commit

Permalink
skip outputting lsif snapshot for files located outside the sourceroot (
Browse files Browse the repository at this point in the history
#195)

Co-authored-by: Ólafur Páll Geirsson <[email protected]>
  • Loading branch information
Strum355 and olafurpg authored May 12, 2021
1 parent 548e179 commit e53a450
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ case class SnapshotLsifCommand(
@PositionalArguments() input: List[Path] = List(Paths.get("dump.lsif"))
) extends Command {

private val finalOutput = AbsolutePath.of(output, sourceroot)
def sourceroot: Path = AbsolutePath.of(app.env.workingDirectory)
private val finalOutput = AbsolutePath.of(output, sourceroot)

def run(): Int = {
Files.walkFileTree(finalOutput, new DeleteVisitor())
Expand All @@ -59,7 +59,12 @@ case class SnapshotLsifCommand(
in = AbsolutePath.of(inputPath, sourceroot)
doc <- SnapshotLsifCommand.parseTextDocument(in, sourceroot)
} {
SnapshotCommand.writeSnapshot(doc, finalOutput)
val docPath = AbsolutePath
.of(Paths.get(doc.getUri), sourceroot)
.toRealPath()
if (docPath.toAbsolutePath.startsWith(sourceroot)) {
SnapshotCommand.writeSnapshot(doc, finalOutput)
}
}
0
}
Expand Down

0 comments on commit e53a450

Please sign in to comment.