在 IntelliJ IDEA 中启用嵌入式 Javascript 语法突出显示
Enable embedded Javascript syntax highlighting in IntelliJIDEA
在我的 IntelliJIDEA javascript 代码中,当代码位于单独的 javascript 文件中时,代码语法荧光笔工作正常。
但是 Javascript 嵌入在 HTML 页面中的代码没有突出显示。
有可用的修复方法吗?
编辑:添加了嵌入式 JavaScript 代码
<html>
<head>
<!--Load the AJAX API-->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function drawChart() {
// Create the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Slices');
data.addRows([
['Mushrooms', 3],
['Onions', 1],
['Olives', 1],
['Zucchini', 1],
['Pepperoni', 2]
]);
// Set chart options
var options = {'title':'How Much Pizza I Ate Last Night',
'width':400,
'height':300};
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<!--Div that will hold the pie chart-->
<div id="chart_div"></div>
</body>
</html>
我发布此问题时使用的是 IntelliJ IDEA 社区版,根据我的发现,IntelliJ IDEA 社区版不支持 Javascript。
参考这个link:https://www.jetbrains.com/idea/features/editions_comparison_matrix.html
我切换到 IntelliJ IDEA Ultimate Edition 并且 Javascript 突出显示工作正常。
在我的 IntelliJIDEA javascript 代码中,当代码位于单独的 javascript 文件中时,代码语法荧光笔工作正常。
但是 Javascript 嵌入在 HTML 页面中的代码没有突出显示。
有可用的修复方法吗?
编辑:添加了嵌入式 JavaScript 代码
<html>
<head>
<!--Load the AJAX API-->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function drawChart() {
// Create the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Slices');
data.addRows([
['Mushrooms', 3],
['Onions', 1],
['Olives', 1],
['Zucchini', 1],
['Pepperoni', 2]
]);
// Set chart options
var options = {'title':'How Much Pizza I Ate Last Night',
'width':400,
'height':300};
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<!--Div that will hold the pie chart-->
<div id="chart_div"></div>
</body>
</html>
我发布此问题时使用的是 IntelliJ IDEA 社区版,根据我的发现,IntelliJ IDEA 社区版不支持 Javascript。
参考这个link:https://www.jetbrains.com/idea/features/editions_comparison_matrix.html
我切换到 IntelliJ IDEA Ultimate Edition 并且 Javascript 突出显示工作正常。