• Stars
    star
    267
  • Rank 153,621 (Top 4 %)
  • Language
    Java
  • License
    Other
  • Created almost 8 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A phpstorm plugin for associative array key typing and completion

PRs are welcome, will gladly help with any questions you may have, but pls try to avoid unnecessary refactoring and features that may cause considerable performance degradation, as such PRs won't be accepted. If in doubt, create an issue to discuss whether feature will be acceptable before starting investing into the solution.

If you need help with building the project or understanding the code, feel free to drop at https://t.me/klesun_productions, we can chat there ;)


Autocomplete keys of associative arrays defined in other functions.

Jetbrains Repository: 9927-deep-assoc-completion

Features description

(a bit more relaxed usage guide can be found here)

  • Completion from expression

    When you are going to type an associative key of a variable, like in $user[''], put caret between quotes and press ctrl + space. The plugin will analyze your code, determine what keys does $user have and suggest completion.

  • Go To Definition

    Go To Definition

    To go to the key definition, hover on it and press ctrl + click or put carret on it and press ctrl + b.

  • Completion from phpdoc

    See formats description

    Completion from phpdoc

    You can specify function argument type using @param SomeType $varName = Some::phpExpression(), like @param $anime = ['genre' => 'shounen', 'studio' => 'Shaft']. = is mandatory and expression must be a valid php expression. Class methods can be specified either with complete namespace like \Very\Long\Namespace\ClassName::funcName(), or with just ClassName::funcName().

    You can specify @return array keys as well:

    /**
     * @return array [
     *     'success' => true,
     *     'formObject' => new Form,
     *     'errors' => [],
     * ]
     */
    public static function processForm($arr);

    Completion from @return phpdoc

  • Object type info in an associative array

    Object type info in an associative array

    Phpstorm does not give you method name completion when object is located in an associative array? Don't be sad, this plugin is exactly what you need!

  • To N-th Test

    To N-th Test

    Did you ever want an ability to find out which exactly test case does phpunit mean by the with data set "17" without manually counting them? You can find this feature in Tools -> deep-assoc-completion -> To N-th Test. It moves your caret to the test case with the order you specify in the popup. If there are multiple @dataProvider functions in the file, the function caret is currently in will be used. This action will work correctly only on more or less straightforward @dataProvider-s.

  • String value completion

    String Value Completion

    String Value Completion

  • Transpile to JS code (not related to completion anyhow, but whatever)

    Transpile to JS code

Completion sources

  • Argument type resolution based on what was passed to the function

    Keep Track of What is Passed to the Function

    Infer type based on function usage when inside function

    Extremely useful for small private helper functions - you don't need to document args in each of them to get completion.

  • Keys from PDOStatement::fetch() if your Database is connected to IDEA

    PDO completion

  • All built-in array functions I could find are supported

    built-ins

    static key built-ins






Steps to compile plugin into a .jar follow:

  • Start creating a new project in Intelliji Idea.
  • Select Intelliji Platform Plugin.
  • Select a phpstorm or IDEA Ultimate installation directory as Project SDK (java version is 8).
  • Select deep-assoc-completion project folder as Project location.
  • In Project Structure -> Libraries add php/lib/php.jar, php/lib/php-openapi.jar and twig/lib/twig.jar from YourPhpStormDirectory/plugins/[php|twig] (in case of IDEA Ultimate, the php and twig plugins should be installed, and the location is HomeOrMyDocumentsDir/.IntellijIdea20XX.X/config/plugins/[php|twig]/lib).
  • In Project Structure -> Modules -> Dependencies set Scope of php, php-openapi and twig to Provided.

To build a jar use Build -> Prepare Plugin ... For Deployment. To debug use Run -> Debug. Since phpstorm project takes about a minute to start, you must find Run -> Reload Changed Classes very useful for micro changes.

To use compiled .jar in your phpstorm go to Settings -> Plugins -> Install plugin from disk and select the .jar we compiled earlier.


Shutout my thanks to the JetBrains for continuously supplying me an open source IDE license for this plugin development.

More Repositories

1

ts-browser

Run typescript files with imports on the fly. Like ts-node, but for browser
JavaScript
93
star
2

deep-assoc-completion-vscode

A work-in-progress extension for vscode similar to deep-assoc-completion for phpstorm
TypeScript
14
star
3

deep-js-completion

A Webstorm/IDEA plugin for js object property completion inferred from a complex context
Scala
12
star
4

deep-dict-completion

Pycharm plugin for deep type inference based dict keys completion. As you may see from commit history, it was not updated for years since I don't use python myself, but I'm still open for small feature requests - if you file an issue, I'll likely implement it in a week or so...
Java
8
star
5

iron-ladybug

A 3d adventure game in Unity
C#
4
star
6

muramasa-vn-translation

Gonna put some work towards extracting text, recording gameplay and translating to the Soukou Akki Muramasa Visual Novel
NWScript
4
star
7

bcu-bugs-public

This repository is intended for public documentation and discussion of known bugs in the Blockchain Cuties maintained by players. Issues that get much exposure and reactions are more likely to be picked up by the dev team..
3
star
8

kunkka-tor.rent

A web app that allows playing video/music from torrents directly in the browser, without downloading to PC
TypeScript
2
star
9

old_java_shmidusic

Write sheet music using MIDI-keyboard. Development finished, see description.
Java
2
star
10

hardsub-ocr-by-font

A Rust script that takes an H.264 video and outputs a json file with the timestamps of consequential pixel-wise unchanging (or almost unchanging) frames. Need this for a recording of a visual novel playthrough to detect when text panel changes (plan to feed to OCR!)
Rust
2
star
11

kusarihime-translation

Similar to Muramasa, this repo will hold textracted Japanese texts from the VN and all translations I'll manage to produce
JavaScript
1
star
12

io-ts-better-union-error-reporter

A pretty-printer for io-ts errors that filters out unions that clearly don't match the tag literal in input data - it only includes the union option having the most fields matching the data
TypeScript
1
star
13

deep-assoc-lang-server

The backend of the vscode extension. Possibly will reuse it in phpstorm plugin as well, if it grows with it's own stuff like static analyzis.
TypeScript
1
star