Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Change Log

### 2020-xx-xx - 5.3.6
### 2020-xx-xx - 5.4.0
Autorest core version: 3.0.6318

Modelerfour version: 4.15.421

**New Features**

- Add support for `--python.debugger`. With this flag, you can start debugging using VS Code. Make sure to still set up your [debugging configuration](https://github.com/Azure/autorest.python/wiki/Autorest-v3-based-generator-cheatsheet#vscode-debug) #790

**Bug Fixes**

- Correctly handling inheritance of class properties for inheritance chains > 3 levels #795
Expand Down
5 changes: 4 additions & 1 deletion autorest/jsonrpc/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# --------------------------------------------------------------------------
import contextlib
import os
import sys
import logging

from jsonrpc import dispatcher, JSONRPCResponseManager
Expand Down Expand Up @@ -53,7 +54,9 @@ def Process(plugin_name: str, session_id: str) -> bool:


def main() -> None:
if os.environ.get("AUTOREST_PYTHON_ATTACH_VSCODE_DEBUG", False):
# If --python.debugger is specified on the command line, we call the server.py file internally
# with flag --debug.
if '--debug' in sys.argv or os.environ.get("AUTOREST_PYTHON_ATTACH_VSCODE_DEBUG", False):
try:
import ptvsd # pylint: disable=import-outside-toplevel
except ImportError:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"scripts": {
"prepare": "node run-python3.js prepare.py",
"start": "node run-python3.js start.py",
"install": "node run-python3.js install.py"
"install": "node run-python3.js install.py",
"debug": "node run-python3.js start.py --debug"
},
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions run-python3.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
const cp = require("child_process");
const extension = require("@azure-tools/extension");

async function runPython3(scriptName) {
const command = ["python"];
async function runPython3(scriptName, debug = "") {
const command = ["python", scriptName, debug];
await extension.updatePythonPath(command);
cp.execSync(command[0] + " " + scriptName, {
cp.execSync(command.join(" "), {
stdio: [0, 1, 2]
});
}

runPython3(process.argv[2]).catch(err => {
runPython3(...process.argv.slice(2)).catch(err => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is saying "let me take the arguments from index 2 and onwards, and splat them"

const error = err.toString();

// Python script errors are already written out via stderr so don't
Expand Down
3 changes: 1 addition & 2 deletions start.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ def main():

env_builder = venv.EnvBuilder(with_pip=True)
venv_context = env_builder.ensure_directories(venv_path)

python_run(venv_context, "autorest.jsonrpc.server")
python_run(venv_context, "autorest.jsonrpc.server", *sys.argv[1:])

if __name__ == "__main__":
main()