WordPress.org

Make WordPress Core

Opened 15 months ago

Closed 15 months ago

Last modified 12 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:

Description

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 15 months ago.
47769-2.diff (748 bytes) - added by ediamin 15 months ago.
Update patch. Only using php and remove application/x-httpd-php

Download all attachments as: .zip

Change History (9)

@ediamin
15 months ago

#1 @ianbelanger
15 months ago

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

#2 @SergeyBiryukov
15 months ago

  • Milestone changed from Awaiting Review to 5.3

#3 @SergeyBiryukov
15 months ago

Introduced in [41376].

#4 @ianbelanger
15 months ago

  • Version set to 4.9

#5 @SergeyBiryukov
15 months 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.

@ediamin
15 months ago

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

#6 @SergeyBiryukov
15 months 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
12 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.