godotengine / godotengine/godot

In code comments, single or double quote inside pair of brackets breaks bracket matching, showing brackets in red when near caret

Open
#94,512 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug confirmed topic:editor
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

[!IMPORTANT]
Bugsquad note: This issue has been confirmed several times already. No need to confirm it further.

Tested versions
  • Reproducible in v4.2.1.stable.official [b09f793f5], v4.3.rc2.official [3978628c6]
System information

Godot v4.2.1.stable - Ubuntu 22.04.4 LTS 22.04 - X11 - Vulkan (Mobile) - dedicated NVIDIA GeForce GTX 860M (nvidia; 535.161.07) - Intel(R) Core(TM) i7-4710HQ CPU @ 2.50GHz (8 Threads)

Issue description

If you write: # ('), or spanned on multiple lines:

# ('
# )

And you move the caret near the brackets, you'll see that they will appear highlighted in red, showing that they are no matching brackets, instead of underlining their match. This is because a closing quote is expected, as in code. In fact, closing the quote with a second quote of the same type will fix the issue.

However, this commonly happens in English and other languages using quotes:

# (We're unsure about this line)

and the quote themselves do not benefit from quote matching: placing the caret near them does not highlight any matching quote, e.g. in:

# (print 'hello')

so there is not much use is considering quotes as string delimiters in comments. We may just ignore them and focus on matching brackets instead.

This aslo applies to double quotes " and square brackets [], as well as export tooltip comments ##.

Steps to reproduce

Write comment:

# (')

or multiline:

# ('
# )

then move caret near a bracket, on its external side (left or opening bracket, right or closing bracket): instead of underlining matching bracket, only that bracket highlighted in red.

Add a closing quote and see how it fixes the issue.

Minimal reproduction project (MRP)

N/A

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

Reproduce the issue in Godot's code editor with comments such as # ('), multiline brackets, and ## tooltip comments, then inspect the editor's bracket-matching behavior. Done means quotes inside comments no longer prevent matching brackets from being highlighted, while normal bracket matching remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
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.