Binaryify / OneDark-Pro

Atom's iconic One Dark theme for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=zhuangtongfa.Material-theme
MIT License
1.52k stars 289 forks source link

python render partial italic #257

Closed raytroop closed 6 years ago

raytroop commented 6 years ago

image

as you can see, for in clause is not font consistent that for italic and in is normal. at a word, what i need is normal font everywhere except comment.

Any suggestion? Thanks

extension version: 2.16.5 vscode version: 1.27.2 OS: Ubuntu 16.04.5 LTS / Ubuntu 18.04.1 LTS

chpxu commented 6 years ago

@raytroop This was a change that @Binaryify done for issuw #252.

@Binaryify It's clear people really like italics. Continuing on from #250, from merging ODP and Vivid, perhaps create an italicised version too?

raytroop commented 6 years ago

Thanks @beastdestroyer but I DONT like italics, maybe I belong to the minority I indeed like previous version.

Binaryify commented 6 years ago

@raytroop you can custom theme check the docs https://binaryify.github.io/OneDark-Pro/#/?id=user-definable-syntax-highlighting-colors

raytroop commented 6 years ago

I see, thanks @Binaryify

raytroop commented 6 years ago

work like a charm @Binaryify @beastdestroyer

{
      "name": "Python Keyword Control",
      "scope": "keyword.control.import.python,keyword.control.flow.python",
      "settings": {
        "fontStyle": "normal"
      }
    }
chpxu commented 6 years ago

👍

stevenlis commented 5 years ago

@Binaryify I'm trying to apply the code posted by @raytroop, but I couldn't find the syntax.json in my vs code files folder as mentioned in the doc. Is there any other way to change everything to non-italic?

mskelton commented 5 years ago

@stevencollinscn The link to that section of the docs doesn't seem to work right. If you scroll almost to the bottom of the page you will see a section named User definable syntax highlighting colors which explains how to add the overrides.

mskelton commented 5 years ago

@stevencollinscn Can you post the relevant portion of your settings.json file containing your change?

stevenlis commented 5 years ago

Doesn't seems working. I already have a setting for comment. Am I missing something since I'm not really familiar with json files. image

mskelton commented 5 years ago

@stevencollinscn Ah, I see the problem. Because this theme applies italics to multiple comment related scopes, the scope of comment isn't specific enough. Try adding the code below and see if that works.

"editor.tokenColorCustomizations": {
  "textMateRules": [
    {
      "name": "Comments",
      "scope": [
        "comment",
        "punctuation.definition.comment",
        "comment.line.double-slash",
        "comment.block.documentation"
      ],
      "settings": {
        "fontStyle": ""
      }
    }
  ]
}
stevenlis commented 5 years ago

@markypython Thanks, buddy. I'm sorry if I somehow misrepresented myself. I'm actually trying to disable other italics such as import, for, if, and those keywords (e.g., dtype) in functions. My setting on comment was actually fine, and I didn't see any comment or docstrings are being italicized.

mskelton commented 5 years ago

@stevencollinscn Gotcha. What you can do is find a keyword that you don't want italicized, place your cursor on the keyword, open the command palette, and type Developer: Inspect TM Scopes. This will show you the scopes that are in play for that keyword which you can then check against the syntax.json file in this repo to determine which scopes need to be overridden to get your styles to apply.

stevenlis commented 5 years ago

@markypython I finally found the syntax.js and changed it to the following, image but nothing seems changed. image

mskelton commented 5 years ago

@stevencollinscn You don't change the syntax.json file. You need to change the settings in your settings.json file using the information from syntax.json.

From your screenshot the code would be as follows:

"editor.tokenColorCustomizations": {
  "textMateRules": [
    {
      "name": "Python Keyword Control",
      "scope": [
        "keyword.control.import.python"
        "keyword.control.flow.python"
      ],
      "settings": {
        "fontStyle": ""
      }
    }
  ]
}
Binaryify commented 5 years ago

@stevencollinscn syntax.js is the file before compilation, you need run npm run build or change /themes/OneDark-Pro.json or just change settings.json like @markypython show

stevenlis commented 5 years ago

@markypython thanks, man. it is finally working!

@Binaryify should've read your docs; the folder is somehow named "marital theme" or something, which really confused me.

mskelton commented 5 years ago

@stevencollinscn Just merge the scopes like this.

"editor.tokenColorCustomizations": {
  "textMateRules": [
    {
      "name": "Non italic",
      "scope": [
        "comment",
        "punctuation.definition.comment",
        "comment.line.double-slash",
        "comment.block.documentation",
        "keyword.control.import.python",
        "keyword.control.flow.python"
      ],
      "settings": {
        "fontStyle": ""
      }
    }
  ]
}

As a note, the name of the rule doesn't have any affect on how VS code formats, so you can put anything in there. Splitting into multiple rules isn't necessary.

Binaryify commented 5 years ago

@stevencollinscn yes, that's a historical reason and I can't change it because it will lose downloads

stevenlis commented 5 years ago

@markypython Thanks a lot man...This definitely more "pythonic" to read. Lol...

@Binaryify I see.. That makes sense. I really enjoy this theme as missing Atom and thanks for your work. Btw, I also apply One Dark Bold, it doesn't seem changed anything. Is it design for some other language than Python?

I'm actually curious why many themes now are adapting italics. Is there any design or technical reason? Easy to read? More productive?