Skip to content

Commit

Permalink
Provide completion inside @var phpdoc tag
Browse files Browse the repository at this point in the history
  • Loading branch information
klesun committed Jul 30, 2018
1 parent 1f8bd03 commit c483038
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/org/klesun/deep_assoc_completion/entry/DeepKeysCbtr.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.intellij.patterns.PlatformPatterns;
import com.intellij.psi.PsiElement;
import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocParamTag;
import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag;
import com.jetbrains.php.lang.psi.elements.*;
import com.jetbrains.php.lang.psi.elements.impl.ArrayHashElementImpl;
import com.jetbrains.php.lang.psi.elements.impl.PhpPsiElementImpl;
Expand Down Expand Up @@ -43,7 +44,7 @@ public DeepKeysCbtr()
this.extend(
CompletionType.BASIC,
PlatformPatterns.psiElement()
.withSuperParent(2, PhpDocParamTag.class),
.withSuperParent(2, PhpDocTag.class),
new DocFqnPvdr()
);
// array_column($arr, '')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,4 @@ public DeepType resolve(ArrayCreationExpressionImpl expr)

return arrayType;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private static MultiType parseReturnDoc(PhpDocReturnTag returnDoc, FuncCtx funcC
{
FuncCtx docCtx = new FuncCtx(funcCtx.getSearch());
docCtx.fakeFileSource = opt(returnDoc);
return Tls.regex("^\\s*(like\\s*|)(.+)$", returnDoc.getTagValue())
return Tls.regex("^\\s*(like\\s*|=|)(.+)$", returnDoc.getTagValue())
.fop(match -> match.gat(1))
.fop(expr -> DocParamRes.parseExpression(expr, returnDoc.getProject(), docCtx))
.def(MultiType.INVALID_PSI);
Expand Down
1 change: 1 addition & 0 deletions tests/src/DeepTest/UnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1338,6 +1338,7 @@ public function provideNoNsNoCompletion($srcEmpl)
public function providePqParserArrayUnshiftMemoryOverflow(string $pqDump)
{
$list = [];
/** @var $parsed = YakumoRan::acquireChen() */
$parsed = PqParserUnshiftOverflow::parse($pqDump);
$parsed[0][''];
// should not cause infinite recursion
Expand Down
10 changes: 5 additions & 5 deletions tests/src/Lib/UnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,6 @@ public function provideOptionChain()
return $list;
}

/**
* following not resolved yet
*/

public static function provideInstRecursion()
{
$schema = new DictP([], [
Expand All @@ -260,13 +256,17 @@ public static function provideInstRecursion()
])]),
]);
$sample = ParamUtil::sample($schema);
$sample['passengers'][0]['fullName'];
$sample['passengers'][0][''];
// must not reach the 10000 expression limit
$list[] = [$sample['passengers'][0], ['absoluteNumber' => [], 'fullName' => []]];
$list[] = [$sample['segments'][0], ['airline' => [], 'departureAirport' => []]];
return $list;
}

/**
* following not resolved yet
*/

public static function provideCachedFuncCall()
{
$list = [];
Expand Down

0 comments on commit c483038

Please sign in to comment.