You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 22.04升级RStudio后styler包style_selection函数失效求助

RStudio新版本中styler的style_selection函数失效问题
  • 环境配置:Ubuntu 22.04.1,升级RStudio至rstudio-2022.12.0-353-amd64.deb后出现问题;当前使用R版本4.1.2,styler包从1.7.0升级到1.8.1后问题仍存在
  • 问题表现:styler通过RStudio插件(Addins)集成的style_selection功能失效,快捷键为ctrl+shift+a(可通过Tools>Addins>Browse Addins>Keyboard Shortcuts查看/设置),选中代码执行格式化时,报错提示未选中代码
  • 最小复现示例:
    高亮选中以下代码后按快捷键:
    library(styler)
    2+2 # take note of spacing
    
    预期格式化结果:
    library(styler)
    2 + 2 # take note of spacing
    
    实际执行报错:
    > styler:::style_selection()
    Using style transformers `styler::tidyverse_style()`
    Error in `styler:::style_selection()`:
    ! No code selected
    Run `rlang::last_error()` to see where the error occurred.
    
  • 排查情况:运行rlang::last_error()和rlang::last_trace()未获取有效排查信息;降级RStudio至rstudio-2022.07.2-576-amd64.deb可恢复功能,但希望继续使用新版本RStudio

内容的提问来源于stack exchange,提问作者Adam Smith

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.07 23:45:34