Skip to content
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

Suggestion: adding markers to the output of devtools::spell_check() #1564

Closed
maelle opened this issue Aug 4, 2017 · 4 comments
Closed

Suggestion: adding markers to the output of devtools::spell_check() #1564

maelle opened this issue Aug 4, 2017 · 4 comments
Labels
feature a feature request or enhancement
Milestone

Comments

@maelle
Copy link
Contributor

maelle commented Aug 4, 2017

Context: when using e.g. goodpractice::gp() or lintr::package_lint() the output can be seen in the Markers pane of RStudio. That way when double-clicking on a remark one lands at the right line of the right file which makes editing easier.

I wonder if a similar functionality could be implemented for devtools::spell_check()? I do realize that it has an added difficulty: the current output of devtools::spell_check() gives the line numbers and files where the typos were found, which is in .Rd while the file one would like to edit is (most often) a .R.

@jimhester
Copy link
Member

This is a good idea!

I don't there is a way to map Rd output back to the roxygen comment, as the relationship is not one to one.

However an alternative would be modifying devtools::spell_check() to search roxygen comment lines (#') in .R files as well / in place of .Rd. This is generally more useful anyway because it tells you what needs to be edited. Probably the easiest way to do this is to use a regex that blanks out non-roxygen comment lines, then run the spell check function on those files.

rstudioapi::sourceMarkers() is the function that can be called to add markers to the marker pane.

@AmundsenJunior
Copy link
Contributor

In trying to test this, I found that spelling, called from spell-check.R, is only a "Suggests" not "Required" package. Calling devtools::spell_check() failed because this pkg was missing. Should it be moved to "Required"?

@jimhester
Copy link
Member

No, it is that way by design, we try to keep the number of "hard" dependencies relatively low for devtools. The spelling package is only required for the spell_check() function, so it is not installed by default.

We could add a call to check_suggested("spelling") to spell_check() however, which would give you a more useful error message, and prompt to install the package if it is not installed.

@hadley
Copy link
Member

hadley commented May 21, 2022

Given that this has now been open for ~5 years, I think it's unlikely we're going to implement it. Additionally, it feels less important now that RStudio has inline spelling checking.

@hadley hadley closed this as completed May 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

4 participants