atom / language-python

Python package for Atom
Other
190 stars 146 forks source link

no distinguishement for f-strings #291

Closed dreamalligator closed 5 years ago

dreamalligator commented 5 years ago

https://www.python.org/dev/peps/pep-0498/#how-to-denote-f-strings

image

no syntax highlighting for f-strings.

thx!

nicktimko commented 5 years ago

@nebulousdog can you show what a r(aw)-string appears as for you as well? I think the issue might be your theme, as I get something like the below.

image

Running the valid ones it turns into: ['plain', 'f-string = 108', 'raw\\string', 'compat unicode']

What should it look like?


I'm on VScode:

Version: 1.32.3 Commit: a3db5be9b5c6ba46bb7555ec5d60178ecc2eaae4 Date: 2019-03-14T23:38:49.842Z Electron: 3.1.6 Chrome: 66.0.3359.181 Node.js: 10.2.0 V8: 6.6.346.32 OS: Linux x64 4.15.0-46-generic (Ubuntu 18.04)

With Python extension:

Name: Python Id: ms-python.python Description: Linting, Debugging (multi-threaded, remote), Intellisense, code formatting, refactoring, unit tests, snippets, and more. Version: 2019.2.5558 Publisher: Microsoft VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-python.python

dreamalligator commented 5 years ago

Hi! sorry for the late reply.

Here are some various screenshots in Atom of the included themes, and my apm output.

apm --version
apm  2.1.3
npm  6.2.0
node 8.9.3 x64
atom 1.36.0-beta1
python 2.7.15+
git 2.19.1

Atom Dark

image

Base16 Tomorrow Dark

image

One Dark

image

Solarized Dark

image

dreamalligator commented 5 years ago

here are the class names found via the inspector:

image

<div class="line cursor-line" data-screen-row="29">
  <span class="">
    <span class="syntax--source syntax--python">
      <span class="leading-whitespace indent-guide">    </span><span class="syntax--string syntax--quoted">f"another test<span class="syntax--meta syntax--embedded"><span class="syntax--punctuation syntax--section syntax--embedded">{</span>bbq<span class="syntax--punctuation syntax--section syntax--embedded">}</span></span>"</span>,
    </span>
  </span>
</div>
dreamalligator commented 5 years ago

oh! This may be tree-sitter related? I remembered I had turned off the tree-sitter options due to the conversation in this atom/language-javascript issue https://github.com/atom/language-javascript/issues/600#issuecomment-436448053. I swapped the option to "use" tree sitter parsers, closed atom, and re-opened and got this different highlighting from the same Syntax Theme as in my original post. I'm going to close this issue, because I believe the default option in Atom is to have this turned on. Thanks.

f-string