Skip to content

Commit

Permalink
Fix sourceRoot bug
Browse files Browse the repository at this point in the history
  • Loading branch information
TwitchBronBron committed Jun 13, 2024
1 parent 51c16ae commit e1a9c52
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/parser/TranspileState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,15 @@ export class TranspileState {
private getSource(locatable: RangeLike) {
let srcPath = (locatable as { location: Location })?.location?.uri ?? (locatable as Location).uri;
if (srcPath) {
srcPath = util.uriToPath(srcPath);
//if a sourceRoot is specified, use that instead of the rootDir
if (this.options.sourceRoot) {
srcPath = srcPath.replace(
this.options.rootDir,
this.options.sourceRoot
);
}
return srcPath;
} else {
return this.srcPath;
}
Expand Down

0 comments on commit e1a9c52

Please sign in to comment.