Visual Studio Code

From Sinfronteras
Revision as of 16:25, 27 March 2024 by Adelo Vieira (talk | contribs) (Settings)
Jump to: navigation, search

https://code.visualstudio.com

https://en.wikipedia.org/wiki/Visual_Studio_Code

Visual Studio Code (VS Code) is a source code editor developed by Microsoft for Windows, Linux and macOS. It includes support for debugging, embedded Git control, syntax highlighting, intelligent code completion, snippets, and code refactoring.



Installation

Can be installed using «Snap» command or by downloading the <file>.deb. Se the official documentation at https://code.visualstudio.com/docs/setup/linux



Shortcuts



Settings

  • Commants menu > Open user settings (JSON)
 
{
    // Esto es para disable code folding created by jupyter "#%%" cells 
    "jupyter.interactiveWindow.textEditor.cellFolding": false,
    // ChatGPT
    "chatgpt.apiKey": "sk-SjsZYydEphXeL.................",
    // ...
    "window.zoomLevel": 1,
    "workbench.list.openMode": "doubleClick",
    // "GTK_PATH" enviroment varible set by defaul está causando problemas con: « gnome-terminal  --geometry=260x25-0+0  --tab -e "bash -c 'ssh -o StrictHostKeyChecking=no ubuntu@62.171.143.243 ; bash'"». La estamos por tanto reajustando a "":
    "terminal.integrated.env.linux": {
        "GTK_PATH": ""
    }
}



Workspace settings

Tenemos que crear este archivo en el directorio actual (workspace):

workspace/.vscode/settings.json
 
{
    "explorer.sortOrder": "filesFirst",
    "files.exclude": {
        "**/.*": false,
        "**/__pycache__": true,
        "**/__init__.py": true,
        "**/*.pyc": true,
        "**/.git": true,
        ".idea": true,
        ".vscode": true
    },
    // "python.linting.enabled": true,

    // Esto soluciona el «unresolved import» problem.
    // De hecho si el workspace is at the root level of the project, no necesitamos esta configuración
    // See https://stackoverflow.com/questions/53939751/pylint-unresolved-import-error-in-visual-studio-code
    //     https://github.com/microsoft/python-language-server/blob/master/TROUBLESHOOTING.md#unresolved-import-warnings
    // "python.autoComplete.extraPaths": [
    //     "./StockMarketSimulator-Python1"
    // ],
    // "python.analysis.extraPaths": [
    //     "./StockMarketSimulator-Python1"
    // ],
}



Extension

Simple Hide Files: Muy buena para ocultar files/folders en la sidebar. Probé varias y la única que funcionó bien fue ésta:



Custom icons

There is an extension in VS Code that displays custom icons for different types of files. For example, for a JavaScript file with the ".js" extension it displays the JavaScript logo while for a TypeScript file with the ".ts" extension it displays the TypeScript logo. This can be useful because it helps your brain to visually identify each of the files in the project explorer.


You can install the extension by clicking on the Extensions icon. You can then search for vscode-icons and install it.

After installing it you will need to restart VS Code and click on File → Preferences → File Icon Theme. Then select VSCode Icons.



Better Comments

https://marketplace.visualstudio.com/items?itemName=aaron-bond.better-comments



Java Code Generators

https://marketplace.visualstudio.com/items?itemName=sohibe.java-generate-setters-getters



Highlight words

https://marketplace.visualstudio.com/items?itemName=rsbondi.highlight-words



Databases

https://marketplace.visualstudio.com/items?itemName=vs-publisher-988541.apexsql-power-tools&ssr=false#overview


https://marketplace.visualstudio.com/items?itemName=mtxr.sqltools-driver-mysql