如何在Webstorm中提供Python语法着色?

时间:2014-08-26 19:02:15

标签: python webstorm

我有一个Python项目,我使用WebStorm作为编辑器。问题是Python的语法没有上色。

如何以良好的语法显示Python页面?我的搜索不仅仅是。我不打算用Python开发页面,但我确实希望它们在Webstorm中很好地显示。

3 个答案:

答案 0 :(得分:53)

您唯一的选择是在Python包中使用 TextMate捆绑支持插件

这篇官方文章(附图片)是针对PhpStorm的,但对于WebStorm也应如此:http://confluence.jetbrains.com/display/PhpStorm/TextMate+Bundles+in+PhpStorm

Python有几个TextMate包:https://github.com/textmate?utf8=%E2%9C%93&q=python

答案 1 :(得分:7)

您可以使用非常类似于Python的 Perl 语法。

  1. 转到Perl
  2. 搜索*.py
  3. Registered Patterns
  4. 下添加list($width, $height) = getimagesize($image_dir); // Generic width and height of image // Define minimum size for image $min_width = 700; // Example minimum width $min_height = 500; // Example minimum height // Only scale if the image is larger than the minimum size if ($width > $min_width && $height > $min_height) { // Determine the ratio which the image should be scaled with $ratio = $min_height/$min_width < $height/$width ? $min_height/$height : $min_width/$width; // Set new size $new_width = $width * $ratio; $new_height = $height * $ratio; // Resize image # image_resize($image, $new_width, $new_height) // Generic resize function }

    另一个选择是使用PyCharm,社区版本是免费的。

答案 2 :(得分:0)

首选项->编辑器->文件类型中可能缺少

Python。添加Python之后,请确保添加一个*.py注册的模式。

enter image description here