Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Opening Find in an unrelated webview activates vscode-R and shows `R: (not attached)` in non-R workspaces

已关闭
#1,711 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
55/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
typescript, vscode

调研方向

先从 package.json 和 editor.action.webvieweditor.showFind 的 editor/title 菜单贡献入手,然后使用报告中的 Find 快捷键从 Markdown 预览中复现激活过程。检查 exthost.log 中的激活事件;当无关的 webview 不再激活 vscode-R 或显示 R: (not attached),而 R webview 仍保留其 Find 操作时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

bug confirmed

Describe the bug

The R extension activates and shows its session status bar item R: (not attached)
even in a workspace with no R files, simply because I triggered the Find widget
in an unrelated webview, such as a Markdown preview.

On my Windows machine, R itself is not installed at all — I only installed the
vscode-R extension. That alone is enough for R: (not attached) to show up once Find
is opened in an unrelated webview, so this is purely about extension activation, not
about any R file, R session, or R runtime.

The likely trigger is that package.json contributes the built-in command
editor.action.webvieweditor.showFind (titled "R: Find in WebView"). This command is
then used in editor/title menus gated by r.browser.active / r.helpPanel.active.

Since VS Code 1.74.0, a command contributed in package.json implicitly activates the
extension when that command is invoked. Because editor.action.webvieweditor.showFind
is the shared built-in webview Find command, invoking Find in any webview
(Markdown preview, release notes, etc.) activates vscode-R, not just R's own
help/browser panels.

Confirmed in exthost.log:

ExtensionService#_doActivateExtension REditorSupport.r, startup: false,
  activationEvent: 'onCommand:editor.action.webvieweditor.showFind'

To Reproduce

  1. Open a folder that contains no R-related files (.R, .Rmd, .Rproj, etc.).
  2. Open a webview-based editor with a Find widget, e.g. a Markdown preview.
  3. Focus that preview and press Cmd+F on macOS / Ctrl+F on Windows or Linux.
    In my environment, this invokes the built-in editor.action.webvieweditor.showFind.
  4. The vscode-R extension activates and R: (not attached) appears in the status
    bar, despite no R file or R session being present. It stays visible until the
    window is reloaded.

I have reproduced this on both macOS (Cmd+F) and Windows (Ctrl+F), so it does
not appear to be platform-specific.

Can you fix this issue by yourself? (We appreciate the help)

No, but I am happy to test a fix or provide more logs.

(If yes,) can we assist you with anything?

N/A

(If applicable) Please attach setting.json

On macOS, the only R setting I customized is:

"r.rpath.mac": "/usr/local/bin/R"

r.sessionWatcher is left at its default value, true.

On Windows, my settings.json has no r.* keys at all, and R is not installed.
Only the vscode-R extension is present. The bug still reproduces.

Expected behavior

The extension should not activate, and the session status bar item should not appear,
merely because Find was opened in an unrelated webview.

The "R: Find in WebView" action should be scoped to R's own webviews only, without
contributing the shared built-in webview Find command id in a way that causes global
activation from unrelated webviews.

Possible approaches:

  • avoid contributing the built-in command id editor.action.webvieweditor.showFind
    directly in contributes.commands;
  • use a vscode-R wrapper command that is only exposed for R webviews and internally
    calls the built-in Find command;
  • or hide the session status bar item unless an R-related editor, workspace, session,
    or webview is actually relevant.

This seems related in spirit to #1572 / #1579, where R UI was made conditional so it
does not appear in unrelated workspaces.

Screenshots

The status bar shows R: (not attached) in a workspace with no R files. I can attach
a screenshot if useful.

Environment (please complete the following information):

  • OS: reproduced on both macOS and Windows
  • VS Code Version: 1.122.1
  • R Version: N/A — reproduces with no R session involved. On Windows, R is not even
    installed; only the vscode-R extension is present.
  • vscode-R version: 2.8.8

Additional context

When r.sessionWatcher is enabled, which is the default, activation creates and shows
the session status bar item. Therefore, once vscode-R is activated by the unrelated
webview Find command, R: (not attached) remains visible for the rest of the window
session, even though the current workspace/editor is unrelated to R.

主要语言
TypeScript
星标
1.2k
派生
139
平均合并
22 小时
30 天内合并 PR
23

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

REditorSupport/vscode-R 的其他 Issue

查看 REditorSupport/vscode-R 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。