VSCode

vscode configure

Extension

Python

  • Python
    Python extension for Visual Studio Code.
  • Python Indent
    Correct python indentation in Visual Studio Code.
  • Python snippets
    Python snippets collections.
  • Python Docstring Generator
    Visual Studio Code extension to quickly generate docstrings for python functions.

    Remote

  • SFTP
    sftp sync extension for VS Code.
  • Remote - SSH
    The Remote - SSH extension lets you use any remote machine with a SSH server as your development environment.

C++

  • C/C++
    The C/C++ extension adds language support for C/C++ to Visual Studio Code, including features such as IntelliSense and debugging.
  • CodeLLDB
    Debugging on Linux (x64 or ARM), macOS and Windows.
  • C/C++ Clang Command Adapter
    Completion and Diagnostic for C/C++/Objective-C using Clang command.
  • clangd
    Provides C/C++ language IDE features for VS Code using clangd:

    Autocomplete and IntelliSense

  • Visual Studio IntelliCode
  • Kite Autocomplete Plugin for Visual Studio Code

Others

  • Jupyter Extension for Visual Studio Code
  • IntelliJ IDEA Key Bindings
    Port of IntelliJ IDEA key bindings for VS Code. Includes keymaps for popular JetBrains products like IntelliJ Ultimate, WebStorm, PyCharm, PHP Storm, etc.
  • language-stylus
    Adds syntax highlighting and code completion to Stylus files in Visual Studio Code.
  • Markdown PDF
    This extension converts Markdown files to pdf, html, png or jpeg files.
  • Markdown Preview Enhanced
    Markdown Preview Enhanced is an extension that provides you with many useful functionalities such as automatic scroll sync, math typesetting, mermaid, PlantUML, pandoc, PDF export, code chunk, presentation writer, etc.
  • LaTeX Workshop
    LaTeX Workshop is an extension for Visual Studio Code, aiming to provide core features for LaTeX typesetting with Visual Studio Code.

Configure

Python

Configure environment

Select environment for python.
command + p -> >select interpreter
or
command + shift + p -> select interpreter

Debug

  1. Extension
  • Python
  1. configure launch.json and save launch.json.
    {
     // Python debug configurations in Visual Studio Code: https://go.microsoft.com/fwlink/?linkid=830387
     "version": "0.2.0",
     "configurations": [
         {
             "name": "python: debug", // Provides the name for the debug configuration that appears in the VS Code drop-down list.
             "type": "python",
             "request": "launch", // ['launch', 'attach'] 
             //  launch: start the debugger on the file specified in program
             //  attach: attach the debugger to an already running process. 
             "cwd": "${workspaceFolder}", // Specifies the current working directory for the debugger, which is the base folder for any relative paths used in code.
             "program": "${file}", // Provides the fully qualified path to the python program's entry module (startup file). 
             "console": "integratedTerminal", // Specifies how program output is displayed 
             "args": [
                 "--config",
                 "configcenternet3d_2x.yaml"
             ] // Specifies arguments to pass to the Python program.
         }
     ]
    }
    recommand configure for local debugging as following:
    {
     "version": "0.2.0",
     "configurations": [
         {
             "name": "python: debug",
             "type": "python",
             "request": "launch",
             "cwd": "${workspaceFolder}",
             "program": "${workspaceFolder}/relative/path/filename.py ",
             "console": "integratedTerminal",
             "args": [
                 "--config",
                 "configcenternet3d_2x.yaml"
             ]
         }
     ]
    }
  2. command + 5 switch to RUN or f5.

C++

Configure PATH

  1. search include path list.

    gcc -v -E -x c -  
  2. command + shift + p -> c/c++" Edit Configure

  3. type include path list to include path.

Debug

  1. Extension
  • C/C++
  • C/C++ Clang Command Adapter
  • CodeLLDB
  1. configure launch.json and tasks.json. launch.json
    {
     "name": "Launch",
     "type": "lldb",
     "request": "launch",
     "program": "${workspaceFolder}/{fileBasenameNoExtension}", // ${workspaceFolder}/<my program>
     "args": ["-arg1", "-arg2"],
     "preLaunchTask": "Build with Clang"
    }
    tasks.json
    {
     "tasks": [
         {
             "label": "Build with Clang", // same with launch["preLaunchTask"]
             "type": "shell",
             "command": "clang++",
             "args": [
                 "-std=c++17",
                 "-stdlib=libc++",
                 "${fileBasenameNoExtension}.cpp",
                 "-o",
                 "${fileBasenameNoExtension}",
                 "--debug"
             ],
             "group": {
                 "kind": "build",
                 "isDefault": true
             }
         }
     ],
     "version": "2.0.0"
    }
  2. command + 5 switch to RUN or f5.

Remote

Remote - SSH

  • Access remote server to modify, upload and download files.
  • Access remote server to run file(python, cpp etc.).
  1. command + shift + p -> remote-ssh: open configuration file
    select config path.

  2. config

    # Read more about SSH config files: https://linux.die.net/man/5/ssh_config
    Host Name
     HostName ip # Specifies the real host name to log into. For example, 220.181.38.150
     User zhangsan # username Specifies the user to log in as.
     Port 22 # Specifies the port number to connect on the remote host. The default is 22.
  3. select server and file directory to access.

本文标题:VSCode

文章作者:Yinmin Zhang

发布时间:2021年01月10日 - 22:01

最后更新:2023年04月07日 - 16:04

原始链接:https://yinminzhang.github.io/blog/2021/01/11/1/

许可协议: 署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。