Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to italicize comments in Visual Studio Code?

I'm using Visual Studio Code version 1.11.2. I need to be able to see italicized comments in any language file, or at least JavaScript, Python, C, and C++. Is there a general setting for that or is there a programmatic way I can achieve that at the moment?

like image 886
Amani Avatar asked Apr 27 '17 12:04

Amani


People also ask

How do you comment or italicize in VS code?

comment", ], "settings": { "fontStyle": "italic", // "fontStyle": "italic underline", // "fontStyle": "italic bold underline", } }, ] }, Related: How do I get Visual Studio Code to display italic fonts in formatted code? This is much easier to do and work in any theme, thanks.

How do I mark a comment in Visual Studio?

Comment Code Block Ctrl+K+C/Ctrl+K+U If you select a block of code and use the key sequence Ctrl+K+C, you'll comment out the section of code. Ctrl+K+U will uncomment the code.


1 Answers

Thanks for pointing me in the right direction Victor. Putting this in my settings file (Visual Studio Code 1.42.1) did the trick:

"editor.tokenColorCustomizations": {   "textMateRules": [     {       "scope": "comment",       "settings": {         "fontStyle": "italic"       }     }   ] } 

You can see selector scopes by pressing ctrl/cmd + shift + p, and looking for Developer: Inspect Editor Tokens and Scopes.

You can apply settings to multiple scopes by providing an array:

"editor.tokenColorCustomizations": {   "textMateRules": [     {       "name": "Comment",       "scope": [         "comment",         "comment.block",         "comment.block.documentation",         "comment.line",         "comment.line.double-slash",         "punctuation.definition.comment",       ],       "settings": {         "fontStyle": "italic",         // "fontStyle": "italic underline",         // "fontStyle": "italic bold underline",       }     },   ] }, 

Related: How do I get Visual Studio Code to display italic fonts in formatted code?

like image 82
Jason Avatar answered Sep 23 '22 03:09

Jason