在IntelliJIDEA中启用嵌入式Javascript语法突出显示

时间:2015-01-02 08:48:39

标签: javascript intellij-idea

在我的IntelliJIDEA javascript代码中,当代码位于单独的javascript文件中时,sytax highlighter工作正常。

然而,对于HTML页面中嵌入的Javascript代码没有得到突出显示。

有任何修复方法吗?

编辑:添加嵌入式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>

1 个答案:

答案 0 :(得分:1)

当我发布这个问题时,我正在使用IntelliJ IDEA社区版,根据我的发现,IntelliJ IDEA社区版不支持Javascript。

请参阅此链接:https://www.jetbrains.com/idea/features/editions_comparison_matrix.html

我切换到IntelliJ IDEA Ultimate Edition并且Javascript突出显示工作正常。