Rodomi pranešimai su žymėmis debug. Rodyti visus pranešimus
Rodomi pranešimai su žymėmis debug. Rodyti visus pranešimus

2023 m. liepos 19 d., trečiadienis

Visual studio code launch.json and settings.json

 v2 added parameters

 launch.json


{

    "version": "0.2.2",
    "configurations": [
        {
            "name": "Python Debugger: Current File",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal"
        },
        {
            "name": "🚀:8017 Python: Debug Odoo17 ",
            "type": "debugpy",
            "request": "launch",
            "stopOnEntry": false,
            "python": "${config:odoo.python}",
            "console": "integratedTerminal",      
            "program": "${config:odoo-bin}",
            "justMyCode": true, // Skip external code in stack traces.
            "args": [
                // "--log-handler=odoo:DEBUG",
                "--config=${config:odoo.debugConfig}",
                "--database=${config:odoo.prodDatabase}",
                "--update=sale_manual_delivery",
                // | Overide Translations |
                // "--update=elics_translations",
                // "--i18n-overwrite",
                "--dev=xml",
             
            ],
            "cwd": "${workspaceRoot}",
            "env": {},
        },
        {
            "name": "🚀📟 Python: Debug Console ",
            "type": "debugpy",
            "request": "launch",
            "stopOnEntry": false,
            "python": "${config:odoo.python}",
            "console": "integratedTerminal",      
            "program": "${config:odoo-bin}",
            "justMyCode": true, // Skip external code in stack traces.
            "args": [
                "shell",
                "--config=${config:odoo.debugConfig}",
                "--database=${config:odoo.prodDatabase}",
            ],
            "cwd": "${workspaceRoot}",
            "env": {},
        },
        {
            "name": "📦:8018 Odoo17 Python: Default Setup",
            "type": "debugpy",
            "request": "launch",
            "python": "${config:odoo.python}",
            "console": "integratedTerminal",      
            "program": "${config:odoo-bin}",
            "args": [
                "--config=${config:odoo.testdebugConfig}",
                "--database=${config:odoo.testDatabase}",
            ],
            "cwd": "${workspaceRoot}",
            "env": {},
        },
                {
            "name": "📦📟:8018 Odoo17 Python: Debug Console",
            "type": "debugpy",
            "request": "launch",
            "python": "${config:odoo.python}",
            "console": "integratedTerminal",      
            "program": "${config:odoo-bin}",
            "args": [
                "shell",
              "--config=${config:odoo.testdebugConfig}",
              "--database=${config:odoo.testDatabase}",
            ],
            "cwd": "${workspaceRoot}",
            "env": {},
        },
                {
            "name": "Python: Debug Odoo17 Custom Tests",
            "type": "debugpy",
            "request": "launch",
            "stopOnEntry": false,
            "python": "${config:odoo.python}",
            "console": "integratedTerminal",      
            "program": "${config:odoo-bin}",
            "args": [
                "--config=${config:odoo.debugConfig}",
                "--database=${config:odoo.prodDatabase}",
                "--test-enable",
                "--stop-after-init",
                "--test-tags=custom_translate"
            ],
            "cwd": "${workspaceRoot}",
            "env": {},
        },

    ]
}

// args - Command line arguments
// "args": ["--debug", "--config", "config.json"]

// cwd - Working directory
// "cwd": "${workspaceFolder}/src"

// envFile - Load environment from .env file
// "envFile": "${workspaceFolder}/.env"

// justMyCode - Only debug your code, skip libraries (default: true)
// "justMyCode": false  // Debug into libraries too

 

 v1

settings.json

{
    "workbench.editor.customLabels.enabled": true,
    "terminal.integrated.middleClickBehavior": "paste",
    "workbench.editor.limit.enabled": false,
    "python.languageServer": "None",
    "files.autoSave": "afterDelay",
    "debug.allowBreakpointsEverywhere": false,
    "files.exclude": {
        "**/*.pyc": true
    },
    "odoo.prodDatabase": "elics-odoo",
    "odoo.debugConfig": "/opt/odooonf",
    "odoo.testDatabase": "odoo-default-setup",
    "odoo.testdebugConfig": "/opt/odoo.conf"

}

 

 

launch.json

{
    "workbench.editor.customLabels.enabled": true,
    "terminal.integrated.middleClickBehavior": "paste",
    "workbench.editor.limit.enabled": false,
    "python.languageServer": "None",
    "files.autoSave": "afterDelay",
    "debug.allowBreakpointsEverywhere": false,
    "files.exclude": {
        "**/*.pyc": true
    },
    "odoo.prodDatabase": "odoo",
    "odoo.debugConfig": "//conf/odoo.conf",
    "odoo.testDatabase": "odoo",
    "odoo.testdebugConfig": "/opt/odoo/odoo17/conf/odoo.conf",
    "odoo.python": "${workspaceFolder}/venv/bin/python3",
    "odoo-bin": "${workspaceFolder}/odoo/odoo-bin"

}
 


For custom files:

        {
            "name": "Python: Current File (env)",
            "python": "/home/sup/ven/bin/python",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "justMyCode": false,
            "env": {
                "ENV_VAR": "dev",
            }
        }

 

settings.json

We can define global variables

{
    "python.defaultInterpreterPath": "venv/bin/",
    "python.terminal.activateEnvInCurrentTerminal": true,
    "terminal.integrated.env.linux": {
        "CUSTOM_ENV_VAR": "/here/goes/ENV/value"
    }
}