quarto-dev / quarto-dev/quarto

Context aware indentation in VS Code

Open
#629 3 comments 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

Is there a way for VS Code to apply context-aware indentations in qmd files? For instance, I need the python blocks to be indented with 4 spaces. But if 4-space indentation gets applied to everything, then <div class="author">In a Div</div> renders as a code block and the callout (which with 2 spaces correctly appears as a child of the first list item) is broken.

---
title: TEST
jupyter: python3
---

## Evaluated python cell

```{python}
def f():
    print("output")

f()
```

## Code block

```python
def f():
    print("output")
```

## HTML

<div class="container">
  <div class="author">In a Div</div>
</div>

## List

- unordered list

  ::: {.callout-note}
  A Callout
  :::

  - sub-item 1
  - sub-item 2
    - sub-sub-item 1

Thanks!!

quarto: 1.6.39
VSCode: 1.96.2
OS: Darwin arm64 23.6.0
quarto plugin: 1.118.0

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 reported indentation behavior in VS Code using the provided qmd example and the listed Quarto plugin version. Then trace the Quarto VS Code plugin's indentation entry point; done means Python blocks receive four-space indentation without breaking HTML, list nesting, or callouts.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.