language-python icon indicating copy to clipboard operation
language-python copied to clipboard

Python highlighting is broken for some triple quote docstrings

Open irmatov opened this issue 7 years ago • 3 comments

Prerequisites

  • [X] Put an X between the brackets on this line if you have done all of the following:
    • Reproduced the problem in Safe Mode: https://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode
    • Followed all applicable steps in the debugging guide: https://flight-manual.atom.io/hacking-atom/sections/debugging/
    • Checked the FAQs on the message board for common solutions: https://discuss.atom.io/c/faq
    • Checked that your issue isn't already filed: https://github.com/issues?utf8=✓&q=is%3Aissue+user%3Aatom
    • Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages

Description

Python highlighting is a bit broken with regard to triple quotes, see below.

Steps to Reproduce

  1. Open a new file with Ctrl+N
  2. Set to Python grammar using a button in bottom right.
  3. Enter following text:

code:

class A:
    @classmethod
    def first(cls, iterable):
        """
        'REPLACE'
        """
        pass

    def other(self):
        pass

Expected behavior:

I expect the text between triple quotes (including them) to be colored as strings. Text that follows second triple quote should be highlighted as code.

Actual behavior:

All text following second triple quote till the end of file will be highlighted as a string. highlight

Reproduces how often:

Everytime.

Versions

Atom : 1.28.1 Electron: 2.0.4 Chrome : 61.0.3163.100 Node : 8.9.3 OS: Ubuntu 18.04

irmatov avatar Jul 10 '18 18:07 irmatov

Having the same issue on Windows 10.

In my case, it only happens after a docstring which has single quotes ' within the docstring. As is the case in the screenshot above.

Edit: Nevermind, it doesn't always happen under those conditions.

Kilo59 avatar Sep 17 '18 17:09 Kilo59

Still is broken on 1.48.0, at least if you use Kite, which requires the tree-sitter parse to be disabled.

yacc143 avatar Jul 01 '20 14:07 yacc143

Seeing this issue still in Atom v1.54.0 on Mac OS 10.15.7 (Catalina).

kenecaswell avatar Feb 19 '21 18:02 kenecaswell