Skip to content

Syntax highlighting is not following any language #46

Closed

Description

@pradeeban

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.

Activity

  1. Aviral09 commented on Oct 31, 2022

    @Aviral09

    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 -

    1. If the user opens an existing file, it'll be highlighted based on the file extension.
    2. 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.

    Please let me know which either 2a or 2b works.

  2. pradeeban commented on Nov 1, 2022

    @pradeeban
    MemberAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions