quarto-dev / quarto-dev/quarto-cli

Python code highlighting not identifying variables, modules, methods, or arguments

Open
#10,488 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug upstream
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

Bug description

One of our users reported they were seeing some not very colorful examples of Python code, and I didn't think much of it until this moment. I tried creating a custom theme with a bunch of jarring colors, and I observed that a similar script in R is able to highlight much more than what Python is able to highlight, including the function names and parameters.

I'm not sure if this is a Quarto bug or a Skylighting bug, but I thought I would start the conversation here in case it's an issue with the way Quarto implements Skylighting.

Steps to reproduce
  1. Clone https://github.com/nickvigilante/code-highlighting-issue
  2. quarto preview
Expected behavior

All code elements, including import tokens, variables, modules, methods, and arguments, should be highlighted.

Actual behavior

Some elements are missing highlighting.

Your environment
  • IDE: VS Code 1.92.1
  • OS: macOS Sonoma 14.6.1
Quarto check output

Quarto 1.5.56
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.2.0: OK
Dart Sass version 1.70.0: OK
Deno version 1.41.0: OK
Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.5.56
Path: /Applications/quarto/bin

[✓] Checking tools....................OK
TinyTeX: (not installed)
Chromium: (not installed)

[✓] Checking LaTeX....................OK
Tex: (not detected)

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
Version: 3.10.14 (Conda)
Path: /Users/nickv/miniforge3/bin/python
Jupyter: 5.7.2
Kernels: ir, python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
Version: 4.4.1
Path: /opt/homebrew/Cellar/r/4.4.1/lib/R
LibPaths:
- /opt/homebrew/lib/R/4.4/site-library
- /opt/homebrew/Cellar/r/4.4.1/lib/R/library
knitr: 1.47
rmarkdown: 2.27

[✓] Checking Knitr engine render......OK

Contributor guide

Open the contributing guide

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

Clone the linked reproduction repository and run quarto preview to compare Python and R highlighting. Then trace whether the missing import tokens, variables, modules, methods, and arguments are handled by Quarto or Skylighting; done means the Python elements listed in the issue receive the expected highlighting.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.