Skip to content

Commit

Permalink
Makefile grammar updating: tests are updated about the handling of @,…
Browse files Browse the repository at this point in the history
… - 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.
  • Loading branch information
fadeevab authored and alexr00 committed Feb 4, 2019
1 parent b940d15 commit f3552ec
Show file tree
Hide file tree
Showing 2 changed files with 264 additions and 7 deletions.
10 changes: 7 additions & 3 deletions extensions/make/test/colorize-fixtures/makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.PHONY: all
all: hello
all: echo hello

.PHONY: hello
hello: main.o factorial.o \
Expand All @@ -25,15 +25,19 @@ hello.o: hello.cpp \
clean:
rm *o hello

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

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

define defined
$(info Checking existance of $(1) $(flavor $(1)))
Expand Down
261 changes: 257 additions & 4 deletions extensions/make/test/colorize-results/makefile.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
}
},
{
"c": " hello",
"c": " echo hello",
"t": "source.makefile meta.scope.target.makefile meta.scope.prerequisites.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
Expand Down Expand Up @@ -715,7 +715,7 @@
}
},
{
"c": " all",
"c": " var",
"t": "source.makefile meta.scope.target.makefile meta.scope.prerequisites.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
Expand All @@ -726,7 +726,7 @@
}
},
{
"c": "all",
"c": "var",
"t": "source.makefile meta.scope.target.makefile entity.name.function.target.makefile",
"r": {
"dark_plus": "entity.name.function: #DCDCAA",
Expand Down Expand Up @@ -901,6 +901,259 @@
"hc_black": "default: #FFFFFF"
}
},
{
"c": "\t",
"t": "source.makefile meta.scope.recipe.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "@",
"t": "source.makefile meta.scope.recipe.makefile keyword.control.@.makefile",
"r": {
"dark_plus": "keyword.control: #C586C0",
"light_plus": "keyword.control: #AF00DB",
"dark_vs": "keyword.control: #569CD6",
"light_vs": "keyword.control: #0000FF",
"hc_black": "keyword.control: #C586C0"
}
},
{
"c": "echo Shell is not printed out, just a message.",
"t": "source.makefile meta.scope.recipe.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "\t",
"t": "source.makefile meta.scope.recipe.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "@-+-+",
"t": "source.makefile meta.scope.recipe.makefile keyword.control.@-+-+.makefile",
"r": {
"dark_plus": "keyword.control: #C586C0",
"light_plus": "keyword.control: #AF00DB",
"dark_vs": "keyword.control: #569CD6",
"light_vs": "keyword.control: #0000FF",
"hc_black": "keyword.control: #C586C0"
}
},
{
"c": "echo Error will be ignored here; invalidcommand",
"t": "source.makefile meta.scope.recipe.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "\t",
"t": "source.makefile punctuation.whitespace.comment.leading.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "#",
"t": "source.makefile comment.line.number-sign.makefile punctuation.definition.comment.makefile",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " And we can see variables are highlited as supposed to be:",
"t": "source.makefile comment.line.number-sign.makefile",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": "\t",
"t": "source.makefile meta.scope.recipe.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "@",
"t": "source.makefile meta.scope.recipe.makefile keyword.control.@.makefile",
"r": {
"dark_plus": "keyword.control: #C586C0",
"light_plus": "keyword.control: #AF00DB",
"dark_vs": "keyword.control: #569CD6",
"light_vs": "keyword.control: #0000FF",
"hc_black": "keyword.control: #C586C0"
}
},
{
"c": "echo '",
"t": "source.makefile meta.scope.recipe.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "$(",
"t": "source.makefile meta.scope.recipe.makefile string.interpolated.makefile punctuation.definition.variable.makefile",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "CC",
"t": "source.makefile meta.scope.recipe.makefile string.interpolated.makefile variable.other.makefile",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "variable: #9CDCFE"
}
},
{
"c": ")",
"t": "source.makefile meta.scope.recipe.makefile string.interpolated.makefile punctuation.definition.variable.makefile",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": " ",
"t": "source.makefile meta.scope.recipe.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "$(",
"t": "source.makefile meta.scope.recipe.makefile string.interpolated.makefile punctuation.definition.variable.makefile",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "shell",
"t": "source.makefile meta.scope.recipe.makefile string.interpolated.makefile meta.scope.function-call.makefile support.function.shell.makefile",
"r": {
"dark_plus": "support.function: #DCDCAA",
"light_plus": "support.function: #795E26",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "support.function: #DCDCAA"
}
},
{
"c": " echo \"123\"",
"t": "source.makefile meta.scope.recipe.makefile string.interpolated.makefile meta.scope.function-call.makefile",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": ")",
"t": "source.makefile meta.scope.recipe.makefile string.interpolated.makefile punctuation.definition.variable.makefile",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": " -o ",
"t": "source.makefile meta.scope.recipe.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "$@",
"t": "source.makefile meta.scope.recipe.makefile variable.language.makefile",
"r": {
"dark_plus": "variable.language: #569CD6",
"light_plus": "variable.language: #0000FF",
"dark_vs": "variable.language: #569CD6",
"light_vs": "variable.language: #0000FF",
"hc_black": "variable: #9CDCFE"
}
},
{
"c": "'",
"t": "source.makefile meta.scope.recipe.makefile",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "define",
"t": "source.makefile meta.scope.conditional.makefile keyword.control.define.makefile",
Expand Down Expand Up @@ -2760,4 +3013,4 @@
"hc_black": "default: #FFFFFF"
}
}
]
]

0 comments on commit f3552ec

Please sign in to comment.