Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tools]
node = "22"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"displayName": "vscode-just",
"description": "Justfile syntax support for Visual Studio Code",
"license": "MIT",
"version": "0.8.0",
"version": "0.8.1",
"engines": {
"node": ">=22 || ^20.9.0",
"vscode": ">=1.94.0"
Expand Down
32 changes: 26 additions & 6 deletions syntaxes/just.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Just",
"scopeName": "source.just",
"fileTypes": ["just", "justfile", "Justfile"],
"fileTypes": [
"just",
"justfile",
"Justfile"
],
"firstLineMatch": "#![\\s\\t]*\\/.*\\just\\b",
"uuid": "8b0cfae0-229f-4688-a4b7-8b5c3db82855",
"patterns": [
Expand Down Expand Up @@ -668,7 +672,7 @@
"patterns": [
{
"comment": "JavaScript",
"begin": "^\\s+(#!/usr/bin/env\\s+node.*)$",
"begin": "^\\s+(#!/usr/bin/env\\s+(?:-S\\s+)?node.*)$",
"end": "(?<=^[^\\s]+)",
"beginCaptures": {
"1": {
Expand All @@ -682,9 +686,25 @@
}
]
},
{
"comment": "Deno",
"begin": "^\\s+(#!/usr/bin/env\\s+(?:-S\\s+)?deno.*)$",
"end": "(?<=^[^\\s]+)",
"beginCaptures": {
"1": {
"name": "comment.line.number-sign.shebang.just"
}
},
"contentName": "source.ts",
"patterns": [
{
"include": "source.ts"
}
]
},
{
"comment": "Perl",
"begin": "^\\s+(#!/usr/bin/env\\s+perl.*)$",
"begin": "^\\s+(#!/usr/bin/env\\s+(?:-S\\s+)?perl.*)$",
"end": "(?<=^[^\\s]+)",
"beginCaptures": {
"1": {
Expand All @@ -700,7 +720,7 @@
},
{
"comment": "Python",
"begin": "^\\s+(#!/usr/bin/env\\s+python.*)$",
"begin": "^\\s+(#!/usr/bin/env\\s+(?:-S\\s+)?python.*)$",
"end": "(?<=^[^\\s]+)",
"beginCaptures": {
"1": {
Expand All @@ -716,7 +736,7 @@
},
{
"comment": "Ruby",
"begin": "^\\s+(#!/usr/bin/env\\s+ruby.*)$",
"begin": "^\\s+(#!/usr/bin/env\\s+(?:-S\\s+)?ruby.*)$",
"end": "(?<=^[^\\s]+)",
"beginCaptures": {
"1": {
Expand All @@ -732,7 +752,7 @@
},
{
"comment": "Shell",
"begin": "^\\s+(#!/usr/bin/env\\s+(?:sh|bash|zsh|fish).*)$",
"begin": "^\\s+(#!/usr/bin/env\\s+(?:-S\\s+)?(?:sh|bash|zsh|fish).*)$",
"end": "(?<=^[^\\s]+)",
"beginCaptures": {
"1": {
Expand Down
19 changes: 14 additions & 5 deletions syntaxes/just.tmLanguage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -493,16 +493,25 @@ repository:
embedded-languages:
patterns:
- comment: JavaScript
begin: "^\\s+(#!/usr/bin/env\\s+node.*)$"
begin: "^\\s+(#!/usr/bin/env\\s+(?:-S\\s+)?node.*)$"
end: (?<=^[^\s]+)
beginCaptures:
'1':
name: comment.line.number-sign.shebang.just
contentName: source.js
patterns:
- include: source.js
- comment: Deno
begin: "^\\s+(#!/usr/bin/env\\s+(?:-S\\s+)?deno.*)$"
end: (?<=^[^\s]+)
beginCaptures:
'1':
name: comment.line.number-sign.shebang.just
contentName: source.ts
patterns:
- include: source.ts
- comment: Perl
begin: "^\\s+(#!/usr/bin/env\\s+perl.*)$"
begin: "^\\s+(#!/usr/bin/env\\s+(?:-S\\s+)?perl.*)$"
end: (?<=^[^\s]+)
beginCaptures:
'1':
Expand All @@ -511,7 +520,7 @@ repository:
patterns:
- include: source.perl
- comment: Python
begin: "^\\s+(#!/usr/bin/env\\s+python.*)$"
begin: "^\\s+(#!/usr/bin/env\\s+(?:-S\\s+)?python.*)$"
end: (?<=^[^\s]+)
beginCaptures:
'1':
Expand All @@ -520,7 +529,7 @@ repository:
patterns:
- include: source.python
- comment: Ruby
begin: "^\\s+(#!/usr/bin/env\\s+ruby.*)$"
begin: "^\\s+(#!/usr/bin/env\\s+(?:-S\\s+)?ruby.*)$"
end: (?<=^[^\s]+)
beginCaptures:
'1':
Expand All @@ -529,7 +538,7 @@ repository:
patterns:
- include: source.ruby
- comment: Shell
begin: "^\\s+(#!/usr/bin/env\\s+(?:sh|bash|zsh|fish).*)$"
begin: "^\\s+(#!/usr/bin/env\\s+(?:-S\\s+)?(?:sh|bash|zsh|fish).*)$"
end: (?<=^[^\s]+)
beginCaptures:
'1':
Expand Down
27 changes: 27 additions & 0 deletions syntaxes/tests/embedded/embedded.just
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ js:
#!/usr/bin/env node
console.log('Greetings from JavaScript!')

deno:
#!/usr/bin/env deno run
console.log('Hello from Deno!');
const name: string = 'Deno';

perl:
#!/usr/bin/env perl
print "Larry Wall says Hi!\n";
Expand All @@ -27,3 +32,25 @@ empty-lines:
print('Hello from python!')

print('Hello from python!')

bash-with-env-S:
#!/usr/bin/env -S bash -Eeuo pipefail
echo "Highlighting should work with -S flag"
set +e
echo "This is a shell script"

python-with-env-S:
#!/usr/bin/env -S python3 -u
print('Python with -S flag')
print('Should have proper highlighting')

node-with-env-S:
#!/usr/bin/env -S node --trace-warnings
console.log('Node.js with -S flag');
console.log('Should have proper highlighting');

deno-with-env-S:
#!/usr/bin/env -S deno run --allow-run --allow-read --allow-env --allow-write
console.log('Deno with -S flag and multiple permissions');
const data: string = 'TypeScript works!';