Search code examples
pythonpython-3.xsublimetext3sublimerepl

How to get rid of Sublime Text's mistaken error highlighting when using SublimeREPL?


When using the ' character as an apostrophe, building python code using SublimeREPL causes sublime text to mistake that apostrophe for a single quote and create annoying red highlights.

For example, this code:

    hnumber = int(input("How many players are there? "))
           h_inc = 0
    while h_inc < hnumber:
        print(f"\n Player {h_inc + 1}'s hand:")
        print(deck1.draw())
        h_inc += 1

Produces this unpleasant result: enter image description here

I want to get rid of these red bars. How do I do that without disabling the syntax highlighting function completely? Or is my best course of action to create a toggle hotkey for the red bars?


Solution

  • I found this answer by Aqueum in this thread

    Go to Sublime Text > Preferences > Package Settings > SublimeREPL > Settings - User

    (If your 'Settings - User' is empty, first copy in the contents of 'Settings - Default')

    under "repl_view_settings": add:

    ,
        "syntax": "Packages/Text/Plain text.tmLanguage"
    

    so mine is now:

    // standard sublime view settings that will be overwritten on each repl view
    // this has to be customized as a whole dictionary
    "repl_view_settings": {
        "translate_tabs_to_spaces": false,
        "auto_indent": false,
        "smart_indent": false,
        "spell_check": false,
        "indent_subsequent_lines": false,
        "detect_indentation": false,
        "auto_complete": true,
        "line_numbers": false,
        "gutter": false,
        "syntax": "Packages/Text/Plain text.tmLanguage"
    },