Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have Notepad++ version 6.1.8 How can I configure it to highlight the matlab multiline comment %{ ... %} as a comment block?

---EDIT---

I read here that this feature was added to Notepad++ in April, so I downloaded the latest Notepad++ (6.4.5) and installed it over my older 6.1 version, but it still does not highlight Matlab block comments. What should I do to get this feature working?

share|improve this question
    
I've confirmed that block comments are not enabled in the latest changesets in the Scintilla repository. I'm having trouble getting all of the build dependencies sorted out, so it might take me a bit longer than expected. –  Breakthrough Oct 23 '12 at 23:12
    
no problem please take your time and thank you showing interest –  user13267 Oct 24 '12 at 0:50
    
Alright, patch submitted to the Scintilla developers. I'm having a lot of trouble compiling the Notepad++ distributed version of Scintilla though. I can compile the official one, but when I replace my SciLexer.dll with my compiled one, Notepad++'s syntax highlighting doesn't work (or rather, very few "features" do). Unless I can get the NPP version of Scintilla to compile, I'm afraid you'll have to wait until the next version of NPP (which usually has the latest version of Scintilla) to come out. –  Breakthrough Oct 24 '12 at 2:05
add comment

2 Answers

Notepad++ is based on the Scintilla code editing component, so that's the part of the application you'll need to update. I had a quick look through the source code, and found that the main reason is that the LexMatlab.cxx file only contains code to handle inline comments, not block comments.

I've submitted a patch to the Scintilla SourceForge project, so it should be fixed soon with regards to Scintilla. As I mentioned in the comments, I'm having trouble compiling the Scintilla bundled with Notepad++, so unless I can get that going, you'll likely have to wait until NPP's next version is released (which should include an updated Scintilla).

share|improve this answer
    
I checked out your website at bcastell.com/tech-articles/… where you mention that this feature was added in April 2013 and so I downloaded the latest version of Notepad 6.4.4 and installed it over my older version, but it still does not highlight Matlab block comments. Do I need to do something else besides installing notepad++, to get this feature working? –  user13267 Sep 10 '13 at 1:00
    
@user13267 the issue was fixed for Scintilla, which is used by Notepad++ to provide the code highlighting. It's possible that Notepad++ is still using an older (stable) version without the changes. If this is the case, you can try to compile Notepad++ yourself, substituting the included version of Scintilla with the latest source code. Alternatively, you can try just applying the patch I posted to the Scintilla SourceForge project on the version included with the Notepad++ source code and compiling it from there. –  Breakthrough Sep 10 '13 at 15:56
add comment

Changing the default line in the file langs.model.xml to <Language name="matlab" ext="m" commentLine="%" commentStart="%{" commentEnd="%}"> will do the trick. But it is not going to work because notepad++ shall match the % in %{ as the start of a single line comment and not try to match it for a multiline comment. The same goes of %}

Sorry to provide you a solution that is not going to work :-/

share|improve this answer
    
So does that mean I need to do something like recompile Notepad++ to get this feature? Would doing so be feasible? –  user13267 Oct 23 '12 at 2:52
    
That might help. If you change the order in which notepad++ parses the text file ( lexical analyzer / grammar). But that is not my area of expertise. –  Lord Loh. Oct 23 '12 at 3:21
    
@user13267: I may also suggest that you report this to the developers. They may modify the code. This would benefit everyone and you will not have to patch and compile every version they release. –  Lord Loh. Oct 23 '12 at 4:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.