Giter VIP home page Giter VIP logo

vscode-phpfmt's Introduction

phpfmt for Visual Studio Code

Version Visual Studio Marketplace

The missing phpfmt extension for Visual Studio Code.

Installation

Open command palette F1 and select Extensions: Install Extension, then search for phpfmt.

Note: PHP 5.6 or newer is required in the machine to run this plugin.

Usage

F1 -> phpfmt: Format This File

or keyboard shortcut Ctrl + Shift + I which is Visual Studio Code default formatter shortcut

or right mouse context menu Format Document or Format Selection

Format On Save

Respects editor.formatOnSave setting.

You can turn off format-on-save on a per-language basis by scoping the setting:

// Set the default
"editor.formatOnSave": false,
// Enable per-language
"[php]": {
  "editor.formatOnSave": true
}

Q&A

Q: How to use phpfmt.php_bin with spaces such as C:\Program Files\php\php.exe ?
A: Wrap your path with quotes like:

{
  "phpfmt.php_bin": "\"C:\\Program Files\\php\\php.exe\""
}

It is recommended to add the directory of the php.exe to the PATH environment variable on Windows.
If it still not working, refer to #1 and Stack Overflow Related.

Q: How use tabs instead of spaces with PSR2 enabled ?
A: For PSR2, code MUST use 4 spaces for indenting, not tabs. But if you like PSR2, and do not like 4 spaces for indentation, add following configuration:

{
  "phpfmt.passes": [
    "PSR2KeywordsLowerCase",
    "PSR2LnAfterNamespace",
    "PSR2CurlyOpenNextLine",
    "PSR2ModifierVisibilityStaticOrder",
    "PSR2SingleEmptyLineAndStripClosingTag",
    "ReindentSwitchBlocks"
  ],
  "phpfmt.exclude": [
    "ReindentComments",
    "StripNewlineWithinClassBody"
  ],
  "phpfmt.psr2": false
}

Q: Is fmt.phar (phpfmt itself) still maintained ?
A: Since phpfmt has no maintainers, only Serious bugs will be fixed.
A: We now use fmt.stub.php from driade's phpfmt8 which is very updated.

Configuration

Key Type Description Default
phpfmt.php_bin string php executable path "php"
phpfmt.use_old_phpfmt boolean use old fmt.phar which supports 5.6 false
phpfmt.detect_indent boolean auto detecting indent type and size (will ignore indent_with_space) false
phpfmt.psr1 boolean activate PSR1 style false
phpfmt.psr1_naming boolean activate PSR1 style - Section 3 and 4.3 - Class and method names case. false
phpfmt.psr2 boolean activate PSR2 style true
phpfmt.wp boolean activate WP style false
phpfmt.indent_with_space integer | boolean use spaces instead of tabs for indentation. Default 4 4
phpfmt.enable_auto_align boolean enable auto align of ST_EQUAL and T_DOUBLE_ARROW false
phpfmt.visibility_order boolean fixes visibiliy order for method in classes - PSR-2 4.2 false
phpfmt.ignore array ignore file names whose names contain any pattern that could be matched with .match JS string method []
phpfmt.passes array call specific compiler pass []
phpfmt.exclude array disable specific passes []
phpfmt.smart_linebreak_after_curly boolean convert multistatement blocks into multiline blocks false
phpfmt.yoda boolean yoda-style comparisons false
phpfmt.cakephp boolean Apply CakePHP coding style false
phpfmt.custom_arguments string provide custom arguments to overwrite default arguments generated by config ""

Supported Transformations

F1 -> phpfmt: List Transformations to get the example of each transformation.

Key Description
SmartLnAfterCurlyOpen Add line break when implicit curly block is added.
AddMissingParentheses Add extra parentheses in new instantiations.
AliasToMaster Replace function aliases to their masters - only basic syntax alias.
AlignConstVisibilityEquals Vertically align "=" of visibility and const blocks.
AlignDoubleArrow Vertically align T_DOUBLE_ARROW (=>).
AlignComments Vertically align "//" comments.
AlignDoubleSlashComments Vertically align "//" comments.
AlignEquals Vertically align "=".
AlignGroupDoubleArrow Vertically align T_DOUBLE_ARROW (=>) by line groups.
AlignPHPCode Align PHP code within HTML block.
AlignTypehint Vertically align function type hints.
AllmanStyleBraces Transform all curly braces into Allman-style.
AutoPreincrement Automatically convert postincrement to preincrement.
AutoSemicolon Add semicolons in statements ends.
CakePHPStyle Applies CakePHP Coding Style
ClassToSelf "self" is preferred within class, trait or interface.
ClassToStatic "static" is preferred within class, trait or interface.
ConvertOpenTagWithEcho Convert from "<?=" to "<?php echo ".
DocBlockToComment Replace docblocks with regular comments when used in non structural elements.
DoubleToSingleQuote Convert from double to single quotes.
EchoToPrint Convert from T_ECHO to print.
EncapsulateNamespaces Encapsulate namespaces with curly braces
GeneratePHPDoc Automatically generates PHPDoc blocks
IndentTernaryConditions Applies indentation to ternary conditions.
JoinToImplode Replace implode() alias (join() -> implode()).
LeftWordWrap Word wrap at 80 columns - left justify.
LongArray Convert short to long arrays.
MergeElseIf Merge if with else.
SplitElseIf Merge if with else.
MergeNamespaceWithOpenTag Ensure there is no more than one linebreak before namespace
MildAutoPreincrement Automatically convert postincrement to preincrement. (Deprecated pass. Use AutoPreincrement instead).
NewLineBeforeReturn Add an empty line before T_RETURN.
OrganizeClass Organize class, interface and trait structure.
OrderAndRemoveUseClauses Order use block and remove unused imports.
OnlyOrderUseClauses Order use block - do not remove unused imports.
OrderMethod Organize class, interface and trait structure.
OrderMethodAndVisibility Organize class, interface and trait structure.
PHPDocTypesToFunctionTypehint Read variable types from PHPDoc blocks and add them in function signatures.
PrettyPrintDocBlocks Prettify Doc Blocks
PSR2EmptyFunction Merges in the same line of function header the body of empty functions.
PSR2MultilineFunctionParams Break function parameters into multiple lines.
ReindentAndAlignObjOps Align object operators.
ReindentSwitchBlocks Reindent one level deeper the content of switch blocks.
ReindentEnumBlocks Reindent one level deeper the content of enum blocks.
RemoveIncludeParentheses Remove parentheses from include declarations.
RemoveSemicolonAfterCurly Remove semicolon after closing curly brace.
RemoveUseLeadingSlash Remove leading slash in T_USE imports.
ReplaceBooleanAndOr Convert from "and"/"or" to "&&"/"
ReplaceIsNull Replace is_null($a) with null === $a.
RestoreComments Revert any formatting of comments content.
ReturnNull Simplify empty returns.
ShortArray Convert old array into new array. (array() -> [])
SortUseNameSpace Organize use clauses by length and alphabetic order.
SpaceAroundControlStructures Add space around control structures.
SpaceAroundExclamationMark Add spaces around exclamation mark.
SpaceBetweenMethods Put space between methods.
StrictBehavior Activate strict option in array_search, base64_decode, in_array, array_keys, mb_detect_encoding. Danger! This pass leads to behavior change.
StrictComparison All comparisons are converted to strict. Danger! This pass leads to behavior change.
StripExtraCommaInArray Remove trailing commas within array blocks
StripNewlineAfterClassOpen Strip empty lines after class opening curly brace.
StripNewlineAfterCurlyOpen Strip empty lines after opening curly brace.
StripNewlineWithinClassBody Strip empty lines after class opening curly brace.
StripSpaces Remove all empty spaces
StripSpaceWithinControlStructures Strip empty lines within control structures.
TightConcat Ensure string concatenation does not have spaces, except when close to numbers.
TrimSpaceBeforeSemicolon Remove empty lines before semi-colon.
UpgradeToPreg Upgrade ereg_* calls to preg_*
WordWrap Word wrap at 80 columns.
WrongConstructorName Update old constructor names into new ones. http://php.net/manual/en/language.oop5.decon.php
YodaComparisons Execute Yoda Comparisons.
SpaceAfterExclamationMark Add space after exclamation mark.
SpaceAroundParentheses Add spaces inside parentheses.

Contribute

Running extension

  • Open this repository inside Visual Studio Code
  • Debug sidebar
  • Launch Extension

Running tests

  • Open this repository inside Visual Studio Code
  • Debug sidebar
  • Launch Tests

vscode-phpfmt's People

Contributors

alix1383 avatar benallfree avatar github-actions[bot] avatar kokororin avatar lostintangent avatar lucasferreira avatar still-dreaming-1 avatar th-santos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-phpfmt's Issues

The options does not work

I am on macOS High Sierra and the plugin is working, but it does not interpret any options given, I turned on the debug and I see that the command is actually calling the args correctly but nothing happen on my code. I try running the command in the terminal with the real path and work correctly.

This screenshot is before running the format
screen shot 2018-02-14 at 15 32 59

And this after the format
screen shot 2018-02-14 at 15 33 06

