Skip to content

Commit

Permalink
🔧 Add highlighting for recipe shebangs (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
nefrob authored Aug 2, 2024
1 parent 92899f4 commit 2efc16f
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 11 deletions.
35 changes: 30 additions & 5 deletions syntaxes/just.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 +647,13 @@
"patterns": [
{
"comment": "JavaScript",
"begin": "^\\s+#!/usr/bin/env\\s+node.*$",
"begin": "^\\s+(#!/usr/bin/env\\s+node.*)$",
"end": "^$",
"beginCaptures": {
"1": {
"name": "comment.line.number-sign.shebang.just"
}
},
"contentName": "source.js",
"patterns": [
{
Expand All @@ -658,8 +663,13 @@
},
{
"comment": "Perl",
"begin": "^\\s+#!/usr/bin/env\\s+perl.*$",
"begin": "^\\s+(#!/usr/bin/env\\s+perl.*)$",
"end": "^$",
"beginCaptures": {
"1": {
"name": "comment.line.number-sign.shebang.just"
}
},
"contentName": "source.perl",
"patterns": [
{
Expand All @@ -669,8 +679,13 @@
},
{
"comment": "Python",
"begin": "^\\s+#!/usr/bin/env\\s+python.*$",
"begin": "^\\s+(#!/usr/bin/env\\s+python.*)$",
"end": "^$",
"beginCaptures": {
"1": {
"name": "comment.line.number-sign.shebang.just"
}
},
"contentName": "source.python",
"patterns": [
{
Expand All @@ -680,8 +695,13 @@
},
{
"comment": "Ruby",
"begin": "^\\s+#!/usr/bin/env\\s+ruby.*$",
"begin": "^\\s+(#!/usr/bin/env\\s+ruby.*)$",
"end": "^$",
"beginCaptures": {
"1": {
"name": "comment.line.number-sign.shebang.just"
}
},
"contentName": "source.ruby",
"patterns": [
{
Expand All @@ -691,8 +711,13 @@
},
{
"comment": "Shell",
"begin": "^\\s+#!/usr/bin/env\\s+(sh|bash|zsh|fish).*$",
"begin": "^\\s+(#!/usr/bin/env\\s+(?:sh|bash|zsh|fish).*)$",
"end": "^$",
"beginCaptures": {
"1": {
"name": "comment.line.number-sign.shebang.just"
}
},
"contentName": "source.shell",
"patterns": [
{
Expand Down
25 changes: 20 additions & 5 deletions syntaxes/just.tmLanguage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -478,32 +478,47 @@ repository:
embedded-languages:
patterns:
- comment: JavaScript
begin: "^\\s+#!/usr/bin/env\\s+node.*$"
begin: "^\\s+(#!/usr/bin/env\\s+node.*)$"
end: ^$
beginCaptures:
'1':
name: comment.line.number-sign.shebang.just
contentName: source.js
patterns:
- include: source.js
- comment: Perl
begin: "^\\s+#!/usr/bin/env\\s+perl.*$"
begin: "^\\s+(#!/usr/bin/env\\s+perl.*)$"
end: ^$
beginCaptures:
'1':
name: comment.line.number-sign.shebang.just
contentName: source.perl
patterns:
- include: source.perl
- comment: Python
begin: "^\\s+#!/usr/bin/env\\s+python.*$"
begin: "^\\s+(#!/usr/bin/env\\s+python.*)$"
end: ^$
beginCaptures:
'1':
name: comment.line.number-sign.shebang.just
contentName: source.python
patterns:
- include: source.python
- comment: Ruby
begin: "^\\s+#!/usr/bin/env\\s+ruby.*$"
begin: "^\\s+(#!/usr/bin/env\\s+ruby.*)$"
end: ^$
beginCaptures:
'1':
name: comment.line.number-sign.shebang.just
contentName: source.ruby
patterns:
- include: source.ruby
- comment: Shell
begin: "^\\s+#!/usr/bin/env\\s+(sh|bash|zsh|fish).*$"
begin: "^\\s+(#!/usr/bin/env\\s+(?:sh|bash|zsh|fish).*)$"
end: ^$
beginCaptures:
'1':
name: comment.line.number-sign.shebang.just
contentName: source.shell
patterns:
- include: source.shell
2 changes: 1 addition & 1 deletion syntaxes/scopes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
["comment.line.number-sign.just","constant.character.escape.just","constant.character.expanded.just","constant.language.boolean.just","constant.language.hex.just","constant.numeric.just","entity.name.function.just","invalid.illegal.name.just","keyword.control.conditional.just","keyword.operator.and.just","keyword.operator.assignment.just","keyword.operator.attribute.end.just","keyword.operator.concat.just","keyword.operator.default.just","keyword.operator.equality.just","keyword.operator.error-suppression.just","keyword.operator.path-join.just","keyword.operator.quiet.just","keyword.operator.recipe.end.just","keyword.other.recipe.prefix.just","keyword.other.recipe.variadic.just","keyword.other.reserved.just","punctuation.optional.just","string.interpolated.escape.just","string.interpolated.escaping.just","string.interpolated.just","string.quoted.double.indented.just","string.quoted.double.just","string.quoted.single.indented.just","string.quoted.single.just","support.function.builtin.just","support.function.system.just","variable.name.alias.just","variable.name.module.just","variable.other.just","variable.parameter.recipe.just"]
["comment.line.number-sign.just","comment.line.number-sign.shebang.just","constant.character.escape.just","constant.character.expanded.just","constant.language.boolean.just","constant.language.hex.just","constant.numeric.just","entity.name.function.just","invalid.illegal.name.just","keyword.control.conditional.just","keyword.operator.and.just","keyword.operator.assignment.just","keyword.operator.attribute.end.just","keyword.operator.concat.just","keyword.operator.default.just","keyword.operator.equality.just","keyword.operator.error-suppression.just","keyword.operator.path-join.just","keyword.operator.quiet.just","keyword.operator.recipe.end.just","keyword.other.recipe.prefix.just","keyword.other.recipe.variadic.just","keyword.other.reserved.just","punctuation.optional.just","string.interpolated.escape.just","string.interpolated.escaping.just","string.interpolated.just","string.quoted.double.indented.just","string.quoted.double.just","string.quoted.single.indented.just","string.quoted.single.just","support.function.builtin.just","support.function.system.just","variable.name.alias.just","variable.name.module.just","variable.other.just","variable.parameter.recipe.just"]

0 comments on commit 2efc16f

Please sign in to comment.