Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 20 months ago

#47769 closed enhancement (fixed)

Add autocomplete support in code editor for php mode

Reported by: ediamin's profile ediamin Owned by: sergeybiryukov's profile 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 4 years ago.
47769-2.diff (748 bytes) - added by ediamin 4 years ago.
Update patch. Only using php and remove application/x-httpd-php

Download all attachments as: .zip

Change History (10)

@ediamin
4 years ago

#1 @ianbelanger
4 years ago

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

#2 @SergeyBiryukov
4 years ago

  • Milestone changed from Awaiting Review to 5.3

#3 @SergeyBiryukov
4 years ago

Introduced in [41376].

#4 @ianbelanger
4 years ago

  • Version set to 4.9

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

@ediamin
4 years ago

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

#6 @SergeyBiryukov
4 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
4 years 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/

#8 @SergeyBiryukov
20 months ago

#42109 was marked as a duplicate.

Note: See TracTickets for help on using tickets.