I need to check the grammar of various docstrings, is there a way to do that directly in Visual Studio Code (or any other editor) without copying and pasting each docstring in a grammar checker like Grammarly?
At the bottom of the extension settings for Grammarly, under Grammarly>Files: Include you could add python files to be checked, by adding:
**/*.py
Note, this would include the whole python file and not just the docstrings.
Related
I cannot locate the settings or other configurations that define the colors and other formatting shown in VS Code's Terminal output. I'd like to mimic or use these settings elsewhere, such as in word processing software, HTML/CSS, or simply a Language Mode when copying & pasting the output into a new VS Code file.
Where is this formatting defined? Also, how can I keep this formatting intact when using the text elsewhere?
The built-in markdown editor has a "live-preview" for code blocks without open a side previewer.
I was looking for a list of supported language highlight, which as I understand is defined by highlight.js supported language.
I need to add some "ssh config files" in my markdown, but
when I use properties language tag, only side previewer shows the highlight, not the editor itself
when I try with a weird "s" language alias, the editor can detect the comments and non-alphabetic characters. But the side previewer shows nothing...
VSCode screenshot:
My questions:
"s" is not defined as an alias in highlight.js, then how come the editor can detect the language?
Why the editor and previewer do not have the same highlight behavior?
I prefer to have the correct highlight in editor, which language/alias should I use in place of "properties"?
Summarizing previous comments and answers here:
VScode markdown "in-editor" code highlight use "markdown-basic" extension, with a list of supported languages in this file
The "alias" for different languages are "hidden" in the regex of each block definition. for example for R language the alias is R|r|s|S|Rprofile|\\{\\.r.+?\\}. (I extract a complete list of aliases from the source codes and it is shown below)
More specifically for what I want, i.e. key-value pair config file equivalent to properties in highlight.js, there is no exact the same in "markdown-basic", so I will use conf.
Developer: Inspect Editor Tokens and Scopes helps a lot when you see a unfamiliar alias and want to know what it is
List of code block languages aliases for "markdown-basic":
bat|batch
bibtex
c|h
clj|cljs|clojure
coffee|Cakefile|coffee.erb
COMMIT_EDITMSG|MERGE_MSG
cpp|c\\+\\+|cxx
cs|csharp|c#
css|css.erb
dart
dockerfile|Dockerfile
elixir
erlang
fs|fsharp|f#
git-rebase-todo
go|golang
groovy|gvy
handlebars|hbs
html|htm|shtml|xhtml|inc|tmpl|tpl
ini|conf
jade|pug
java|bsh
js|jsx|javascript|es6|mjs|cjs|\\{\\.js.+?\\}
json|json5|sublime-settings|sublime-menu|sublime-keymap|sublime-mousemap|sublime-theme|sublime-build|sublime-project|sublime-completions
jsonc
latex|tex
less
log
lua
Makefile|makefile|GNUmakefile|OCamlMakefile
markdown|md
objectivec|objective-c|mm|objc|obj-c|m|h
patch|diff|rej
perl|pl|pm|pod|t|PL|psgi|vcl
perl6|p6|pl6|pm6|nqp
php|php3|php4|php5|phpt|phtml|aw|ctp
powershell|ps1|psm1|psd1
python|py|py3|rpy|pyw|cpy|SConstruct|Sconstruct|sconstruct|SConscript|gyp|gypi|\\{\\.python.+?\\}
R|r|s|S|Rprofile|\\{\\.r.+?\\}
re
regexp
ruby|rb|rbx|rjs|Rakefile|rake|cgi|fcgi|gemspec|irbrc|Capfile|ru|prawn|Cheffile|Gemfile|Guardfile|Hobofile|Vagrantfile|Appraisals|Rantfile|Berksfile|Berksfile.lock|Thorfile|Puppetfile
rust|rs|\\{\\.rust.+?\\}
scala|sbt
scss
shell|sh|bash|zsh|bashrc|bash_profile|bash_login|profile|bash_logout|.textmate_init|\\{\\.bash.+?\\}
sql|ddl|dml
swift
tsx
typescript|ts
vb
xml|xsd|tld|jsp|pt|cpt|dtml|rss|opml
xsl|xslt
yaml|yml
I don't believe VSCode's native syntax highlighting has anything to do with highlight.js. It is provided by language-specific extensions, some of which ship with the editor.
In this case, VSCode is using its built-in R mode for that code block. You can see the language being used via Developer: Inspect Editor Tokens and Scopes in the command palette. R is an open-source implementation of the language S, so this makes sense.
The Markdown preview, on the other hand, may well use highlight.js and you are right that s is meaningless there.
I don't see a good language code to use in your code fence, but will update this answer if I find one.
Now my default file type of Visual Studio Code is Plain Text.
If I save a new file with name like a.in, it will save as a.in.txt. I have to change the dropdown to All Files.
I find the same problems in github: 1, 2. However, they seem not solve my problem.
This is not possible in the general case in VSCode.
The issue is that you cannot assign "no extension" to a language, and as per the links you mentioned, the All Files (*.*) option is disabled by upstream (electron).
Therefore, you will either have to remove the extension manually, OR you can create the file first (using the terminal, Explorer, an extension, etc.) and then open that existing file.
There is a way to change the default extension (but not to All Files)
Add the following line to your settings.json
"files.defaultLanguage": "<language>",
Replace <language> with the language of your choice.
Now, whenever you make a new a file, the default file language will be <language>.
A special value for <language> is ${activeEditorLanguage} which is the language of the file last opened (useful if, say, you copy a piece of code from one file to save as another).
Unfortunately, this does not fully answer the question, but provides a partial solution.
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.
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.