VS Code syntax highlighting for SQL commands in Python - visual-studio-code

The first syntax highlighting is of VS Code and the second one is of Sublime Text. I searched for extensions but I couldn't find anything which could detect SQL commands like CREATE TABLE and highlight them or suggest them as I start typing.
Sublime Text and Atom have this feature by default, but I can't get it to work in VS Code.
I am working with .py files so the syntax highlighting works only for Python commands and the whole text (inside quotes) is treated as string in VS Code.
Is there any fix to get syntax highlighting like Sublime Text / Atom in VS Code when working with SQL syntax in .py files or highlighting commands even if it's inside quotes ("")?

It seems the VS Code doesn't support this feature officially.
Hence, I make an extension called Highlight String Code which can highlight SQL expressions in Python or any other language.
You can easily use it by uppercasing the first keyword of the SQL command and adding a semicolon at the end:
I hope the extension can be helpful.

Related

How do I set up text replacement shortcuts in VS Code?

I want to set up automatic text replacement shortcuts in Visual Studio Code similar to snippets in SQL Complete or text replacements on iOS. So for example: if I type ssf I want VS Code to replace it with SELECT * FROM. (Or alternatively, offer it as an autocomplete suggestion).
How can I set up automatic text replacement rules in VS Code?
you can use extensions such as the "JavaScript (ES6) code snippets"

VSCode Rust add semicolon on save

I am using the Rust extension on vscode and NOT rust-analyzer. However, when I am saving a file, vscode is using rustfmt to format my file but it doesn't automatically insert semicolons. I have a trivial function like this
fn call_me() {
let x = 5
println!(x)
}
It doesn't add the necessary semicolons. How do I make it add semicolons? Are my installations somehow messed up?
Also, I have tried rust-analyzer and it doesn't add semicolons either.
Unlike JavaScript, semicolons are not syntactically optional in Rust. Thus, leaving them out is a syntax error, not just a matter of style, and rustfmt (the standard Rust code formatting tool) doesn't ever attempt to fix any syntax errors, no matter how “obvious” they might be — if it reads a file with errors it will not make any formatting changes.
(I don't know if there's a way to get rust-analyzer, vim, or VS Code to auto-insert semicolons as a matter of editing rather than formatting.)
Maybe not what you're looking for but there are language-agnostic options to reduce the friction of semicolon insertion.
For instance the vs code extension colonize adds the shortcut alt+enter which appends a semicolon and newline, no matter where in the line the cursor is.

What languages can doxygen highlight in fenced code blocks

What are the languages that Doxygen recognizes and highlights in a #code/#endcode block or a fenced code block in markdown? I have been playing around and got these to work:
{cpp}, {py}, {xml}
I would like to also highlight cmake and bash snippets. Is that possible, what are the corresponding extensions I would have to wrap with braces? For the record, I"m using doxygen 1.18.13

Prevent Intellisense from inserting semicolons in VS Code

We don't use semicolons in TypeScript. Each time Intellisense in VS code (v1.18.1) inserts a line, it terminates it with ;. Example would be an import statement.
Is it possible to configure VS Code not to append semicolons? Very inefficient right now to have to delete them manually.
TSLint semicolon rule (has autofix)
TSLint extension for vscode
tslint.json rules section:
"semicolon": [true, "never"]
settings.json Ctrl+,
"tslint.autoFixOnSave": ["semicolon"]
There is an open issue about it https://github.com/Microsoft/TypeScript/issues/19882
If you're using Prettier add to settings.json
"prettier.semi": false
And then in tslint.json
"semicolon": [true, "never"],
TypeScript 3.6 is now able to detect whether your file uses semicolons or not, which can be leveraged in VS Code for quick fixes, refactorings, transformations (e.g. auto import) and other features. It is called Semicolon-Aware Code Edits.
Editors like Visual Studio and Visual Studio Code can automatically apply quick fixes, refactorings, and other transformations like automatically importing values from other modules. These transformations are powered by TypeScript, and older versions of TypeScript unconditionally added semicolons to the end of every statement; unfortunately, this disagreed with many users’ style guidelines, and many users were displeased with the editor inserting semicolons.
TypeScript is now smart enough to detect whether your file uses semicolons when applying these sorts of edits. If your file generally lacks semicolons, TypeScript won’t add one.

How do I stop Notepad++ from showing autocomplete for all words in the file

I'm trying to use Notepad++ with the Progress programming language.
I have installed the language definition in %APPDATA%\Roaming\Notepad++ as userDefineLang.xml and syntax highlighting is working correctly.
I've put a file in the notepad++ Plugins\APIs directory named progress.xml, but the contents are not recognized by Notepad++.
I've also removed all the other language files from that directory and Notepad++ still shows the exact same autocomplete suggestions it did before I removed them.
Also, when typing in a program, it looks like every word in the file is an auto-complete suggestion, not just the keywords or function names.
Anyone know how to track this down?
Notepad++ provides 2 types of features:
Auto-completion that read the open file and provide suggestion of words and/or functions within the file
Suggestion with the arguments of functions (specific to the language)
Based on what you write, it seems what you want is auto-completion on function only + suggestion on arguments.
To do that, you just need to change a setting.
Go to Settings > Preferences... > Auto-completion
Check Enable Auto-completion on each input
Select Function completion and not Word completion
Check Function parameter hint on input (if you have this option)
On version 6.5.5 of Notepad++, I have this setting
Some documentation about auto-completion is available in Notepad++ Wiki.
The answer is to DISABLE "Enable auto-completion on each input". Tested and works perfectly.