If you see the "after" and command launched the code should look totally different

Hi, this does not appear to format HTML in a PHP file - is that correct?

I highlighted some HTML in my php file, right click and choose format selection

<?php
echo("This is PHP");
?>
<html>
<head>
</head>
<body>
<h1>hello</h1>
</body>
</html>

Right click and choose format selection

At the bottom of the editor I see a message:

phpfmt: Format failed - syntax errors found

In the output I see
Command failed: php -l /var/folders/4k/wf26gdpj47j_kjy14vfvsxqm0000gn/T/temp-koauixe.php

Formatting the whole document also doesn't format the HTML properly.
Is the extension supposed to format HTML in a PHP file?
Thanks!

need option to add new empty lines before and after block like if and foreach

For example:

    $headers = apache_request_headers();
# <add empty line here>
    foreach ($headers as $header => $value) {
        if ($header == "Date") {
            $date = $value;
        }
# <add empty line here>
        if ($header == "Authorization") {
            $authorization = str_replace(chr(9), "", str_replace(chr(32), "", $value));
        }
# <add empty line here>
        if ($header == "KCode" || $header == "Kcode") {
            $ppsKCode = $value;
        }
    }
# <add empty line here>
    $headers = apache_request_headers();

But do not add empty lines at continuous block start or end, for example

    foreach ($headers as $header => $value) {
        if ($header == "KCode" || $header == "Kcode") {
            $ppsKCode = $value;
        }
    }

Formating comments

Hi,
I'm struggling with formating of comments. From time to time - I have a piece of code commented out in the middle of say a class. I would have expected phpfmt to leave it alone, but it seems to insist on ```
the following formatting, which I find a bit confusing:

class MyFantasticClass {
  /*
  public function test() {
    echo 'Something or other';
  }
  */
}

With a format-selection, becomes:

class MyFantasticClass {
  /*
public function test() {
echo 'Something or other';
}
 */
}

I'm running with psr2: false and cakephp: true, but switching between them doesn't seem to make much differnce.

Is this intended behaviour?

  • Martin

Selection format clears indenation

Hi.
I often use the selection-formating, but I've found that some times this results in the indentation being cleared completely. Selecting lines 3-6 (the $a assignment) results in the formatting below:

class MyFantasticClass {
  public function test() {
    $a = array(
      'a' => 1,
      'b' => 2
    );
    echo 'Something or other';
  }
}

Result:

class MyFantasticClass {
  public function test() {
$a = array(
 'a' => 1,
 'b' => 2,
);
    echo 'Something or other';
  }
}
  • Martin

Doesn't work.

Let's take this code from W3Schools :

 <?php
$servername = "localhost";
$username = "username";
$password = "password";

try {
    $conn = new PDO("mysql:host=$servername;dbname=myDB", $username, $password);
    // set the PDO error mode to exception
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    echo "Connected successfully";
    }
catch(PDOException $e)
    {
    echo "Connection failed: " . $e->getMessage();
    }
?> 

We can see it's wrongly formatted, has spaces, and desperately needs to be formatted. VSCode, however, doesn't care about PHP so let's use vscode-phpfmt. The result is :

<?php
$servername = "localhost";
$username = "username";
$password = "password";

try {
    $conn = new PDO("mysql:host=$servername;dbname=myDB", $username, $password);
    // set the PDO error mode to exception
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    echo "Connected successfully";
} catch (PDOException $e) {
    echo "Connection failed: " . $e->getMessage();
}

Great! Now it's formatted, except... The ?> tag is gone. And there's spaces.

Broken extension on clean install.

Prevent removing "use" keywords when applying format

Hello,

For some reason, when I apply the format styles to my code, the extension removes all the "use" keywords that follows the namespace definition, which results in breaking my code.

I'm loading all of my classes through a custom autoload function and since each class belongs to a namespace I have to use the "use" keyword.

I'd like to know if there is a way to prevent this.

Thanks.

run phpfmt failed

Hi I just got this error recently. I'm not sure what I did wrong. Can you help me resolve it?
Please let me know what should I do to give you more information.

A few issues, might be they are questions, whether phpfmt is true OR i am false.

  1. It increases space before comment end asterisk , please check it in below screenshot.

phpfmt-issues-1

  1. Also, it converts Logical operators (and TRUE, FALSE, NULL) in small letters, for example phpfmt will convert 'OR' to 'or' & 'TRUE' to 'true' & 'NULL' to 'null'. Please refer above screenshot.

  2. And, it also adds ',' (comma) in last value to end. Please have a look on screenshot below:
    phpfmt-issues-2

  3. And, it also add method to 'public' if there nothing mentioned something method type. For example:
    phpfmt-issues-3

Disable NewLineBeforeReturn ?

Hi, how do you disable new lines before a return statement ?
The documentation lists a number of transformations, but I am not sure how to change which are applied. I tried adding NewLineBeforeReturn into exclude, but that does not work. I also thought of using custom_arguments, but it does not seem right and I could not find the syntax that would allow to do so

phpfrmt only formats a file once

I have this odd issue, where the formatter will run correctly the first time, but any subsequent format will simply do nothing.

Here's the error output:

8/15/2018, 9:39:41 AM
---------------------
php "/Users/[removed]/.vscode/extensions/kokororin.vscode-phpfmt-1.0.30/node_modules/phpfmt/fmt.phar" --psr2 --indent_with_space=4 /var/folders/27/lgqtwq3n3057zjd_v1v2dkgh0000gp/T/temp-xtudhiqtpq.php

8/15/2018, 9:40:02 AM
---------------------
Command failed: php -l /var/folders/27/lgqtwq3n3057zjd_v1v2dkgh0000gp/T/temp-gephuwg.php

Is there anything I can provide to help find the bug? (Mac OS 10.13.6, VScode 1.26.0)

Edit :suddenly it seems to have started working. I'm not sure why it so often fails, but I have a feeling it has something to do with read/writes on the tmp file.

Array space missing

I have some pictures by formatting the files:
before
after

Because I need to keep the space to made array readable.
Can do this by change my local setting?

By the way, can I only format selected code area?

Thanks!

PHP_VERSION_ID validation seams to be wrong

if (Number(stdout.toString()) < 56000) {

I'm running a PHP Version 5.6.30 and I get this error.
If I run php -r 'echo PHP_VERSION_ID;' the output is 50630

I see you are validation against 56000 and I belive you should be validation against 50600.

If you check the PHP manual if PHP version is 5.2.7 the value for PHP_VERSION_ID will be 50207.

Chears!

Breaks `use trait as` syntax

With this syntax:

<?php
trait TestTrait {
    public function foo() {

    }
}

class Test1 {
    use TestTrait {
        foo as private bar;
    }

    public function baz() {

    }
}

Running this extension causes this output:

<?php
trait TestTrait
{
    public function foo()
    {

    }
}

class Test1
{
    use TestTrait {
        foo as bar;}function baz()
    {

    }
}

What I would expect is more like:

<?php
trait TestTrait {
    public function foo() 
    {

    }
}

class Test1 {
    use TestTrait 
    {
        foo as private bar;
    }

    public function baz() 
    {

    }
}

Issue with HTML/PHP

When HTML is present such as WordPress. Saving repeatedly will force specific things to keep getting pushed.
For example:
<html <?php language_attributes();?>>

Every time you save the space between <html and <?php language_attributes();?> increases.

This is even using:
"phpfmt.passes": [ "AlignPHPCode" ]

Constant arrays on classes causes all keywords before `function` to be removed

If you have a class with a constant on it that is an array, static functions will get re-written to not be static (also, the public keyword gets removed). E.g:

this

<?php

class Bug {
    const BROKEN = array();

    public static function test() {

    }
}

Will get re-written into this:

<?php

class Bug {
    const BROKEN = array();

    function test() {

    }
}

It seems to remove all keywords before the function keyword:

<?php

class Bug {
    const BROKEN = array();

    private function test() {

    }
}

Will get re-written into this:

<?php

class Bug {
    const BROKEN = array();

    function test() {

    }
}

However, this works:

<?php

const WORKS = array();

class Bug {

    public static function test() {

    }
}

These are the settings I'm using:

{
    "phpfmt.exclude": [
        "PSR2CurlyOpenNextLine",
    ],
    "phpfmt.passes": [
        "AlignDoubleArrow"
    ],
    "phpfmt.psr2": true
}

Can't work in v1.23.1 (Windows)

This extension can't work in v1.23.1 (Windows).

{
  "phpfmt.debug_mode": true,
  "phpfmt.indent_with_space": 2,
  "phpfmt.php_bin": "...",
  "phpfmt.psr1": true,
  "phpfmt.psr2": false,
  "[php]": {
    "editor.formatOnSave": true,
    "editor.formatOnSaveTimeout": 3000
  }
}

Breaks `yield from` syntax

When using yield from like:

<?php
class Test2 {
    public function foo() {
        yield 1;
    }

    public function bar() {
        yield from $this->foo();
    }
}

This extension removed the space between from and $this:

<?php
class Test2
{
    public function foo()
    {
        yield 1;
    }

    public function bar()
    {
        yield from$this->foo();
    }
}

phpfmt: cannot find php bin

Hi,

I don't have PHP directory on my PATH when I start code. I Add this setting to my user settings: "phpfmt.php_bin": "C:/Program Files/php/7_2-nts/php.exe", yet your plugin keeps complaing phpfmt: cannot find php bin.
Why is that? Does the plugin try to evaluate the path to php.exe somehow?

Best,
Bernhard

Won’t Format in VS Code 1.23.0

I cannot get phpfmt to format code at all right now. It does not show up in the contextual menu, nor does it format on save any longer. I can’t seem to find any errors in the Developer Tools console that indicate problems, but my guess is that the latest update to VS Code (1.23.0) may have broken this extension. I’ve tried disabling phpfmt, restarting VS Code, reenabling it, and so forth. Nothing has gotten it to work again.

issue of format_on_save

Hi,
I followed these steps:
1.open a PHP file
2. change something and press "ctrl+s" to save it, then it will be formatted correctly.
3.However, I noticed that there is an unsaved sign on the resources label
4. So I press ctrl+s to save it again without any changes
5. After step 4, the auto format never take any effect.
Could you please help me out? I like the align module very much.
Thanks for your wonderful plugin.

"phpfmt.exclude": ["AllmanStyleBraces"] Not working

    "phpfmt.passes": [
        "AlignGroupDoubleArrow"
    ],
    "phpfmt.debug_mode": true,
    "phpfmt.exclude": [
        "AllmanStyleBraces"
    ]

Shouldnt this disable the Allman Style linebraks before brace opening? I want the regular K&R style.

Braces on new line

Hello,
Is there an option to keep (or move) braces to a new line?

if (x=1)
{
  // do something
}
OR
foreach ($updateData as $index=>$arr) 
{
  // loop
}

formating deletes ?> at the end of file

Hello, when I format a php document that finishes with ?> it gets deleted. I have to put a comment after closing the php script in order to formate the document without having it deleted. What should I do?

PHP / HTML mix indents incorrectly

I've noticed that when working in .php files that have a mix of HTML code blocks and PHP code blocks (e.g. WordPress themes), the indentation seems to be incorrect after formatting the file?

If I write some code like this:
screen shot 2018-05-16 at 15 00 21

When I format the file using this extension I get a result like this:
screen shot 2018-05-16 at 15 00 30

I spotted a transformation listed in the readme 'AlignPHPCode - Align PHP code within HTML block'. How would I go about enabling this please?

add rule

Please add rule to format this example

from one line

return response()->json(['success' => false, 'message' => 'message'], 400);

to multiline

return response()->json([
    'success' => false, 
    'message' => 'message'
], 400);

Group use declarations

When I have a group declaration of use, like the following one:

use Namespace\{
    ClassX,
    ClassY,
    ClassZ,
};

And I format it, it turns into this:

use Namespace\ClassX;
use Namespace\ClassY;
use Namespace\ClassZ;

So I think it should stay like the first one, as it is a feature of PHP7.

windows u s e r n a m e : wrap extensionPath and pharRelPath in double quotes

Hi,

Just something that fixed failures on my machine:

in /out/src/PHPFmt.js:128 you could wrap the result of path.join() in double quotes.

args.unshift('"' + path.join(context.extensionPath, pkg.config.pharRelPath) + '"');

That way if "anybody" has spaces in their windows username your extension would still work.

Hope this helps,

Marc

How use tabs instead of spaces ? :/

Hi @kokororin, hope you'r ding well,
I tried to add this setting to my VScode "phpfmt.indent_with_space": false, but is still using spaces instead of tabs, how can i change this ??

Thanks in advance 🥇

Space after return type disappear in multi line argument list if first line of function is variable declaration.

I use PSR2 standard and have similar function inside a class:

private function foobar(
    string $longVariableName,
    string $anotherLongVariableName,
    string $reallyLongVariableName,
    string $tooLongVariableNameSoThatLineLimitExeeds
): string {
    $foobar = 'asd';
    return $foobar;
}

Space between return type and curly bracers just gets deleted if I enable this extension.
If I do something else than declare variable, for example echo, if-statement, etc. space will stay like it should.

smart_linebreak_after_curly, what it does?

Just wondering what is the purpose of smart_linebreak_after_curly option.

It says:

convert multistatement blocks into multiline blocks

Can anyone please provide an example of what it does?
Thanks.

allow cakephp option

Would it be possible to expose the --cakephp formatting option from fmt.phar? It is much closer to my company's coding standards than psr1 or 2. Or for that matter, is is possible to just use the document tab settings rather than a coding standard?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.