Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive keyword detection in MATLAB M Scripts #5798

Closed
tpajenkamp-dspace opened this issue Jun 17, 2019 · 4 comments
Closed

False positive keyword detection in MATLAB M Scripts #5798

tpajenkamp-dspace opened this issue Jun 17, 2019 · 4 comments

Comments

@tpajenkamp-dspace
Copy link

Description of the Issue

For M scripts the syntax highlighting and code folding breaks if keywords (case-insensitive) are used as structure field names.

Steps to Reproduce the Issue

  1. Create M file with the following content
function [s] = foo()
   s = struct();
   s.End = 42;
   s.if = 0;
end
  1. "End" in s.End is highlighted as keyword (note that only "end" is an actual keyword, maybe only in newer MATLAB versions(?))
    3, "if" in s.if is highlighted as keyword
  2. Code-folding matches "function" with "s.End"
  3. Code-folding applies a new bracket for "s.if"

Expected Behavior

  • Field names that happen to be keyword names are not highlighted, especially not if they use different case
  • "function" is matched with the last line for code folding and this is the only folding option.

Actual Behavior

image

  • "End" in s.End is highlighted as keyword (note that only "end" is an actual keyword, maybe only in newer MATLAB versions(?))
  • "if" in s.if is highlighted as keyword
  • Code-folding matches "function" with "s.End"
  • Code-folding starts a new bracket for "s.if"

Debug Information

Notepad++ v7.7 (64-bit)
Build time : May 19 2019 - 13:05:35
Path : C:\Program Files\Notepad++\notepad++.exe
Admin mode : OFF
Local Conf mode : OFF
OS : Windows 10 (64-bit)
Plugins : mimeTools.dll NppConverter.dll NppExport.dll NPPJSONViewer.dll NppSaveAsAdmin.dll XMLTools.dll

@zufuliu
Copy link
Contributor

zufuliu commented Jun 18, 2019

bug for 'End' is reported at https://sourceforge.net/p/scintilla/bugs/2112/
It's bad style to use if (or other keywords) as a field/property name.

@tpajenkamp-dspace
Copy link
Author

Thanks for handling and transferring the issue.
Ideally, any legal code would be handled correctly but I understand that there is not much to gain by treating obscure edge cases I stumbled upon when investigating the real issue. "start"/"end" make a nice pairing, though...

@zufuliu
Copy link
Contributor

zufuliu commented Jun 25, 2019

Case-sensitivity for Matlab keywords was fixed.

@ArkadiuszMichalski
Copy link
Contributor

End was fixed, but if still no, in Notepad++ 7.9 RC we see:

a

@donho donho closed this as completed Sep 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants