-
Notifications
You must be signed in to change notification settings - Fork 38
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
Access contents of document outline #153
Comments
Are you searching for this?: rstudioapi::executeCommand("toggleDocumentOutline") |
I’d like access the contents of the document outline as a list. Maybe this
is outside the scope of rstudioapi.
On Wed, Sep 4, 2019 at 6:48 AM Vilmantas Gegzna ***@***.***> wrote:
Are you searching for this?:
rstudioapi::executeCommand("toggleDocumentOutline")
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#153?email_source=notifications&email_token=ABRVN4ZU7Q3GM3Q7ONXTKGLQH64CBA5CNFSM4ITLXX52YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD53T62A#issuecomment-527908712>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABRVN44UP6PDLFZBU3E7HEDQH64CBANCNFSM4ITLXX5Q>
.
--
Sent from Gmail Mobile
|
We don't currently expose the contents of the document outline in a way accessible to R. I'd be curious to know a bit more about your use case. |
The case for this might be #8006. |
Hi yes this feature would be very helpful for me! I am trying to write a tool that aggregates my TODO items across my project. Similar to this package but I'd like to add document headers interspersed with to-do items. The package also doesn't support qmd files, and designing text processing across many different languages and comment styles seems fragile and unsustainable. I am planning on building a text processor with this snippet but it's not that flexible and doesn't work for the "functions and sections" outlines in R scripts. |
@dapperjapper, the reuseme package (a usethis-inspired package that I could have named usethisExtra) https://olivroy.github.io/reuseme/ does just that. You may be interested in Disclaimers: it is not that widely tested in the nature and is built on regular expressions, rather than proper file parsing. It has pretty much only been tested with RStudio and within RStudio projects. # Installation
install.packages('reuseme', repos = c('https://olivroy.r-universe.dev', 'https://cloud.r-project.org'))
library(reuseme)
# all elements
proj_outline()
# only todo
proj_outline("TODO") # can be any regex.
If you give it a try and have suggestions, feel free to open an issue or comment on olivroy/reuseme#28. I am currently actively developing this feature in my package at the moment, so now is a good time. Here is a screenshot of how it looks in my console It works better with the latest version of RStudio 2024.04.1, but it probably works okay with some recent ones as well. |
@olivroy Amazing -- thank you so much! |
@olivroy looks cool! |
I'd like to be able to access the document outline visible via
Code
>Show Document Outline
. Is this possible?The text was updated successfully, but these errors were encountered: