Haehnchen / idea-php-toolbox

Collections of tools and improvements to make PhpStorm a little bit better
http://phpstorm.espend.de/php-toolbox
MIT License
158 stars 20 forks source link

Add json_file provider #42

Open nazar-pc opened 8 years ago

nazar-pc commented 8 years ago

I have translation files. They are .*/languages/[^/]+\.json (it was path regexp) files located in multiple places across projects. In simplest use case keys from those files are used as properties of object (using __get() method):

\cs\Language::instance()-><caret>

I imagine this something like:

{
    "name"   : "translations",
    "source" : {
        "contributor" : "json_file",
        "path_mask"   : ".*/languages/[^/]+\\.json",
        "lookup"      : "key",
        "text"        : "value"
    }
}

Where lookup might be key or value (is used as lookup_string). And OPTIONAL text is used as type_text.

When and if this trivial use case I can provide few advanced use cases (nested JSON structures and object's properties with common prefix removed).