-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CLOSED] Fix #5137 async linting #5935
Comments
For the brave: checkout this async JSHint implementation if you want to test (checkout use-async-run branch, specifically). You need to place it somewhere where the extensions are loaded from, either in src/extensions/dev or in <AppSupportDirectory>/extensions/user. |
|
|
|
Looks like |
|
|
I'm currently testing some edge cases. I hope to be finished by today. |
Like I said to Peter Flynn on IRC, I develop my extension (TypeScript language support) using the code of this PR . My linter runs in a Web Worker and everything works fine except that when I open brackets with a TypeScript files open I got the 2 following errors in the chrome console :
I guess that at start times if the linter takes a little times to answer (that is the case here since the typescript compiler takes a little time to load and parse all the files of the current project) 2 inspection are launch in parallel resulting in these errors. |
|
|
I wrote a unit test for the race condition and we need to check, if the document is still the same when the inspection/linting results will be displayed. My case was to open a document, start inspection, close document and the results for the previous document will show up in the bottom panel. This shouldn't be too difficult to avoid for us. |
|
|
|
Resolving the promise with a message, that the linter was unable to return something in a timely manner is not implemented yet. I wondered, what this means for the user and what the user is supposed to do in such a situation. I don't have a good idea how to resolve this in an elegant way. The next time the user makes a changes to the file and we start a new linting attempt this issue could be resolved, or not. I hope that the user doesn't get annoyed when this happens too frequently (since this is completely new behavior). |
|
My biggest concern, however, is it doesn't look like there's any attempt here to handle the myriad of new race conditions that this change creates. For example, if I hit Save in a file where the linter takes 1 sec to complete and then I switch to another file, the linting results from the old file will pop up while I'm in the new file. If the new file had its own linter, and it was faster, you'll actually have a flash of the correct results and then they'll get overwritten with incorrect results from the old file. Similar things can happen if you disable linting while one is still in progress, etc. Bugs are even possible just from editing within a single file: you can stack up multiple invocations of the async provider, and they might finish out of order, showing you stale linting results from one of the earlier invocations. This isn't something we can solve in inspectFile() -- rather, these are really all issues with run()'s usage of it, and so I think the fixes belong there. Previously, run() was basically able to assume that inspectFile() completes synchronously; now it can't assume that. We should also add some more unit tests to cover a bunch of these tricky conditions. |
I'm done with addressing the previous review comments. It's ready for review again. |
Here's one idea for a fix: have a module-global variable that holds the "current" pending promise. Overwrite it whenever a new run() is initiated (overwrite with null if |
|
|
|
|
Merging now. Thanks for all your work on this |
Yay! Great! Now to improve it! :) |
Wednesday Jan 15, 2014 at 15:36 GMT
Originally opened as adobe/brackets#6530
Implement support for asynchronous providers through scanFileAsync function. Each provider is limited by 500ms timeout now. Providers are executed in parallel (even though it only makes sense for the truly async ones). Providers are never rejected if actual provider rejects its promised, it is resolve with null results and does not appear in the problems panel.
Additionally some closure compiler notation issues in JSDoc have been fixed.
cc:
@
peterflynn,@
ingorichterbusykai included the following code: https://github.com/adobe/brackets/pull/6530/commits
The text was updated successfully, but these errors were encountered: