How can I create an autoplete and how to highlight html, javascript and css inside php for the Ace editor /.
<html>
<head>
<title><?=$title; ?></title>
<style>
body {
background: black;
color: white;
}
</style>
<script>
alert("this is only a no-sense test script....");
</script>
</head>
<body>
This is only a no-sense test script but I want that html tags, css styles and javascript code are highlighted....<br />
Is it possible?
</body>
</html>
(sorry for my english)
How can I create an autoplete and how to highlight html, javascript and css inside php for the Ace editor http://ace.ajax/.
<html>
<head>
<title><?=$title; ?></title>
<style>
body {
background: black;
color: white;
}
</style>
<script>
alert("this is only a no-sense test script....");
</script>
</head>
<body>
This is only a no-sense test script but I want that html tags, css styles and javascript code are highlighted....<br />
Is it possible?
</body>
</html>
(sorry for my english)
Share Improve this question edited Jan 24, 2012 at 14:49 Charles 51.5k13 gold badges106 silver badges144 bronze badges asked Oct 29, 2011 at 12:46 Seingh HaccoskiSeingh Haccoski 331 silver badge4 bronze badges 2- Is this actually a feature request for the ace editor? Apart from that, highlighting code within php code is supposedly something wickedly difficult. I use Aptana, which I think is a very fine and enhanced IDE, but even that doesn't highlight html code in say an echo php-statement... – kasimir Commented Oct 29, 2011 at 13:01
- i do not want to highlight code inside strings.... – Seingh Haccoski Commented Oct 29, 2011 at 14:25
3 Answers
Reset to default 2These are two questions.
How can I create an autopleter that pletes PHP?
How can I syntax highlight HTLM code inside PHP code?
For the second question, there is some discussion in the Google group for Ace Editor In my opinion, the question is not really answered if it is possible or not, but it seems at least doable. Have a look at the documentation for highlighter, especially about the part "Embedding a different highlighter".
For autopletion, I don't see a chance at all. See the Google group entry about a similar (recent) question.
As of a few months ago the Ace Editor now supports autoplete (see: http://ace.c9.io/#nav=about)
For any one still looking around for this, I found exactly what I needed here: https://github./ajaxorg/ace/wiki/How-to-enable-Autoplete-in-the-Ace-editor
I wanted to enable live auto-pletion, so there is another option enableLiveAutopletion
and enableSnippets
(to give a brief description of the suggestion if available).
I used it like this:
editor.setOptions({
enableLiveAutopletion: true,
enableSnippets: true
});
There is also an example demonstrating how you could add a custom pleter to return results tailored to your specific project.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744406088a4572639.html
评论列表(0条)