sublimehq / Packages

Syntax highlighting files shipped with Sublime Text and Sublime Merge
https://sublimetext.com
Other
2.95k stars 588 forks source link

[Makefile] Bracket pair highlighting issue #3111

Open charmerkai opened 2 years ago

charmerkai commented 2 years ago

Description

when i open a makefile in sublime, and the syntax is selected as makefile the Bracket just doesn't show the highlight

Steps to reproduce

  1. Start Sublime Text in safe mode
  2. open a makefile as makefile syntax
  3. try to select one bracket and the other who matches this one don't highlight

Expected behavior

the Bracket highlight as other file in sublime

Actual behavior

the bracket donesn't highlight

Environment

michaelblyons commented 2 years ago

Can you move this to https://github.com/sublimehq/Packages? Edit: Thanks, Keith.

deathaxe commented 2 years ago

Are you refering to those interpolation expressions such as $(foreach i,j,k) ?

charmerkai commented 2 years ago

Are you refering to those interpolation expressions such as $(foreach i,j,k) ?

kind of like that, so in $(), the highlighter just don't work?

charmerkai commented 2 years ago

so the makefile code like this:

include $(wildcard $(patsubst %,$(DEPDIR)/%.d,$(basename $(TARGET_SOURCES))))

the highlighter just don't show up

charmerkai commented 2 years ago

~Can you move this to https://github.com/sublimehq/Packages?~ Edit: Thanks, Keith.

thanks , i just don't really know the rules here, and thanks for Keith, too

michaelblyons commented 2 years ago

Confirmed does not match $( with ). Does the "match_brackets" preference require certain scopes for highlighting matches? The $( has keyword.other.block.begin instead of a punctuation... one. Or is it because the ( has a $ attached?

i just don't really know the rules here,

No worries. This is where the Makefile resources live, and there's a slightly different new-issue template to help better.

deathaxe commented 2 years ago

Bracket matching appears to depend on punctuation.definition and punctuation.section. When changing keyword.other to a punctuation scope, bracket pairs are highlighted.

EDIT: It also requires string scopes to be cleared, which is the little bit more sophisticated part of a fix. We basically need to apply the meta.string meta.interpolation guideline to Makefile.