Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Refocus after application of Code Action #152

Merged
merged 4 commits into from
Jan 22, 2018

Conversation

tylerFowler
Copy link
Contributor

After the application of a code action return focus to active text editor to prevent the appearance of 'cursor locking' after applying a code action. I made this change in two places, for my test actions I only observed the code in DiagnosticsCodeActions.js actually being ran. My assumption being that the two calls to the underlying code action's apply method are mutually exclusive, feel free to correct me if that's a bad assumption. Also note that in DiagnosticsCodeActions.js the 'active element' is refocused even after code action failure, this seems like the desired behavior but let me know if it's not for any reason.

Fixes #147

@codecov-io
Copy link

codecov-io commented Jan 21, 2018

Codecov Report

Merging #152 into master will decrease coverage by 0.02%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #152      +/-   ##
==========================================
- Coverage   37.31%   37.29%   -0.03%     
==========================================
  Files         162      162              
  Lines        5159     5162       +3     
==========================================
  Hits         1925     1925              
- Misses       3234     3237       +3
Impacted Files Coverage Δ
...de-diagnostics-ui/lib/ui/DiagnosticsCodeActions.js 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 665c789...f41ac55. Read the comment docs.

@hansonw
Copy link
Contributor

hansonw commented Jan 22, 2018

Ah! yeah I think the suggestion in the issue was a little off; I don't think the two code paths are mutually exclusive but I believe that the onClick handler should always be getting called. Let me just verify that and I'll edit/commit your change as necessary. It looks good overall though, thanks for this!

@hansonw hansonw merged commit 8734950 into facebookarchive:master Jan 22, 2018
@tylerFowler tylerFowler deleted the code-action-focus branch January 22, 2018 20:38
facebook-github-bot pushed a commit to facebookarchive/nuclide that referenced this pull request Jan 23, 2018
Summary:
Imports facebookarchive/atom-ide-ui#152.

It's a small PR to give the editor focus after clicking a code action (to avoid a situation where nothing has focus).

Reviewed By: matthewwithanm

Differential Revision: D6788648

fbshipit-source-id: 406705d6d2b513652489f9d353779f48d81edac9
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants