用于 Laravel Blade 的 Adob​​e Dreamweaver 代码着色

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18930226/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 08:27:41  来源:igfitidea点击:

Adobe Dreamweaver Code Coloring for Laravel Blade

phpadobelaraveldreamweaverblade

提问by user1995781

I guess many people who use Dreamweaver as text editor for Laravel Blade will face the problem of unsupported code / syntax coloring. Without code coloring, the coding is hard to read. Therefore, I decided to do some "hacking" on dreamweaver to get the code coloring works with Laravel Blade.

我想很多使用 Dreamweaver 作为 Laravel Blade 文本编辑器的人都会面临代码/语法着色不受支持的问题。如果没有代码着色,代码很难阅读。因此,我决定在 Dreamweaver 上进行一些“黑客攻击”,以使用 Laravel Blade 进行代码着色。

To do that, you need to go to C:\Program Files (x86)\Adobe\Adobe Dreamweaver CS6\configuration\CodeColoring folder. Then, edit the php.xml file.

为此,您需要转到 C:\Program Files (x86)\Adobe\Adobe Dreamweaver CS6\configuration\CodeColoring 文件夹。然后,编辑 php.xml 文件。

Add the following under the CodeColor_PHPScriptBlock

在 CodeColor_PHPScriptBlock 下添加以下内容

<blockStart doctypes="PHP_MySQL" scheme="customText"><![CDATA[{{]]></blockStart>
<blockEnd><![CDATA[}}]]></blockEnd>
<blockStart doctypes="PHP_MySQL" scheme="customText"><![CDATA[{{{]]></blockStart>
<blockEnd><![CDATA[}}}]]></blockEnd>

Then, add the following under the CodeColor_PHPScriptComment

然后,在 CodeColor_PHPScriptComment 下添加以下内容

<commentStart><![CDATA[--]]></commentStart>
<commentEnd><![CDATA[--]]></commentEnd>

Now, you should have the code coloring and the code hinting working.

现在,您应该让代码着色和代码提示正常工作。

However, I am still unable to get the Blade syntax coloring works in Dreamweaver. Here are the syntax that are still not working:

但是,我仍然无法在 Dreamweaver 中使用 Blade 语法着色。以下是仍然不起作用的语法:

@section
@show
@yield
@extends
@parent
@stop
@if
@elseif
@else
@endif
@unless
@endunless
@for
@endfor
@foreach
@endforeach
@while
@endwhile
@include
@overwrite
@lang
@choice

If you know how to get the above syntax coloring works in Dreamweaver, please share with me. Thanks.

如果您知道如何在 Dreamweaver 中实现上述语法着色,请与我分享。谢谢。

回答by Pedro Guglielmo

Maybe use @ as blockStart and ) as blockEnd. Problem is to keep track of opening and closing parenthesis.

也许使用@ 作为blockStart 和) 作为blockEnd。问题是跟踪左括号和右括号。

This is the basic concept here, at github.com/Medalink/laravel-blade (laravel-blade.tmLanguage):

这是这里的基本概念,在 github.com/Medalink/laravel-blade (laravel-blade.tmLanguage):

<key>foldingStartMarker</key>
<string>\@\b(section)\b(?=(|\s*|)\()</string>
<key>foldingStopMarker</key>
<string>\)(?!.*\))</string>