C++ line continuation mark (\) should be ignored everywhere

Open
#1,184 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Reproduce the two examples in Monaco's C/C++ editor and compare their highlighting with the behavior shown for GitHub and VSCode. Trace the syntax-highlighting implementation used for C/C++ and verify that both continued macros and continued single-line comments remain highlighted through the continuation lines.

Written by the indexing model from the issue text.

Description

feature-request grammars help wanted open for PR

monaco-editor version: 0.15.1
Browser: Chrome (maybe others)
OS: Windows

In C/C++ \ is used as line continuation mark so defining macros in multi-line is possible:

#define MACRO do { \
} while(false);

It is also possible to change a single line comment to multi-line with \:

// Multi \
   Line \
   Comment

As you see in above snippet, Github syntax highlighter accept this syntax in comments and colorize line 2 and 3 as comments, but Monaco does not:

image

This is somehow strange that the VSCode highlights it correctly but Monaco does not.
image

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

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.

More from microsoft/monaco-editor

All issues in microsoft/monaco-editor

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.