microsoft / microsoft/monaco-editor

[Bug] Shell code color issue after specific line

Open
#5,231 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Description

Reproducible in vscode.dev or in VS Code Desktop?
  • Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
Monaco Editor Playground Link

https://microsoft.github.io/monaco-editor/playground.html?source=v0.55.1#XQAAAAIWAgAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscw0fINSAEiAKctgAboa7AaZZDHLgrLqPRv_fRv2RyIokydlTdTYccsu6v6jDrc8jQ8udHkJ3GaVuDm0KgqW-Z92BxNlQdwsKub2m5ESdIv7dSSqbzq9tcRyCa5ak0BsoPH6wZ7MQRmr_CVVfAnlkMgU6Kisi6Ndc094U7L0oOlkdKPTXLlYqFHpwFkTapUvLDVu4emTbHFDhZWOljeMePeapORluLVSXtTNjSbSmjcPDr21_WS4TCKrquLRmAGnC7GRRhqNt3hjsjg_2NMA8jacBFRsp8mzrYEd_lKsRGUW5G10Pvm0CGIpThm-W0steJWc-9TqyHVOVe2mNren62ZIt6fZy_E8mDfn3hLtZbEMoUrTN4A9LpJg5esbjV1VZ-Qt1qR2nHp-RTRc9b_MCjzPBBT9eH0_LeC2JfuaEtF98l0DQhn6xL_hdhS_oMCcWNUxAoUc_NTsUcnZUlyGnx0tUGKeP_NVsew

Monaco Editor Playground Code
const value = /* set from `myEditor.getModel()`: */ `#!/bin/bash

GIT_REPO=git@github.com:xxx/yyy.git
GIT_HOST= \$(echo "\$GIT_REPO" | sed -E 's/^.*@([^:/]+).*\$/\\1/')

DIR_NAME=\$(basename "\$GIT_REPO" .git)

cd /app/\${DIR_NAME}
git pull
pnpm install
rm -rf packages/e2e/test-results`;

// Hover on each property to see its docs!
const myEditor = monaco.editor.create(document.getElementById("container"), {
	value,
	language: "shell",
	automaticLayout: true,
});
Reproduction Steps

open reproduction link in the monaco editor playground

Actual (Problematic) Behavior

after GIT_HOST= $(echo "$GIT_REPO" | sed -E 's/^.*@([^:/]+).*$/\1/')
code color is not correct

Image
Expected Behavior

show code color correctly
Image

Additional Context

work as expected on vscode.dev

Image

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

Start with the linked Monaco Editor Playground reproduction and inspect the shell code around the GIT_HOST assignment, especially the command substitution and sed expression. Compare the incorrect coloring with the expected screenshot and verify the same example renders correctly after the change; the issue does not name a source file or test to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell, typescript
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.