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

blogdown:::update_meta_addin() is incompatible with Rstudio visual mode #769

Open
3 tasks
setgree opened this issue Nov 12, 2024 · 1 comment
Open
3 tasks
Labels
bug an unexpected problem or unintended behavior next to consider for next release

Comments

@setgree
Copy link

setgree commented Nov 12, 2024

Steps to reproduce:

  1. start writing blogpost (I usually do this via Rstudio menu options: Serve Site -> New Post
  2. write blogpost in visual mode
  3. select 'Upate Metadata' -- in Rstudio's Addin buttons
  4. get
> blogdown:::update_meta_addin()
Error in rstudioapi::getSourceEditorContext()$selection[[1]] : 
  subscript out of bounds
In addition: Warning message:
The current document does not seem to contain YAML metadata 
  1. switch to source mode, it works again

Session Info

> xfun::session_info('blogdown')
R version 4.4.1 (2024-06-14)
Platform: aarch64-apple-darwin20
Running under: macOS 15.1, RStudio 2024.9.0.375

Locale: en_US.UTF-8 / en_US.UTF-8 / en_US.UTF-8 / C / en_US.UTF-8 / en_US.UTF-8

Package version:
  base64enc_0.1.3   blogdown_1.19     bookdown_0.40     bslib_0.8.0      
  cachem_1.1.0      cli_3.6.3         digest_0.6.37     evaluate_1.0.1   
  fastmap_1.2.0     fontawesome_0.5.2 fs_1.6.4          glue_1.8.0       
  graphics_4.4.1    grDevices_4.4.1   highr_0.11        htmltools_0.5.8.1
  httpuv_1.6.15     jquerylib_0.1.4   jsonlite_1.8.9    knitr_1.48       
  later_1.3.2       lifecycle_1.0.4   magrittr_2.0.3    memoise_2.0.1    
  methods_4.4.1     mime_0.12         promises_1.3.0    R6_2.5.1         
  rappdirs_0.3.3    Rcpp_1.0.13       rlang_1.1.4       rmarkdown_2.28   
  sass_0.4.9        servr_0.30        stats_4.4.1       tinytex_0.53     
  tools_4.4.1       utils_4.4.1       xfun_0.48         yaml_2.3.10      

Hugo version: 0.130.0

Checklist

When filing a bug report, please check the boxes below to confirm that you have provided us with the information we need. Have you:

  • [X ] formatted your issue so it is easier for us to read?

  • [ X] used blogdown::check_site() function to diagnose your site and corrected potential problems?

  • included a minimal, self-contained, and reproducible example?
    (I am not sure, but I suspect you'll find this too if you regularly write blogposts via rmarkdown)

  • [ X] pasted the output from xfun::session_info('blogdown') in your issue?

  • upgraded all your packages to their latest versions (including your versions of R, the RStudio IDE, and relevant R packages)?

  • installed and tested your bug with the development version of the blogdown package using remotes::install_github('rstudio/blogdown') ?

-->

@cderv
Copy link
Collaborator

cderv commented Dec 24, 2024

Error in rstudioapi::getSourceEditorContext()$selection[[1]] :
subscript out of bounds

I think this is a problem with all addin using rstudioapi. getSourceEditorContext() does not nicely error when used on Visual Editor mode.

We need to catch the error and nicely error or see if there is a way with rstudioapi to get the associated source file 🤔

@cderv cderv added bug an unexpected problem or unintended behavior next to consider for next release labels Dec 24, 2024
@cderv cderv moved this from Backlog to Next / Ready for Dev in R Markdown Team Projects Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior next to consider for next release
Projects
Status: Next / Ready for Dev
Development

No branches or pull requests

2 participants