quarto-dev / quarto-dev/quarto

Cannot run entire cell in .qmd file

Open
#584 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
645
Forks
62
Avg merge
17h 42m
Merged PRs (30d)
13

Description

This issue has arised in cursor and come about suddenly, when it was working when I first installed the quarto extension.

When I try to run an entire cell in this .qmd file:

a = 1
b = 2
c = a + b
print(c)

I am unable to run the whole code chunk in any way. I tried keyboard shortcut (cmd + shift+ enter) and to press the run cell button. In both cases, the line my cursor is currently on runs and the cursor moves to the next line. if the cursor is outside of a code chunk, the output is "Error: attempt to use zero-length variable name" and, again, the cursor moves to the next line. In the example above, I can't assign values to a and b simultaneously, or generate then print c at the same time.

Why is this happening? The keyboard shortcuts are all standard; quarto.runCurrentCell is cmd + shift + enter. My settings in cursor are as follows:

{
    "workbench.startupEditor": "none",
    "diffEditor.ignoreTrimWhitespace": false,
    "redhat.telemetry.enabled": false,
    "editor.unicodeHighlight.ambiguousCharacters": false,
    "remote.autoForwardPortsSource": "hybrid",
    "files.associations": {
        "*.rmd": "rmarkdown",
        "*.qmd": "quarto",
        "*.Rmd": "rmarkdown"
    },
    "workbench.settings.applyToAllProfiles": [
        "r.linting.enable"
    ],
    "workbench.colorTheme": "Default Dark Modern",
    "extensions.ignoreRecommendations": false,
    "[r]": {
        "editor.defaultFormatter": "REditorSupport.r",
        "editor.formatOnSave": true
    },
    "editor.largeFileOptimizations": true,
    "r.plot.useHttpgd": true,
    "r.plot.width": 800,
    "r.plot.height": 600,
    "r.lsp.enabled": true,
    "r.rterm.mac": "/usr/local/bin/R",
    "[rmd]": {
        "editor.wordWrap": "on",
        "editor.formatOnSave": false,
        "editor.defaultFormatter": "REditorSupport.r"
    },
    "r.linting.enable": true,
    "r.linting.lintr.linters": "linters_with_defaults(line_length_linter(120))",
    "git.enableSmartCommit": true,
    "git.autofetch": true,
    "git.confirmSync": false,
    "files.autoSave": "afterDelay",
    "files.autoSaveDelay": 1000,
    "terminal.integrated.defaultProfile.osx": "zsh",
    "editor.folding": true,
    "editor.foldingStrategy": "auto",
    "workbench.editor.enablePreview": false
}

It has made working with quarto really frustrating in cursor (and by extension, VScode).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the problem in a .qmd file with the two R chunks shown, using Cursor or VS Code and quarto.runCurrentCell. Start by tracing how the run-cell command identifies the current chunk and handles the cursor outside a chunk; done means the entire chunk runs and the outside-chunk case no longer sends an empty line.

Written by the indexing model from the issue text.

Assessment

Tech stack
r, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.