Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.

Commit 53d307b

Browse files
author
Ryan Ashcraft
committed
Ensure absolute file paths for diagnostics
1 parent ce8289c commit 53d307b

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
babel build watcher task - orta
66
* Adds support for *.js.flow files ( such as those generated by graphql-js ) which are
77
treated as common JavaScript files - orta
8+
* Fixes "File not found" error with diagnostics when `flow status --json` provides
9+
non-absolute file paths - ryanashcraft #77
810

911
### 4.0
1012

lib/flowDiagnostics.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ async function getDiagnostics(document) {
5858
// flow workspace.
5959
let rawDiag = await flowFindDiagnostics(filePath);
6060
if (rawDiag && rawDiag.messages) {
61+
const { flowRoot } = rawDiag;
62+
6163
rawDiag.messages.forEach((message) => {
6264
const {level, messageComponents} = message
6365
if (!messageComponents.length) return
@@ -68,7 +70,7 @@ async function getDiagnostics(document) {
6870

6971
if (range == null) return;
7072

71-
const file = range.file
73+
const file = path.resolve(flowRoot, range.file);
7274

7375
let diag = {
7476
severity: level,

0 commit comments

Comments
 (0)