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

Using a variable as a default in a function definition causes inconsistent highlighting

Open TheElementalOfDestruction opened this issue 6 years ago • 7 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: http://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode
    • Followed all applicable steps in the debugging guide: http://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

Using a variable as a default in a function definition causes inconsistent highlighting of variable name. Specifically, the first letter or the variable will not be highlighted.

Steps to Reproduce

  1. Open new file
  2. Set language to Python
  3. Enter def test(test_var = variable):

Expected behavior: variable should be highlighted completely.

Actual behavior: ariable is highlighted while v is not.

Reproduces how often: 100%

Versions

Windows 10 C:\WINDOWS\system32>atom --version

Atom : 1.31.1 Electron: 2.0.7 Chrome : 61.0.3163.100 Node : 8.9.3

C:\WINDOWS\system32>apm --version apm 2.1.1 npm 6.2.0 node 8.9.3 x64 atom 1.31.1 python 3.6.4 git 2.17.0 visual studio

Additional Information

None

Package: language-python 0.51.4

Still exists in 0.51.6

Here is a screenshot showing the problem along with the associated styles and stuff that create the problem:

image

Hopefully I can get someone to look at this soon

Sorry for the delay @TheElementalOfCreation - we're transitioning over to supporting the Tree-sitter grammars only for built-in languages, does this still reproduce with Tree-sitter enabled?

rsese avatar Dec 19 '18 02:12 rsese

Tree sitter seems to fix it, but at the same time it breaks a lot of other stuff. The "other stuff" was already discussed in another issue though.

https://github.com/atom/language-python/issues/281 is the issue I was referring to