开发者

Is there a notepad++ plugin that makes JSP comments format correctly?

开发者 https://www.devze.com 2023-01-04 23:22 出处:网络
I would love Notepad++ to show the comments correctly (see screenshot) Is there any plugin that takes care of it? Or is there an开发者_Go百科y way I can get it to default to another languages\' forma

I would love Notepad++ to show the comments correctly (see screenshot)

Is there any plugin that takes care of it? Or is there an开发者_Go百科y way I can get it to default to another languages' formatting when I load a JSP file?


It seems that the JSP syntax highlighter uses the VB rules between <% %> tags.


Since Notepad++ 5.6.5 which was released only 5 monts ago there's a builtin JSP syntax highlighter. Are you using the right version? If it's behaving buggy, you'd better report a bug to the Notepad++ guys.


It seems that the current JSP support is really just relabelled ASP support, so the Java specific parts of this are broken. (This also explains why if you put a single-quote in the text of a server-side comment, it highlights that part of the comment but not the rest of it.)

Because grokking a JSP file properly will require parsing some ASP-like syntax and JavaScript-like syntax this really needs to be fixed upstream in the Scintilla project.

Scintilla currently has four feature requests for this, of various vintage since 2005... and yes I know this thread is four years old, but nothing much seems to have changed. I'll have a look in my spare time at how easy it would be to enhance the cut-and-paste of ASP that's currently there into something better, starting with comments as it's annoying the heck out of me too.


I know it is a really old question, but I had the same problem and I solved it just modifying the file style.model.xml in the directory Programs/Notepad++ in this way:

  1. Copy and paste the node LexerType with name="asp"
  2. Rename the new node with name="jsp" desc="JSP" ext="jsp"
  3. Eventually place it in the right alphabtical order (just for finding purpose)
  4. Save
  5. Restart notepad++

The result should be like this:

<LexerType name="jsp" desc="JSP" ext="jsp">
  <WordsStyle name="DEFAULT" styleID="81" fgColor="8000FF" bgColor="C4F9FD" fontName="" fontStyle="0" fontSize="" />
  <WordsStyle name="COMMENTLINE" styleID="82" fgColor="008000" bgColor="C4F9FD" fontName="" fontStyle="0" fontSize="" />
  <WordsStyle name="NUMBER" styleID="83" fgColor="FF0000" bgColor="C4F9FD" fontName="" fontStyle="0" fontSize="" />
  <WordsStyle name="WORD" styleID="84" fgColor="000080" bgColor="C4F9FD" fontName="" fontStyle="1" fontSize="" keywordClass="instre1" />
  <WordsStyle name="STRING" styleID="85" fgColor="808080" bgColor="C4F9FD" fontName="" fontStyle="0" fontSize="" />
  <WordsStyle name="IDENTIFIER" styleID="86" fgColor="000000" bgColor="C4F9FD" fontName="" fontStyle="0" fontSize="" />
  <WordsStyle name="ASPSYBOL" styleID="15" fgColor="000000" bgColor="FFFF00" fontName="" fontStyle="1" fontSize="" />
  <WordsStyle name="SCRIPTTYPE" styleID="16" fgColor="000000" bgColor="FFC000" fontName="" fontStyle="0" fontSize="" />
</LexerType>
0

精彩评论

暂无评论...
验证码 换一张
取 消