Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 22 months ago

#47769 closed enhancement (fixed)

Add autocomplete support in code editor for php mode

Reported by: ediamin Owned by: SergeyBiryukov
Milestone: 5.3 Priority: normal
Severity: normal Version: 4.9
Component: Administration Keywords: has-patch has-dev-note
Focuses: javascript, administration Cc:


In plugins editor or theme editor pages WP uses the code-editor.js to implement CodeMirror and its autocomplete feature. But in those pages we are settings $mode = 'php' but code-editor.js supports $mode = 'application/x-httpd-php' for autocompletion. This patch includes a small change to support for php mode also.

Attachments (2)

47769.diff (809 bytes) - added by ediamin 2 years ago.
47769-2.diff (748 bytes) - added by ediamin 2 years ago.
Update patch. Only using php and remove application/x-httpd-php

Download all attachments as: .zip

Change History (9)

2 years ago

#1 @ianbelanger
2 years ago

  • Component changed from Editor to Administration
  • Type changed from defect (bug) to enhancement

#2 @SergeyBiryukov
2 years ago

  • Milestone changed from Awaiting Review to 5.3

#3 @SergeyBiryukov
2 years ago

Introduced in [41376].

#4 @ianbelanger
2 years ago

  • Version set to 4.9

#5 @SergeyBiryukov
2 years ago

Hi @ediamin, welcome to WordPress Trac!

Thanks for the patch, it works as expected in my testing.

Since wp_get_code_editor_settings() explicitly sets mode to 'php' when $type is 'application/x-httpd-php', I think it's safe to just replace application/x-httpd-php with php here.

2 years ago

Update patch. Only using php and remove application/x-httpd-php

#6 @SergeyBiryukov
2 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 45670:

Code Editor: Check for correct mode value in wp.codeEditor.initialize to enable autocomplete support for PHP.

Props ediamin.
Fixes #47769.

#7 @desrosj
22 months ago

  • Keywords has-dev-note added

Mentioned in the Miscellaneous Developer Focused Changes dev note for 5.3: https://make.wordpress.org/core/2019/10/15/miscellaneous-developer-focused-changes-in-5-3/

Note: See TracTickets for help on using tickets.