Refactor diagnostics for perf#126
Conversation
| const isDocumentActive = activeTextEditor.document === event.document; | ||
|
|
||
| if (isDocumentActive && isRunOnEditEnabled() && hasFlowPragma(event.document.getText())) { | ||
| debouncedUpdateDiagnostics(context, event.document); |
| "files.exclude": { | ||
| // "build": true, // set this to true to hide the "build" folder with the compiled JS files, | ||
| "npm-debug.log**": true | ||
| "npm-debug.log": true |
There was a problem hiding this comment.
This would show the logs I think?
There was a problem hiding this comment.
Right, changed to single star
| /^\s*\/\*+\s*@flow\s*\*+\//m.test(content) || | ||
| /^\s*\/\/\s*@flow\s*$/m.test(content) | ||
| return hasPragma | ||
| return /^\s*(\/*\*+|\/\/)\s*@flow/m.test(content); |
There was a problem hiding this comment.
@Gozala do you know if we're going to miss out of things but this switch?
There was a problem hiding this comment.
Previous regex didn't catch things like
/*
* @flow
*/which are pretty common.
I tried to cover most cases out there: http://regexr.com/3fumm
We could further optimise checking for pragma on larger files while typing, by caching the result and revalidating if the pragma is still there once in a while.
|
@orta When extension will be updated with this PR? |
|
OK, I got half an hour - gonna give this a local clone and a run through myself then if it's 👍 I'll merge and prepare for the next release. |
|
Bah, this repo needs Danger - no CHANGELOG :D |
|
It need quite a lot of goodies, like tests for example XD |
|
Hah - yeah 📟 |

Summary
hasFlowPragmacheck regexflowonly if@flowpragma is detectedeslintbehavior)flowDiagnostics.flowconfigfrom playground, as it unabled flow check (not sure why though)yarn.lockOverall this should drastically reduce number of requests to flow server when
runOnEditis enabled.Fixes #116
Fixes #115
cc @orta