smartparens icon indicating copy to clipboard operation
smartparens copied to clipboard

Add sp-forward-hybrid-sexp and sp-backward-hybrid-sexp

Open Fuco1 opened this issue 7 years ago • 0 comments

This is like moving by lines except it jumps over the "logical lines", that is one statement spread over multiple lines. So in case we have something like

|$credentials = $this->facade->create([
    'email' => '[email protected]',
    'name' => 'Bill',
    'password' => 'QWErty098',
    'projectId' => $this->resourceProvider->getValidProject()->getId(),
    'role' => Security\Roles::AGENT,
    'salescode' => 'TST0002',
], $admin);

normal navigation by sexp would land after $credentials, then over the method chain and finally only at the ( it would jump to the end of the statement. The hybrid sexp recognizes this entire thing as one entity and jumps to the end of the logical line, which is at the semicolon.

Note that this is NOT ALWAYS just "go to semicolon", it would work without semicolon just as fine. Also inside the [...] array the end of hybrid sexp is at the ending ] not at the end of the statement. In other words, it should recognize any statement spread over multiple line which is still one "node" in the AST.

Super cool!

Fuco1 avatar Jan 19 '18 11:01 Fuco1