Patrick Benjamin
Patrick Benjamin

Reputation: 93

PHP doc doesn't respect indentation in code example in VSCode

I've added roughly the following PHPDoc to document a class, using markdown style backticks to add an example of the classes usage


/**
 * This is some documentation for a class
 * 
 * usage:
 * 
 * ```php
 * $thing = new MyCoolClass();
 * 
 * $thing->run(function() {
 *    // do something
 *    $otherThing = doSomething();
 *    return $otherThing;
 * })
 * ```
 */

 class MyCoolClass {
    
 }

But the tooltip in VSCode looks as follows:

This is some documentation for a class

<?php
class MyCoolClass { }
usage:

<?php
$thing = new MyCoolClass();

$thing->run(function() {
// do something
$otherThing = doSomething();
return $otherThing;
})

The indentation is completely ignored. Is there a way I'm missing to get it to respect indentation?

Upvotes: 2

Views: 72

Answers (0)

Related Questions