Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

VSCode outline fails in Rmarkdown document if there is pseudo chunk text inside the chunks

オープン
#641 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
r, vscode
領域
tooling

調査の方向性

VSCodeでR Markdownの例を再現し、ドキュメントアウトラインに使用されるチャンク解析を調べます。埋め込まれたバッククォートの扱いを、chunk.beginとchunk.endについて示されているknitrパターンと比較します。Rチャンク内に疑似チャンクテキストが現れた場合でもアウトラインが引き続き利用できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

I know this is a specific case.
I am building functions inside a Rmarkdown document, which builds chunks.
I remarked that, as soon as there is 3 backticks in my code, the VSCode document outline is not displayed.

Here is a reprex.
With this code, there is no outline available in VSCode, near the Rmd name
image

---
title: "test vscode"
output: html_document
author: statnmap
---

```{r development, include=FALSE}
library(testthat)
```

# combine_tbl_to_file

```{r function}
#' Create R code chunk content
#' @return A character string of R code chunk content
#' @noRd
create_r_chunk <- function() {
  paste(
    "```{r}",
    "```",
    sep = "\n"
  )
}

cat(create_r_chunk())
```

As soon as I remove the paste with backticks, the outline is correct:
image

---
title: "test vscode"
output: html_document
author: statnmap
---

```{r development, include=FALSE}
library(testthat)
```

# combine_tbl_to_file

```{r function}
#' Create R code chunk content
#' @return A character string of R code chunk content
#' @noRd
create_r_chunk <- function() {
  paste(
    "",
    sep = "\n"
  )
}

cat(create_r_chunk())
```

Maybe the parsing you use to detect chunks can be a little more restrictive, and only considering chunks when there is nothing or spaces before the backticks ?

You could maybe use patterns used by {knitr}:

r$> knitr:::all_patterns$md
$chunk.begin
[1] "^[\t >]*```+\\s*\\{([a-zA-Z0-9_]+( *[ ,].*)?)\\}\\s*$"

$chunk.end
[1] "^[\t >]*```+\\s*$"

$ref.chunk
[1] "^\\s*<<(.+)>>\\s*$"

$inline.code
[1] "(?<!(^``))(?<!(\n``))`r[ #]([^`]+)\\s*`"
主要言語
R
スター
675
フォーク
118
平均マージ
1日 11時間
マージ済み PR(30日)
11

環境構築

このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

REditorSupport/languageserver のほかの issue

REditorSupport/languageserver の issue をすべて見る

似ている issue

R の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。