Eclipse code fomatting

2019-07-22 01:29发布

I have some twig files that are a mixture of JavaScript, HTML, and twig markup. Is there a way with Eclipse to hi-lite a section of code and format it as, say JavaScript, then hi-lite another section and format it as HTML? I tried association the file type *.twig with the JavaScript editor, but, I do not seem to get any formatting. Syntax highlighting and code completion would be good too.

Thanks, Scott

2条回答
我命由我不由天
2楼-- · 2019-07-22 01:55

You can try to find a plugin that will support twig files and provide syntax highlighting. The Twig Eclipse Plugin looks promising as it at least seems to support HTML and twig markup together.

查看更多
我想做一个坏孩纸
3楼-- · 2019-07-22 02:13

It is possible. If you have HTML/JS editors available (eclipse classic has them by default).

  1. Go to preferences and: General > Editors > File Associations and add *.twig as a new file type and then add HTML editor (in the bottom panel) to it.
  2. Then go to: General > Content Types, click on Text/HTML node (in Content Types box) and add *.twig file association in the bottom panel.

I've checked this and it works.

查看更多
登录 后发表回答