Skip to content
This repository has been archived by the owner on Aug 12, 2018. It is now read-only.

Is it possible to add support for MATLAB #28

Open
zhiboz opened this issue Nov 5, 2012 · 27 comments · May be fixed by #36
Open

Is it possible to add support for MATLAB #28

zhiboz opened this issue Nov 5, 2012 · 27 comments · May be fixed by #36
Assignees

Comments

@zhiboz
Copy link

zhiboz commented Nov 5, 2012

MATLAB is gaining its popularity among engineering professionals and students; Its creator, MathWorks, claims that it has over 2 million users worldwide. Is it possible for you to add support for MATLAB please? Thanks very much!

@XhmikosR
Copy link
Owner

XhmikosR commented Dec 1, 2012

Sorry for the late reply, I totally missed the notification.

If Scintilla supports it and someone provides the keywords I could add it I guess. Although I don't use MATLAB at all so I need some good code samples to check if everything works.

@XhmikosR
Copy link
Owner

XhmikosR commented Dec 2, 2012

You can't attach anything on GitHub. So use the webform and upload the files somewhere easily accessible.

@zhiboz
Copy link
Author

zhiboz commented Dec 3, 2012

You may get a copy from http://www.mathworks.com/matlabcentral/fileexchange/8550 . Thanks!

@XhmikosR
Copy link
Owner

Please try this build and let me know.

Keep in mind that I don't use Matlab myself so there might be things that should be different. The code changes are in the Matlab branch here.

Also the lexer itself which comes from Scintilla seem a little limited, for example it doesn't highlight block comments properly when I use %{...%}, but from what I read this should be supported.

@XhmikosR
Copy link
Owner

I cannot do that because .m files are associated to open with the C/C++ lexer. I'm pretty sure there is another way to solve this apart from removing .m files from the C/C++ filelist, but unfortunately I have no idea how to do this at this point.

@XhmikosR
Copy link
Owner

XhmikosR commented Feb 4, 2013

I didn't mean supported in Scintilla, since I know it's not... I mean that in general %{...%} is a block comment in Matlab.

Anyway, not sure what I'm going to do with this patch since like I said above m files are associated with the C/C++ lexer.

@XhmikosR
Copy link
Owner

XhmikosR commented Mar 7, 2013

The matlab branch is up to date, but I still don't know if I should merge this.

If anyone is interested to work on this, they are more than welcome to do so.

@XhmikosR XhmikosR linked a pull request Mar 7, 2013 that will close this issue
2 tasks
@XhmikosR
Copy link
Owner

XhmikosR commented Apr 8, 2013

Block comments are properly detected now with the updated Scintilla.

@zhiboz
Copy link
Author

zhiboz commented Apr 9, 2013

Great news, very much appreciated! Any plan to merge this into the master branch?

@zhiboz zhiboz closed this as completed Apr 9, 2013
@XhmikosR
Copy link
Owner

XhmikosR commented Apr 9, 2013

I cannot solve the issue with .m files. Please leave this ticket open until the patch is merged.

@XhmikosR XhmikosR reopened this Apr 9, 2013
@XhmikosR
Copy link
Owner

XhmikosR commented Apr 9, 2013

Another thing I noticed.

M = regexp(str, {'(?-i)\w{5}(?=CASE)', ...
                 '(?i)\w{5}(?=CASE)'}, 'match');

M{:}
ans =
    'UPPER'
ans =
    'UPPER'    'lower'
    break

If I comment out

M = regexp(str, {'(?-i)\w{5}(?=CASE)', ...
                 '(?i)\w{5}(?=CASE)'}, 'match');

M{:}
%{ans =
    'UPPER'%}
ans =
    'UPPER'    'lower'
    break

It shows as if it's commented out until the end. But this is a Scintilla issue.

@zhiboz
Copy link
Author

zhiboz commented Apr 9, 2013

MATLAB editor handles it this way too. It works if you put %} into a separate line as below.

M{:}
%{
ans =
'UPPER'
%}
ans =
'UPPER' 'lower'
break

@ghost ghost assigned XhmikosR Apr 9, 2013
@XhmikosR
Copy link
Owner

XhmikosR commented Apr 9, 2013

So does this mean that the code isn't commented out unless %} is in a new line?

@zhiboz
Copy link
Author

zhiboz commented Apr 9, 2013

M{:}
%{ans =
'UPPER'%}
ans =
'UPPER' 'lower'
break

I meant at least that the MATLAB editor shows the above code as if it's commented out until the end.

@XhmikosR
Copy link
Owner

XhmikosR commented Apr 9, 2013

Yes I got that, but does it work as expected? If yes then their editor has the same issue or the specs must say that the it must be in a new line.

@zhiboz
Copy link
Author

zhiboz commented Apr 9, 2013

Yes, I believe the document says the opening and closing of the comment blocks have to be in their own lines.

@XhmikosR
Copy link
Owner

XhmikosR commented Apr 9, 2013

That's too bad cause I can't fix it properly at this point.
I mean I can easily add a new line, but I need to take account for the document's line endings.

I'll add this in the PR's todo.

@zhiboz
Copy link
Author

zhiboz commented Apr 9, 2013

Thanks very much for your extra efforts! Any chance you could put a x64 build somewhere? I only have VS2010 Express and can not compile np2-mod with it any more.

@XhmikosR
Copy link
Owner

I added the VS2010 scripts and stuff back.

@Kongsea
Copy link

Kongsea commented Apr 16, 2013

I want a x86 Notepad2 copy supported MATLAB too.
Can you send me a copy please?
my email is konguo#gmail.com (please replace # with @)

@XhmikosR
Copy link
Owner

No, sorry. You can see #36 and help me fix the TODO issues; then it will be merged in the master branch.

@amroamroamro
Copy link

Your previous link is dead. Here is my personal build with MATLAB support (link removed per XhmikosR request)

Basically I rebased the matlab branch on top of master, and merged it. Then I built the solution using VS2013 Update 3 (both x86/x64).

I had to fix a minor bug in src/Styles.h, your forgot to increment the number of lexers in a macro: s/#define NUMLEXERS 37/#define NUMLEXERS 38/

The stream comment bug discussed is obviously still there (someone ought to fix the MATLAB lexer in upstream Scintilla). I think it's a minor thing and I can live with it for the moment... Better than having no MATLAB support at all :)

If anyone is interested in working on fixing the bug, here are the doc pages for the "block comment" construct:
http://www.mathworks.com/help/matlab/matlab_prog/comments.html
http://www.mathworks.com/help/matlab/ref/specialcharacters.html#bqwxykj-1

@XhmikosR
Copy link
Owner

XhmikosR commented Oct 9, 2014

@amroamroamro: please don't distribute random builds.

If you want to help, you can help by fixing the TODOs from #36.

@amroamroamro
Copy link

@XhmikosR: Fair enough. Do you want me to remove the link?

I was just trying to give a quick solution for those who dont have the necessary dev tools installed...

@XhmikosR
Copy link
Owner

XhmikosR commented Oct 9, 2014

That is not a quick solution. The patch isn't ready; if it was, it would have been merged. So, yeah, please remove any links.

@zufuliu
Copy link
Contributor

zufuliu commented Aug 4, 2017

can someone try the build from https://github.com/zufuliu/notepad2/releases?

@XhmikosR
Copy link
Owner

XhmikosR commented Aug 4, 2017

@zufuliu: you could rebase my branch and make any changes there and submit a PR where you CC me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants