Skip to content

Commit 2814e78

Browse files
committed
Fix #54: PHP code blocks should delegate to the 'are-we-in-a-word-and-that-feature-is-enabled' parent implementation for code completion
1 parent 0c15dc0 commit 2814e78

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

src/main/java/org/fife/rsta/ac/html/HtmlCompletionProvider.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,24 @@ private static boolean insideMarkupTag(RSyntaxTextArea textArea,
422422

423423

424424
/**
425-
* {@inheritDoc}
425+
* Returns the base implementation - basically checking that the
426+
* caret comes immediately after letters. This is here for
427+
* subclasses that sometimes auto-activate in markup, other times
428+
* auto-activate in some other language, such as PHP.
429+
*
430+
* @param tc The text component.
431+
* @return Whether auto-activation is okay outside of markup.
432+
* @see #isAutoActivateOkay(JTextComponent)
433+
*/
434+
protected boolean isAutoActivateOkayOutsideOfMarkup(JTextComponent tc) {
435+
return super.isAutoActivateOkay(tc);
436+
}
437+
438+
439+
/**
440+
* Overridden to ensure auto-activation only occurs in a markup tag.
441+
*
442+
* @see #isAutoActivateOkayOutsideOfMarkup(JTextComponent)
426443
*/
427444
@Override
428445
public boolean isAutoActivateOkay(JTextComponent tc) {

src/main/java/org/fife/rsta/ac/php/PhpCompletionProvider.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,12 @@ else if (ch1=='?' && ch2=='>') {
242242

243243

244244
/**
245-
* {@inheritDoc}
245+
* Overridden to properly handle both HTML markup and PHP code.
246246
*/
247247
@Override
248248
public boolean isAutoActivateOkay(JTextComponent tc) {
249-
return inPhpBlock(tc) ? false : super.isAutoActivateOkay(tc);
249+
return inPhpBlock(tc) ? isAutoActivateOkayOutsideOfMarkup(tc) :
250+
super.isAutoActivateOkay(tc);
250251
}
251252

252253

0 commit comments

Comments
 (0)