Skip to content

Commit f3552ec

Browse files
fadeevabalexr00
authored andcommitted
Makefile grammar updating: tests are updated about the handling of @, - and +. (microsoft#65629)
1. @, - and + in the beginning of recipes are colored. 2. Shell in recipes is not colored by shellscript extension anymore: improper colorizing of Makefile variables, low suitability.
1 parent b940d15 commit f3552ec

2 files changed

Lines changed: 264 additions & 7 deletions

File tree

extensions/make/test/colorize-fixtures/makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.PHONY: all
2-
all: hello
2+
all: echo hello
33

44
.PHONY: hello
55
hello: main.o factorial.o \
@@ -25,15 +25,19 @@ hello.o: hello.cpp \
2525
clean:
2626
rm *o hello
2727

28-
.PHONY: all
29-
all:
28+
.PHONY: var
29+
var:
3030
# "$$" in a shell means to escape makefile's variable substitution.
3131
some_shell_var=$$(sed -nre 's/some regex with (group)/\1/p')
3232

3333
.PHONY: echo
3434
echo:
3535
echo "#" and '#' in quotes are not comments \
3636
and '\' will be continued
37+
@echo Shell is not printed out, just a message.
38+
@-+-+echo Error will be ignored here; invalidcommand
39+
# And we can see variables are highlited as supposed to be:
40+
@echo '$(CC) $(shell echo "123") -o $@'
3741

3842
define defined
3943
$(info Checking existance of $(1) $(flavor $(1)))

extensions/make/test/colorize-results/makefile.json

Lines changed: 257 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
}
5656
},
5757
{
58-
"c": " hello",
58+
"c": " echo hello",
5959
"t": "source.makefile meta.scope.target.makefile meta.scope.prerequisites.makefile",
6060
"r": {
6161
"dark_plus": "default: #D4D4D4",
@@ -715,7 +715,7 @@
715715
}
716716
},
717717
{
718-
"c": " all",
718+
"c": " var",
719719
"t": "source.makefile meta.scope.target.makefile meta.scope.prerequisites.makefile",
720720
"r": {
721721
"dark_plus": "default: #D4D4D4",
@@ -726,7 +726,7 @@
726726
}
727727
},
728728
{
729-
"c": "all",
729+
"c": "var",
730730
"t": "source.makefile meta.scope.target.makefile entity.name.function.target.makefile",
731731
"r": {
732732
"dark_plus": "entity.name.function: #DCDCAA",
@@ -901,6 +901,259 @@
901901
"hc_black": "default: #FFFFFF"
902902
}
903903
},
904+
{
905+
"c": "\t",
906+
"t": "source.makefile meta.scope.recipe.makefile",
907+
"r": {
908+
"dark_plus": "default: #D4D4D4",
909+
"light_plus": "default: #000000",
910+
"dark_vs": "default: #D4D4D4",
911+
"light_vs": "default: #000000",
912+
"hc_black": "default: #FFFFFF"
913+
}
914+
},
915+
{
916+
"c": "@",
917+
"t": "source.makefile meta.scope.recipe.makefile keyword.control.@.makefile",
918+
"r": {
919+
"dark_plus": "keyword.control: #C586C0",
920+
"light_plus": "keyword.control: #AF00DB",
921+
"dark_vs": "keyword.control: #569CD6",
922+
"light_vs": "keyword.control: #0000FF",
923+
"hc_black": "keyword.control: #C586C0"
924+
}
925+
},
926+
{
927+
"c": "echo Shell is not printed out, just a message.",
928+
"t": "source.makefile meta.scope.recipe.makefile",
929+
"r": {
930+
"dark_plus": "default: #D4D4D4",
931+
"light_plus": "default: #000000",
932+
"dark_vs": "default: #D4D4D4",
933+
"light_vs": "default: #000000",
934+
"hc_black": "default: #FFFFFF"
935+
}
936+
},
937+
{
938+
"c": "\t",
939+
"t": "source.makefile meta.scope.recipe.makefile",
940+
"r": {
941+
"dark_plus": "default: #D4D4D4",
942+
"light_plus": "default: #000000",
943+
"dark_vs": "default: #D4D4D4",
944+
"light_vs": "default: #000000",
945+
"hc_black": "default: #FFFFFF"
946+
}
947+
},
948+
{
949+
"c": "@-+-+",
950+
"t": "source.makefile meta.scope.recipe.makefile keyword.control.@-+-+.makefile",
951+
"r": {
952+
"dark_plus": "keyword.control: #C586C0",
953+
"light_plus": "keyword.control: #AF00DB",
954+
"dark_vs": "keyword.control: #569CD6",
955+
"light_vs": "keyword.control: #0000FF",
956+
"hc_black": "keyword.control: #C586C0"
957+
}
958+
},
959+
{
960+
"c": "echo Error will be ignored here; invalidcommand",
961+
"t": "source.makefile meta.scope.recipe.makefile",
962+
"r": {
963+
"dark_plus": "default: #D4D4D4",
964+
"light_plus": "default: #000000",
965+
"dark_vs": "default: #D4D4D4",
966+
"light_vs": "default: #000000",
967+
"hc_black": "default: #FFFFFF"
968+
}
969+
},
970+
{
971+
"c": "\t",
972+
"t": "source.makefile punctuation.whitespace.comment.leading.makefile",
973+
"r": {
974+
"dark_plus": "default: #D4D4D4",
975+
"light_plus": "default: #000000",
976+
"dark_vs": "default: #D4D4D4",
977+
"light_vs": "default: #000000",
978+
"hc_black": "default: #FFFFFF"
979+
}
980+
},
981+
{
982+
"c": "#",
983+
"t": "source.makefile comment.line.number-sign.makefile punctuation.definition.comment.makefile",
984+
"r": {
985+
"dark_plus": "comment: #6A9955",
986+
"light_plus": "comment: #008000",
987+
"dark_vs": "comment: #6A9955",
988+
"light_vs": "comment: #008000",
989+
"hc_black": "comment: #7CA668"
990+
}
991+
},
992+
{
993+
"c": " And we can see variables are highlited as supposed to be:",
994+
"t": "source.makefile comment.line.number-sign.makefile",
995+
"r": {
996+
"dark_plus": "comment: #6A9955",
997+
"light_plus": "comment: #008000",
998+
"dark_vs": "comment: #6A9955",
999+
"light_vs": "comment: #008000",
1000+
"hc_black": "comment: #7CA668"
1001+
}
1002+
},
1003+
{
1004+
"c": "\t",
1005+
"t": "source.makefile meta.scope.recipe.makefile",
1006+
"r": {
1007+
"dark_plus": "default: #D4D4D4",
1008+
"light_plus": "default: #000000",
1009+
"dark_vs": "default: #D4D4D4",
1010+
"light_vs": "default: #000000",
1011+
"hc_black": "default: #FFFFFF"
1012+
}
1013+
},
1014+
{
1015+
"c": "@",
1016+
"t": "source.makefile meta.scope.recipe.makefile keyword.control.@.makefile",
1017+
"r": {
1018+
"dark_plus": "keyword.control: #C586C0",
1019+
"light_plus": "keyword.control: #AF00DB",
1020+
"dark_vs": "keyword.control: #569CD6",
1021+
"light_vs": "keyword.control: #0000FF",
1022+
"hc_black": "keyword.control: #C586C0"
1023+
}
1024+
},
1025+
{
1026+
"c": "echo '",
1027+
"t": "source.makefile meta.scope.recipe.makefile",
1028+
"r": {
1029+
"dark_plus": "default: #D4D4D4",
1030+
"light_plus": "default: #000000",
1031+
"dark_vs": "default: #D4D4D4",
1032+
"light_vs": "default: #000000",
1033+
"hc_black": "default: #FFFFFF"
1034+
}
1035+
},
1036+
{
1037+
"c": "$(",
1038+
"t": "source.makefile meta.scope.recipe.makefile string.interpolated.makefile punctuation.definition.variable.makefile",
1039+
"r": {
1040+
"dark_plus": "string: #CE9178",
1041+
"light_plus": "string: #A31515",
1042+
"dark_vs": "string: #CE9178",
1043+
"light_vs": "string: #A31515",
1044+
"hc_black": "string: #CE9178"
1045+
}
1046+
},
1047+
{
1048+
"c": "CC",
1049+
"t": "source.makefile meta.scope.recipe.makefile string.interpolated.makefile variable.other.makefile",
1050+
"r": {
1051+
"dark_plus": "variable: #9CDCFE",
1052+
"light_plus": "variable: #001080",
1053+
"dark_vs": "string: #CE9178",
1054+
"light_vs": "string: #A31515",
1055+
"hc_black": "variable: #9CDCFE"
1056+
}
1057+
},
1058+
{
1059+
"c": ")",
1060+
"t": "source.makefile meta.scope.recipe.makefile string.interpolated.makefile punctuation.definition.variable.makefile",
1061+
"r": {
1062+
"dark_plus": "string: #CE9178",
1063+
"light_plus": "string: #A31515",
1064+
"dark_vs": "string: #CE9178",
1065+
"light_vs": "string: #A31515",
1066+
"hc_black": "string: #CE9178"
1067+
}
1068+
},
1069+
{
1070+
"c": " ",
1071+
"t": "source.makefile meta.scope.recipe.makefile",
1072+
"r": {
1073+
"dark_plus": "default: #D4D4D4",
1074+
"light_plus": "default: #000000",
1075+
"dark_vs": "default: #D4D4D4",
1076+
"light_vs": "default: #000000",
1077+
"hc_black": "default: #FFFFFF"
1078+
}
1079+
},
1080+
{
1081+
"c": "$(",
1082+
"t": "source.makefile meta.scope.recipe.makefile string.interpolated.makefile punctuation.definition.variable.makefile",
1083+
"r": {
1084+
"dark_plus": "string: #CE9178",
1085+
"light_plus": "string: #A31515",
1086+
"dark_vs": "string: #CE9178",
1087+
"light_vs": "string: #A31515",
1088+
"hc_black": "string: #CE9178"
1089+
}
1090+
},
1091+
{
1092+
"c": "shell",
1093+
"t": "source.makefile meta.scope.recipe.makefile string.interpolated.makefile meta.scope.function-call.makefile support.function.shell.makefile",
1094+
"r": {
1095+
"dark_plus": "support.function: #DCDCAA",
1096+
"light_plus": "support.function: #795E26",
1097+
"dark_vs": "string: #CE9178",
1098+
"light_vs": "string: #A31515",
1099+
"hc_black": "support.function: #DCDCAA"
1100+
}
1101+
},
1102+
{
1103+
"c": " echo \"123\"",
1104+
"t": "source.makefile meta.scope.recipe.makefile string.interpolated.makefile meta.scope.function-call.makefile",
1105+
"r": {
1106+
"dark_plus": "string: #CE9178",
1107+
"light_plus": "string: #A31515",
1108+
"dark_vs": "string: #CE9178",
1109+
"light_vs": "string: #A31515",
1110+
"hc_black": "string: #CE9178"
1111+
}
1112+
},
1113+
{
1114+
"c": ")",
1115+
"t": "source.makefile meta.scope.recipe.makefile string.interpolated.makefile punctuation.definition.variable.makefile",
1116+
"r": {
1117+
"dark_plus": "string: #CE9178",
1118+
"light_plus": "string: #A31515",
1119+
"dark_vs": "string: #CE9178",
1120+
"light_vs": "string: #A31515",
1121+
"hc_black": "string: #CE9178"
1122+
}
1123+
},
1124+
{
1125+
"c": " -o ",
1126+
"t": "source.makefile meta.scope.recipe.makefile",
1127+
"r": {
1128+
"dark_plus": "default: #D4D4D4",
1129+
"light_plus": "default: #000000",
1130+
"dark_vs": "default: #D4D4D4",
1131+
"light_vs": "default: #000000",
1132+
"hc_black": "default: #FFFFFF"
1133+
}
1134+
},
1135+
{
1136+
"c": "$@",
1137+
"t": "source.makefile meta.scope.recipe.makefile variable.language.makefile",
1138+
"r": {
1139+
"dark_plus": "variable.language: #569CD6",
1140+
"light_plus": "variable.language: #0000FF",
1141+
"dark_vs": "variable.language: #569CD6",
1142+
"light_vs": "variable.language: #0000FF",
1143+
"hc_black": "variable: #9CDCFE"
1144+
}
1145+
},
1146+
{
1147+
"c": "'",
1148+
"t": "source.makefile meta.scope.recipe.makefile",
1149+
"r": {
1150+
"dark_plus": "default: #D4D4D4",
1151+
"light_plus": "default: #000000",
1152+
"dark_vs": "default: #D4D4D4",
1153+
"light_vs": "default: #000000",
1154+
"hc_black": "default: #FFFFFF"
1155+
}
1156+
},
9041157
{
9051158
"c": "define",
9061159
"t": "source.makefile meta.scope.conditional.makefile keyword.control.define.makefile",
@@ -2760,4 +3013,4 @@
27603013
"hc_black": "default: #FFFFFF"
27613014
}
27623015
}
2763-
]
3016+
]

0 commit comments

Comments
 (0)