return [
'listeners' => [
WorkerStarting::class => [ ❌
EnsureUploadedFilesAreValid::class, ❌
],
RequestReceived::class => [ ❌
...Octane::prepareApplicationForNextOperation(), ❌
...Octane::prepareApplicationForNextRequest(), ❌
],
WorkerErrorOccurred::class => [ ❌
ReportException::class, ❌
StopWorkerIfNecessary::class, ❌
],
],
'warm' => [
...Octane::defaultServicesToWarm(), ❌
],
]
@if (count($records) === 1) ❌
I have one record!
@elseif (count($records) > 1) ❌
I have {{ count($records) }} records! ❌
@else
I don't have <span class='font-bold'>any</span> records! ❌
@endif ❌
fs.readdirSync(path.join(process.cwd(), 'posts')).forEach(slug => { ❌
let content = fs.readFileSync( ❌
path.join(process.cwd(), 'posts', slug), ❌
'utf-8'
)
fs.writeFileSync( ❌
path.join(process.cwd(), 'build', `${slug}.html`), ❌
md.render(content) ❌
) ❌
}) ❌
It always gets it right, even for esoteric stuff.
Use any available VS Code theme, or make your own.
It supports every language VS Code supports, and any language you can find a tmLanguage.json
file for.
It requires no JavaScript. Really. Torchlight is an HTTP API with server-side clients. Fully highlighted HTML is sent to the browser. No FOUC.
Let's take a look at those examples again.
return [
'listeners' => [
WorkerStarting::class => [ ❌
EnsureUploadedFilesAreValid::class, ❌
],
RequestReceived::class => [ ❌
...Octane::prepareApplicationForNextOperation(), ❌
...Octane::prepareApplicationForNextRequest(), ❌
],
WorkerErrorOccurred::class => [ ❌
ReportException::class, ❌
StopWorkerIfNecessary::class, ❌
],
],
'warm' => [
...Octane::defaultServicesToWarm(), ❌
],
]
1return [ 2 'listeners' => [ 3 WorkerStarting::class => [ ✅ 4 EnsureUploadedFilesAreValid::class, ✅ 5 ], 6 7 RequestReceived::class => [ ✅ 8 ...Octane::prepareApplicationForNextOperation(), ✅ 9 ...Octane::prepareApplicationForNextRequest(), ✅10 ],11 12 WorkerErrorOccurred::class => [ ✅13 ReportException::class, ✅14 StopWorkerIfNecessary::class, ✅15 ],16 ],17 18 'warm' => [19 ...Octane::defaultServicesToWarm(), ✅20 ],21]
@if (count($records) === 1) ❌
I have one record!
@elseif (count($records) > 1) ❌
I have {{ count($records) }} records! ❌
@else
I don't have <span class='font-bold'>any</span> records! ❌
@endif ❌
1@if (count($records) === 1) ✅2 I have one record!3@elseif (count($records) > 1) ✅4 I have {{ count($records) }} records! ✅5@else6 I don't have <span class='font-bold'>any</span> records! ✅7@endif ✅
fs.readdirSync(path.join(process.cwd(), 'posts')).forEach(slug => { ❌
let content = fs.readFileSync( ❌
path.join(process.cwd(), 'posts', slug), ❌
'utf-8'
)
fs.writeFileSync( ❌
path.join(process.cwd(), 'build', `${slug}.html`), ❌
md.render(content) ❌
) ❌
}) ❌
1fs.readdirSync(path.join(process.cwd(), 'posts')).forEach(slug => { ✅ 2 let content = fs.readFileSync( ✅ 3 path.join(process.cwd(), 'posts', slug), ✅ 4 'utf-8' 5 ) 6 7 fs.writeFileSync( ✅ 8 path.join(process.cwd(), 'build', `${slug}.html`), ✅ 9 md.render(content) ✅10 ) ✅11}) ✅
Getting the highlighting right is table-stakes.
Torchlight focuses on the author experiences by helping you communicate your ideas clearly.
You can control the display of your code using comments in your code.
Using actual comments means no more messed up indentation or squiggly underlines in your editor.
No more indecipherable syntaxes to remember to put at the top of your file. Annotate with inline comments.
Let's look at some annotations.
1<?php 2/** 3 * Chunk the collection into chunks of the given size. 4 * 5 * @param int $size 6 * @return static 7 */ 8public function chunk($size) 9{10 if ($size <= 0) {11 return new static;12 }13 14 $chunks = [];15 16 foreach (array_chunk($this->items, $size, true) as $chunk) { 17 $chunks[] = new static($chunk); 18 } 19 20 return new static($chunks);21}
<?php
/**
* Chunk the collection into chunks of the given size.
*
* @param int $size
* @return static
*/
public function chunk($size)
{
if ($size <= 0) {
return new static;
}
$chunks = [];
foreach (array_chunk($this->items, $size, true) as $chunk) { // [tl! **]
$chunks[] = new static($chunk); // [tl! **]
} // [tl! **]
return new static($chunks);
}
1<?php 2/** 3 * Chunk the collection into chunks of the given size. 4