Chrome Version : 107.0.5304.110 (Official Build) (x86_64)
OS : macOS Version 11.6.7 (Build 20G630)What steps will reproduce the problem?
— Add a folder that contains a PHP file to the Workspace in Sources tab
- Click to the PHP file to see its contentWhat is the expected result?
The content of the PHP file should have syntax highlighting like JS, HTML, XML, JSON and python files. The dependencies are already loaded but not used:https://github.com/ChromeDevTools/devtools-frontend/blob/main/front_end/third_party/codemirror.next/package.json#L16
I think there is a mime-type issue:https://github.com/ChromeDevTools/devtools-frontend/blob/main/front_end/ui/components/code_highlighter/CodeHighlighter.ts#L122
The mime type of the file is "text/x-php" because the file is in a Workspace and served via operating system, not a server. I think the mime should be "text/x-php" not "application/x-httpd-php".
// Begin Terminal
file --mime-type test.php: text/x-php
// End TerminalWhat happens instead?
The content shows in the editor, but no syntax highlighting and any PHP language support. Please see the attachment.
Maybe you can add alternative mime types to CodeHighlighter.ts, just like you did for JS files. I'm not sure if it will be enough to solve, though, but I just wanted to share it as an idea.
What do you think? I tried to open an issue with above content on Issues - chromium
but looks like there are a lot of spams in there, so I was afraid nobody will see it, so I decided to add here too.