Eclipse 中 *.php 文件中的 Javascript 高亮显示
我读过其他关于 Eclipse PDT 的 Aptana 插件的文章,并且我已经安装了它,但我的 php 文件中仍然没有 javascript 的语法突出显示。
如果表单已提交,我有一个 php 文件,我的 php 位于顶部,然后其余内容是 javascript/html,显然在 php 标签之外。 html 有语法突出显示,但我的 javascript 仍然没有语法突出显示。我已将 Aptana JS 编辑器添加到设置中的 *.php 文件类型中,但仍然没有任何结果。
我有一种感觉,它默认为 PHPEclipse 编辑器,我猜它不支持 javascript 语法突出显示?有什么想法或者我被迫将所有 javascript 文件置于 php 文件之外吗?
I have read other posts talking about the Aptana plugin with Eclipse PDT and I've installed it and still have no syntax highlighting of javascript within my php files.
I have a php file with my php at the top if the form has been submitted and then the rest of the content is javascript/html, outside the php tags obviously. The html has syntax highlighting but I still have no syntax highlighting for the javascript. I've added the Aptana JS editor to the *.php file types in the settings and still nothing.
I have a feeling that it's defaulting to the PHPEclipse editor, which I guess doesn't support javascript syntax highlighting? Any ideas or am I forced to make all of my javascript files external to the php file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
像这样的 PHP 文件将是四种不同编辑器的组合:PHP、HTML、CSS 和 JavaScript
PDT 使用 Web 工具项目 (WTP/WST) 来支持 HTML、JS 和 CSS。无法在使用 PDT PHP 编辑器打开的文件中使用 Aptana HTML、CSS 或 JS 编辑器,因此您在 PDT 中获得的支持级别完全取决于 WTP 编辑器。唯一的解决方案是将 JavaScript 外部化到一个单独的文件中,您可以使用 Aptana JavaScript 编辑器打开该文件。
Aptana Studio 2 使用 PDT 进行 PHP 编辑。 Aptana Studio 3 捆绑了自己的 PHP 编辑器,因此您将获得 PHP 部分的 PHP 编辑器 + 对 HTML、CSS 和 JavaScript 的 Aptana 支持的组合。
A PHP file like that will be a combination of four different editors: PHP, HTML, CSS, and JavaScript
PDT uses the Web Tools Projects (WTP/WST) for HTML, JS and CSS support. It's impossible to use the Aptana HTML, CSS, or JS editors inside a file opened with the PDT PHP editor, so the level of support you get in PDT is completely dependent on the WTP editors. Your only solution there would be to externalize your JavaScript into a separate file, which you could open with the Aptana JavaScript editor.
Aptana Studio 2 used the PDT for PHP editing. Aptana Studio 3 bundles its own PHP editor, so you will get the combination of a PHP editor for the PHP-parts + Aptana support for HTML, CSS and JavaScript.
您可能无法在 PHP 编辑器中“激活”更好的 JavaScript 支持,因为这只是缺乏支持问题。
You are probably not going to be able to "activate" better JavaScript support in the PHP editor since it simply a lack of support issue.
实际上,您只需在“PHP 源代码编辑器”而不是“PHP 编辑器”中打开该文件即可。前者来自 Aptana,提供了对 JS 的改进支持,并且允许您使用添加的 jQuery 包,而标准(PDT 提供的)“PHP 编辑器”确实具有 Aptana 版本中缺少的一些功能,但通常被 Aptana 击败。我们将看看它们将来会走向何方,但 Aptana 带来了一些不错的功能。
Actually, you just need to open the file in the "PHP Source Editor" instead of the "PHP Editor". The former is from Aptana and provides the improved support for JS, plus allows you to use added jQuery bundles, while the standard (PDT-supplied) "PHP Editor" does have some features lacking in the Aptana version, but is generally trumped by Aptana. We'll see where they go in the future, but Aptana has brought some nice features to the table.