You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Syntax highlighting is not following any language #46
It is highlighting the same text in the same manner, regardless of the language.
For example, write code in any language and save it as .py .m and .txt. All will have the same syntax highlighting, not really specific to any language. For example, it even highlights Python code (that are not part of Matlab) while editing an .m file.
Currently, the syntax highlighting feature has been implemented using prismjs. Generally, it uses keyword-based approach to highlight when no language is specified. I kept the language unspecified as we allow users to create new files.
My proposed solution for this issue is as follows -
If the user opens an existing file, it'll be highlighted based on the file extension.
If the user creates a new file, we can have two different approaches -
2a. Keep the current general keyword-based highlighting. When the user saves and reopens it, it'll show correct highlighting.
2b. Put a dropdown to select a language in the create a new file modal.
Activity
Aviral09 commentedon Oct 31, 2022
Currently, the syntax highlighting feature has been implemented using prismjs. Generally, it uses keyword-based approach to highlight when no language is specified. I kept the language unspecified as we allow users to create new files.
My proposed solution for this issue is as follows -
2a. Keep the current general keyword-based highlighting. When the user saves and reopens it, it'll show correct highlighting.
2b. Put a dropdown to select a language in the create a new file modal.
Please let me know which either 2a or 2b works.
pradeeban commentedon Nov 1, 2022
2a is better. It is less coding for you and less confusing for the user.
Once the user saves the file, with your approach (step 1), it will show the correct syntax highlighting, which is sufficient.