-
Notifications
You must be signed in to change notification settings - Fork 229
feat(harper-ls): Replace all in document with... #1796
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
base: master
Are you sure you want to change the base?
Conversation
Find all similar lints and allow applying them all across the document in one code action. This should fix Automattic#998. Signed-off-by: Daniel Silverstone <[email protected]>
|
Here's how I see this. We don't want to overwhelm the user with options. It should not take a long time for them to find the code action they're looking for. The more reading they have to do, the longer it will take for that to happen. To that end, we want to show a just a few, high-impact code actions at a time. If we want to stick to surfacing this functionality via a code action, we should show at most one additional action at a time when a user hovers. In other words, if the user hovers over an error related to too many spaces, we should show one code action to fix the specific location, and one to fix all in the document. If they hover over a spelling mistake, we should show the same 3 that we always do, but only one additional one to apply the most likely suggestion for the whole document. From an architectural standpoint, I'd love to see the logic contained in this PR moved to |
|
Fair enough - I'll give this some deeper thought, thanks for that review @elijah-potter - Are the suggestions in the lint in order of likelihood of correctness? |
If you have access to the full |
|
I misunderstood. Yes, go with just the first suggestion. |
|
@kinnison, do you have any updates for us on this? |
I'm so sorry for the radio silence - I've been in the process of buying a new house so I've not had any time to work on this patch. I think I need to just work out the neatest way to limit to the best suggestion; but I've not had time to look at the code since late august :( I'd be comfortable if you just wanted to chuck away my patch and redo-from-start; or if you're happy waiting then I'll see what I can do in a week or two. |
|
Absolutely no worries! Buying a house is a huge step in life. Please focus on that. I think we should keep this PR open so it remains visible to potential contributors. I'm going to change it to a draft, however. When you've had a chance to look at the problem once more, mark it as ready for review. Thanks again for all the work! |
Find all similar lints and allow applying them all across the document in one code action. This should fix #998.
Issues
Fixes #998
Description
This adds additional quickfix actions which perform a particular lint suggestion document-wide. The intent being to resolve #998 in a reasonable fashion.
Demo
How Has This Been Tested?
I added the locally built
harper-lsto myhelixconfiguration and tested across a variety of markdown documents doing global replacements of the same and differing lengths, including situations where the action was similar but the lint different (eg. replacing a double-space in the middle of a sentence vs. after a full-stop). All seemed good.Also,
cargo test --alldidn't complain.Right now I'm not particularly pleased with how this is implemented, so I'm interested in the views of @elijah-potter in particular. I feel there must be a neater way to do this.
Checklist