How can I capture single keystrokes in a unix console app without blocking?
Add stdin to your list of select handles, and if it has data, call read to read one character from it.
Writing a syntax highlighter
Syntax highlighters can work in two very general ways. The first implements a full lexer and parser for the language(s) being highlighted, exactly identifying each token's type (keyword, class name, instance name, variable type, preprocessor directive...). This provides all the information needed to exactly highlight the code according to some specification (keywords in red, class names in blue, what have you).
The second way is something like the one Google Code Prettify employs, where instead of implementing one lexer/parser per language, a couple of very general parsers are used that can do a decent job on most syntaxes. This highlighter, for example, will be able to parse and highlight reasonably well any C-like language, because its lexer/parser can identify the general components of those kinds of languages.
This also has the advantage that, as a result, you don't need to explicitely specify the language, as the engine will determine by itself which of its generic parsers can do the best job. The downside of course is that highlighting is less perfect than when a language-specific parser is used.
Syntax highlighting in Vscode for type hints
To close this topic and for future reference, this is how I solved my issue: I ended up using semantic highlighting for type hints as rioV8 suggested.
This is done by adding the following to my Vscode settings JSON file:
"editor.semanticTokenColorCustomizations": {
"rules": {
"*.typeHint": {
"foreground": "#bbbbbb",
"fontStyle": "italic"
},
"class.typeHint.builtin": {
"foreground": "#bbbbbb",
"fontStyle": "italic"
}
}
}
Java Syntax Highlighting Issue for IntelliJ Ultimate
You can customize the syntax coloring of an existing Scheme within Intellij IDEA:
- Press ctrl-alt-S to open the Settings screen, then select the scheme you want to modify from the Scheme drop list. I chose Classic Light.
- Navigate to Editor > Color Scheme > Language Defaults, or Editor > Color Scheme > Java if you want to restrict your customization to Java source only.
- Select the language feature for which you want to modify the color(s) under the main categories (i.e. Classes, Comments, Identifiers, etc.). For example, to modify the color for curly braces select Braces and Operators, then Parentheses.
- If the Inherit values from checkbox is displayed and checked, uncheck it to enable customization. Then check the foreground checkbox, click the color field to its right and select a color of your choice, then click Apply, OK to implement your change.
See below for the syntax coloring of some Java source, before and after color customization, showing changes such as dark pink italicized string literals, light blue curly braces, purple round brackets, orange class names, gold Java keywords and light green comments.
Default coloring:
Syntax coloring after modification:
Notes:
The ugly changes I made were just for demonstrating the approach, but the required changes shown in the question's screen shot should be straightforward to achieve.
Selecting italicization for string literals had an unintended side effect. The display of the character 'ᚙ' was changed because there was no italic equivalent to render.
If you mess things up completely, you can easily revert to the defaults. Click the settings cog wheel next to your Scheme name and select Restore Defaults from the popup menu:
A disappointing limitation with this approach is that all Java keywords must be the same color. That's why import and package and public and throws and char and new all have the same color in the Java source screen shot above.
You can export your customization if you want to preserve or share it. Select Export from the context menu shown when you click the settings cog wheel. There is also an Import Scheme option.
See Colors and Fonts in the Intellij IDEA documentation for more information.
VS Code syntax highlighting Python f-strings
Can it output the correct result? In other words, f-string can work?
Have you tried to switch the color theme?
And can you open the Command Palette
to execute the command of Developer: Inspect Editor Tokens and Scopes
to get this:
Can you find the meta.fstring.python
like the above picture?
This could be provided by the Built-in
extension of Python Language Basic
or MagicPython
extension and so on. So could you disable all the python related extensions then only enable the Python and Built-in
extension of Python Language Basic
to make a try?
Dart syntax highlighting is not highlighting dart code
As mentioned in the comments, you don't need the "Syntax highlighting only" extension if you have the Dart one, since the Dart one includes the same syntax highlighting.
Based on your screenshot, it seems like syntax highlighting is working fine - I can see multiple colours. I think the issue is likely the VS Code theme you're using. Dark (Visual Studio) only shows limited colours - try changing it to Dark+ and you should see more colours.
Dark
Dark+
To Change This Settings;
Setting Icon > Color Theme > Select Dark+ Configuration;
Related Topics
Cross-Platform Means of Getting User's Home Directory in Ruby
Is the Unix Philosophy Falling Out of Favor in the Ruby Community
Does Begin . . . End While Denote a 'Block'
How to Elegantly Symbolize_Keys for a 'Nested' Hash
How to Embed Dynamic Ruby Code to "Javascript" Section in Slim Templates
How to Read a File's Modification Date with Ruby
Rails Return JSON Serialized Attribute With_Indifferent_Access
How to Disable a Form Submit Button "A Là Ruby on Rails Way"
Best Way to Handle Data Attributes in Slim
Ruby on Rails - Is Params a Method or a Hash
Start Using Ruby on Rails, Web Services and Oauth
Ruby on Rails Webpacker Can't Find Images Under Asset_Pack_Path