-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
[Feature request]: Json5 highlighting #11676
Comments
@donho, just make a new N++ currently uses none of the JSON lexer's available options; notepad-plus-plus/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp Lines 711 to 715 in 7439597
Footnotes |
Json5 has several more changes than just adding comments. As shown above, the first screenshot is valid Json5. For example, property values can be single quoted, double quoted, or not quoted. Additionally, there are changes to allow different number formats for number values. I don't know enough about javascript to know if Json5 is close to it or not. However, the unquoted property values are highly desirable to use and having them properly highlighted with a different color would be useful. I think the unquoted property value is valid javascript, but the javascript highlighter doesn't seem to highlight it regardless. Json5 spec: https://spec.json5.org/#prod-JSON5Identifier |
The lexer module is maintained by another project: https://github.com/ScintillaOrg/lexilla |
Adding L_JSON5 enum and applying all |
Maybe this could cause compatibility problems when Scintilla finally supports JSON5 ? Don't know ... I've made a (related) request to support Scintilla's built-in "comments" for JSON highlighting. #11713 In this request I suggest that the option is a checkbox in the Settings/Preferences/Languages screen but maybe it's not the best way to go ? If an easier solution is to create a new enum value in the lexer, may I suggest that it's named L_JSONC instead of L_JSON5 ? "JSONC" is not an official subset of JSON but is used by VS Code and it does just what the "allowComments" option in the lexer does: support line and block comments in JS/C style ... https://code.visualstudio.com/docs/languages/json#_json-with-comments |
Currently, it's only JSONC (with js comment supported). It will be enhanced in the future. Fix notepad-plus-plus#11676, fix notepad-plus-plus#11713
I realize this might be a long shot.. but I am a long time user of N++. I don't think this is currently implemented and apologies if there is another issue open... but would it be possible to add Json5 highlighting via the json5 file extension? It seems like there may be a way to hack the highlighting a little by using JavaScript highlighting instead as that seems to be close; however, if I choose JavaScript highlighting, it's not very good..
I really really x1000 do not want to move to another editor for this support. I tried atom and it seemed like it had support, but I want to continue to use N++.
This is what I currently get using JavaScript highlighting.
![image](https://user-images.githubusercontent.com/62843610/168480660-504c1288-ac9a-421d-83b8-46553105daa5.png)
This standard json highlighting is much more palatable.
![image](https://user-images.githubusercontent.com/62843610/168480691-233f1572-8f00-4048-ad26-11a8ded3051f.png)
I may be a long time user of N++ as a software engineer, but I have never gone past the basic UI or twiddled any settings. If there is another way to achieve better highlighting, I am all for it.
The text was updated successfully, but these errors were encountered: