Visual Studio Code: Difference between revisions
Appearance
	
	
NickPGSmith (talk | contribs)  | 
				NickPGSmith (talk | contribs)  | 
				||
| Line 109: | Line 109: | ||
*  Files: Trim Trailing Whitespace: true  | *  Files: Trim Trailing Whitespace: true  | ||
Vertical Rulers can be set in settings.json:  | |||
 "editor.rulers": [  | |||
         [80, 120]  | |||
     ]  | |||
=== File ===  | === File ===  | ||
Revision as of 10:40, 11 January 2024
Installation
- Download
 - Fedora Requires "gtk2" package
 
Keyboard Shortcuts
Show shortcuts:
- CTRL + K CTRL + S
 
Open command pallette:
- SHIFT + CTRL + P
 
Toggle sidebar:
- CTRL + B
 
Zoom in/out
- CTRL + SHIFT +
 - CTRL + SHIFT -
 
Top/Bottom of file:
- CTRL + Home
 - CTRL + End
 
Save all:
- CTRL + K S
 
Preview MD at side
- CTRL + K V
 
Rename variable everywhere:
- F2
 
Move line up/down:
- ALT + UPArrow
 - ALT + DownArrow
 
Duplicate line:
- SHIFT + Alt + Up or Dwn
 
Delete line
- SHIFT + CTRL + K
 
Peek editor
- SHIFT + F12
 
Comment/uncomment a line:
- CTRL + /
 
Highlight current line:
- CTRL + L
 
Copy a line:
- ALT + SHIFT + UpArrow
 
Block indent / Outdent:
- CTRL + ]
 - CTRL + [
 
Block comment / uncomment:
- CTRL + K C
 - CTRL + K U
 
Run code:
- CTRL + F5
 
Open MD preview:
- SHIFT + CTRL + v
 
Summary sheet here.
Extensions
PlatformIO IDE
- platformio.platformio-ide
 
Python
Python (Microsoft) provides IntelliSense, and installs:
- Jupyter
 - Pylance
 
See settings:
- python.analysis.typeCheckingMode: off/basic/strict
 - python.formatting.provider: autopep8
 
Reorder imports, add to settings.json:
"editor.codeActionsOnSave": {
     "source.organizeImports": true
    }
Or, "sortImports" to not remove unused imports.
- pylint
 
- Python: Enable Linting
 - Python: Select Linter
 - pylance language server (includes pyright functionality)
- Python > Analysis: Type Checking Mode: basic
 
 
Settings
UI
File > Preferences > Settings > [User, Workspace, as required]
- Files: Trim Trailing Whitespace: true
 
Vertical Rulers can be set in settings.json:
"editor.rulers": [
        [80, 120]
    ]
File
- [Workspace] > .vscode > settings.json
 - ~/.vscode/extensions/[extension]/pythonFiles/.vscode/settings.json
 
"python.linting.enabled": true, "python.linting.pylintArgs": ["--enable=F,E,W"]
Syntax Highlighter
- Install Node.js
 - npm install -g yo generator-code
 
yo code
- New Language Support
 - Complete questions
 - Copy new directory to $HOME/.vscode/extensions
- package.json : Language description
 - syntaxes/tpl.tmLanguage.json : main language matching (see language grammars)
 - language-configuration.json : Defines the tokens that are used for comments and brackets (see docs)
 
 
To inspect:
- Command Palette: Developer: Inspect Editor Tokens and Scopes
 
To package:
npm install -g vsce cd myExtension vsce package
To publish:
vsce publish