| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent adcf716 commit 937470e
42 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,6 +33,22 @@ | |||
| 33 | 33 | "cwd": "${workspaceFolder}", | |
| 34 | 34 | "preLaunchTask": "Compile" | |
| 35 | 35 | }, | |
| 36 | + { | ||
| 37 | + "name": "Launch Experimental Debugger as debugServer", // https://code.visualstudio.com/docs/extensions/example-debuggers | ||
| 38 | + "type": "node", | ||
| 39 | + "request": "launch", | ||
| 40 | + "program": "${workspaceFolder}/out/client/debugger/mainV2.js", | ||
| 41 | + "stopOnEntry": false, | ||
| 42 | + "args": [ | ||
| 43 | + "--server=4711" | ||
| 44 | + ], | ||
| 45 | + "sourceMaps": true, | ||
| 46 | + "outFiles": [ | ||
| 47 | + "${workspaceFolder}/out/client/**/*.js" | ||
| 48 | + ], | ||
| 49 | + "cwd": "${workspaceFolder}", | ||
| 50 | + "preLaunchTask": "Compile" | ||
| 51 | + }, | ||
| 36 | 52 | { | |
| 37 | 53 | "name": "Launch Tests", | |
| 38 | 54 | "type": "extensionHost", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -385,7 +385,8 @@ | |||
| 385 | 385 | "console": "integratedTerminal", | |
| 386 | 386 | "env": {}, | |
| 387 | 387 | "envFile": "^\"\\${workspaceFolder}/.env\"", | |
| 388 | - "debugOptions": [] | ||
| 388 | + "debugOptions": [], | ||
| 389 | + "internalConsoleOptions": "neverOpen" | ||
| 389 | 390 | } | |
| 390 | 391 | }, | |
| 391 | 392 | { | |
@@ -402,7 +403,8 @@ | |||
| 402 | 403 | "console": "externalTerminal", | |
| 403 | 404 | "env": {}, | |
| 404 | 405 | "envFile": "^\"\\${workspaceFolder}/.env\"", | |
| 405 | - "debugOptions": [] | ||
| 406 | + "debugOptions": [], | ||
| 407 | + "internalConsoleOptions": "neverOpen" | ||
| 406 | 408 | } | |
| 407 | 409 | }, | |
| 408 | 410 | { | |
@@ -740,7 +742,8 @@ | |||
| 740 | 742 | "console": "integratedTerminal", | |
| 741 | 743 | "env": {}, | |
| 742 | 744 | "envFile": "${workspaceFolder}/.env", | |
| 743 | - "debugOptions": [] | ||
| 745 | + "debugOptions": [], | ||
| 746 | + "internalConsoleOptions": "neverOpen" | ||
| 744 | 747 | }, | |
| 745 | 748 | { | |
| 746 | 749 | "name": "Python: Terminal (external)", | |
@@ -753,7 +756,8 @@ | |||
| 753 | 756 | "console": "externalTerminal", | |
| 754 | 757 | "env": {}, | |
| 755 | 758 | "envFile": "${workspaceFolder}/.env", | |
| 756 | - "debugOptions": [] | ||
| 759 | + "debugOptions": [], | ||
| 760 | + "internalConsoleOptions": "neverOpen" | ||
| 757 | 761 | }, | |
| 758 | 762 | { | |
| 759 | 763 | "name": "Python: Django", | |
@@ -884,6 +888,161 @@ | |||
| 884 | 888 | ] | |
| 885 | 889 | } | |
| 886 | 890 | ] | |
| 891 | + }, | ||
| 892 | + { | ||
| 893 | + "type": "pythonExperimental", | ||
| 894 | + "label": "Python Experimental", | ||
| 895 | + "languages": [ | ||
| 896 | + "python" | ||
| 897 | + ], | ||
| 898 | + "enableBreakpointsFor": { | ||
| 899 | + "languageIds": [ | ||
| 900 | + "python", | ||
| 901 | + "html" | ||
| 902 | + ] | ||
| 903 | + }, | ||
| 904 | + "aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217", | ||
| 905 | + "program": "./out/client/debugger/mainV2.js", | ||
| 906 | + "runtime": "node", | ||
| 907 | + "configurationSnippets": [ | ||
| 908 | + { | ||
| 909 | + "label": "Python Experimental: Terminal (integrated)", | ||
| 910 | + "description": "%python.snippet.launch.terminal.description%", | ||
| 911 | + "body": { | ||
| 912 | + "name": "Integrated Terminal/Console", | ||
| 913 | + "type": "pythonExperimental", | ||
| 914 | + "request": "launch", | ||
| 915 | + "stopOnEntry": true, | ||
| 916 | + "pythonPath": "^\"\\${config:python.pythonPath}\"", | ||
| 917 | + "program": "^\"\\${file}\"", | ||
| 918 | + "cwd": "", | ||
| 919 | + "console": "integratedTerminal", | ||
| 920 | + "env": {}, | ||
| 921 | + "envFile": "^\"\\${workspaceFolder}/.env\"", | ||
| 922 | + "debugOptions": [], | ||
| 923 | + "internalConsoleOptions": "neverOpen" | ||
| 924 | + } | ||
| 925 | + }, | ||
| 926 | + { | ||
| 927 | + "label": "Python Experimental: Terminal (external)", | ||
| 928 | + "description": "%python.snippet.launch.externalTerminal.description%", | ||
| 929 | + "body": { | ||
| 930 | + "name": "External Terminal/Console", | ||
| 931 | + "type": "pythonExperimental", | ||
| 932 | + "request": "launch", | ||
| 933 | + "stopOnEntry": true, | ||
| 934 | + "pythonPath": "^\"\\${config:python.pythonPath}\"", | ||
| 935 | + "program": "^\"\\${file}\"", | ||
| 936 | + "cwd": "", | ||
| 937 | + "console": "externalTerminal", | ||
| 938 | + "env": {}, | ||
| 939 | + "envFile": "^\"\\${workspaceFolder}/.env\"", | ||
| 940 | + "debugOptions": [], | ||
| 941 | + "internalConsoleOptions": "neverOpen" | ||
| 942 | + } | ||
| 943 | + } | ||
| 944 | + ], | ||
| 945 | + "configurationAttributes": { | ||
| 946 | + "launch": { | ||
| 947 | + "properties": { | ||
| 948 | + "program": { | ||
| 949 | + "type": "string", | ||
| 950 | + "description": "Absolute path to the program.", | ||
| 951 | + "default": "${file}" | ||
| 952 | + }, | ||
| 953 | + "pythonPath": { | ||
| 954 | + "type": "string", | ||
| 955 | + "description": "Path (fully qualified) to python executable. Defaults to the value in settings.json", | ||
| 956 | + "default": "${config:python.pythonPath}" | ||
| 957 | + }, | ||
| 958 | + "args": { | ||
| 959 | + "type": "array", | ||
| 960 | + "description": "Command line arguments passed to the program", | ||
| 961 | + "default": [], | ||
| 962 | + "items": { | ||
| 963 | + "type": "string" | ||
| 964 | + } | ||
| 965 | + }, | ||
| 966 | + "stopOnEntry": { | ||
| 967 | + "type": "boolean", | ||
| 968 | + "description": "Automatically stop after launch.", | ||
| 969 | + "default": false | ||
| 970 | + }, | ||
| 971 | + "console": { | ||
| 972 | + "enum": [ | ||
| 973 | + "integratedTerminal", | ||
| 974 | + "externalTerminal" | ||
| 975 | + ], | ||
| 976 | + "description": "Where to launch the debug target: internal console, integrated terminal, or external terminal.", | ||
| 977 | + "default": "integratedTerminal" | ||
| 978 | + }, | ||
| 979 | + "cwd": { | ||
| 980 | + "type": "string", | ||
| 981 | + "description": "Absolute path to the working directory of the program being debugged. Default is the root directory of the file (leave empty).", | ||
| 982 | + "default": "" | ||
| 983 | + }, | ||
| 984 | + "debugOptions": { | ||
| 985 | + "type": "array", | ||
| 986 | + "description": "Advanced options, view read me for further details.", | ||
| 987 | + "items": { | ||
| 988 | + "type": "string", | ||
| 989 | + "enum": [ | ||
| 990 | + "Sudo" | ||
| 991 | + ] | ||
| 992 | + }, | ||
| 993 | + "default": [] | ||
| 994 | + }, | ||
| 995 | + "env": { | ||
| 996 | + "type": "object", | ||
| 997 | + "description": "Environment variables defined as a key value pair. Property ends up being the Environment Variable and the value of the property ends up being the value of the Env Variable.", | ||
| 998 | + "default": {} | ||
| 999 | + }, | ||
| 1000 | + "envFile": { | ||
| 1001 | + "type": "string", | ||
| 1002 | + "description": "Absolute path to a file containing environment variable definitions.", | ||
| 1003 | + "default": "" | ||
| 1004 | + }, | ||
| 1005 | + "port": { | ||
| 1006 | + "type": "number", | ||
| 1007 | + "description": "Debug port (default is 0, resulting in the use of a dynamic port).", | ||
| 1008 | + "default": 0 | ||
| 1009 | + }, | ||
| 1010 | + "host": { | ||
| 1011 | + "type": "string", | ||
| 1012 | + "description": "IP address of the of the local debug server (default is localhost).", | ||
| 1013 | + "default": "localhost" | ||
| 1014 | + } | ||
| 1015 | + } | ||
| 1016 | + } | ||
| 1017 | + }, | ||
| 1018 | + "initialConfigurations": [ | ||
| 1019 | + { | ||
| 1020 | + "name": "Python Experimental: Current File (Integrated Terminal)", | ||
| 1021 | + "type": "pythonExperimental", | ||
| 1022 | + "request": "launch", | ||
| 1023 | + "pythonPath": "${config:python.pythonPath}", | ||
| 1024 | + "program": "${file}", | ||
| 1025 | + "cwd": "", | ||
| 1026 | + "console": "integratedTerminal", | ||
| 1027 | + "env": {}, | ||
| 1028 | + "envFile": "${workspaceFolder}/.env", | ||
| 1029 | + "debugOptions": [], | ||
| 1030 | + "internalConsoleOptions": "neverOpen" | ||
| 1031 | + }, | ||
| 1032 | + { | ||
| 1033 | + "name": "Python Experimental: Current File (External Terminal)", | ||
| 1034 | + "type": "pythonExperimental", | ||
| 1035 | + "request": "launch", | ||
| 1036 | + "pythonPath": "${config:python.pythonPath}", | ||
| 1037 | + "program": "${file}", | ||
| 1038 | + "cwd": "", | ||
| 1039 | + "console": "externalTerminal", | ||
| 1040 | + "env": {}, | ||
| 1041 | + "envFile": "${workspaceFolder}/.env", | ||
| 1042 | + "debugOptions": [], | ||
| 1043 | + "internalConsoleOptions": "neverOpen" | ||
| 1044 | + } | ||
| 1045 | + ] | ||
| 887 | 1046 | } | |
| 888 | 1047 | ], | |
| 889 | 1048 | "configuration": { | |
@@ -1663,5 +1822,10 @@ | |||
| 1663 | 1822 | "typescript-formatter": "^6.0.0", | |
| 1664 | 1823 | "vscode": "^1.1.5", | |
| 1665 | 1824 | "vscode-debugadapter-testsupport": "^1.25.0" | |
| 1825 | + }, | ||
| 1826 | + "__metadata": { | ||
| 1827 | + "id": "f1f59ae4-9318-4f3c-a9b5-81b2eaa5f8a5", | ||
| 1828 | + "publisherDisplayName": "Microsoft", | ||
| 1829 | + "publisherId": "998b010b-e2af-44a5-a6cd-0b5fd3b9b6f8" | ||
| 1666 | 1830 | } | |
| 1667 | 1831 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,96 @@ | |||
| 1 | + # Python Tools for Visual Studio | ||
| 2 | + # Copyright(c) Microsoft Corporation | ||
| 3 | + # All rights reserved. | ||
| 4 | + # | ||
| 5 | + # Licensed under the Apache License, Version 2.0 (the License); you may not use | ||
| 6 | + # this file except in compliance with the License. You may obtain a copy of the | ||
| 7 | + # License at http://www.apache.org/licenses/LICENSE-2.0 | ||
| 8 | + # | ||
| 9 | + # THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS | ||
| 10 | + # OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY | ||
| 11 | + # IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
| 12 | + # MERCHANTABLITY OR NON-INFRINGEMENT. | ||
| 13 | + # | ||
| 14 | + # See the Apache Version 2.0 License for specific language governing | ||
| 15 | + # permissions and limitations under the License. | ||
| 16 | + | ||
| 17 | + """ | ||
| 18 | + Starts Debugging, expected to start with normal program | ||
| 19 | + to start as first argument and directory to run from as | ||
| 20 | + the second argument. | ||
| 21 | + """ | ||
| 22 | + | ||
| 23 | + __author__ = "Microsoft Corporation <ptvshelp@microsoft.com>" | ||
| 24 | + __version__ = "3.2.0.0" | ||
| 25 | + | ||
| 26 | + import os | ||
| 27 | + import os.path | ||
| 28 | + import sys | ||
| 29 | + import traceback | ||
| 30 | + | ||
| 31 | + # Arguments are: | ||
| 32 | + # 1. Working directory. | ||
| 33 | + # 2. VS debugger port to connect to. | ||
| 34 | + # 3. GUID for the debug session. | ||
| 35 | + # 4. Debug options (as list of names - see enum PythonDebugOptions). | ||
| 36 | + # 5. '-g' to use the installed ptvsd package, rather than bundled one. | ||
| 37 | + # 6. '-m' or '-c' to override the default run-as mode. [optional] | ||
| 38 | + # 7. Startup script name. | ||
| 39 | + # 8. Script arguments. | ||
| 40 | + | ||
| 41 | + # change to directory we expected to start from | ||
| 42 | + os.chdir(sys.argv[1]) | ||
| 43 | + | ||
| 44 | + port_num = int(sys.argv[2]) | ||
| 45 | + debug_id = sys.argv[3] | ||
| 46 | + debug_options = set([opt.strip() for opt in sys.argv[4].split(',')]) | ||
| 47 | + | ||
| 48 | + del sys.argv[0:5] | ||
| 49 | + | ||
| 50 | + # Use bundled ptvsd or not? | ||
| 51 | + bundled_ptvsd = True | ||
| 52 | + if sys.argv and sys.argv[0] == '-g': | ||
| 53 | + bundled_ptvsd = False | ||
| 54 | + del sys.argv[0] | ||
| 55 | + | ||
| 56 | + # set run_as mode appropriately | ||
| 57 | + run_as = 'script' | ||
| 58 | + if sys.argv and sys.argv[0] == '-m': | ||
| 59 | + run_as = 'module' | ||
| 60 | + del sys.argv[0] | ||
| 61 | + if sys.argv and sys.argv[0] == '-c': | ||
| 62 | + run_as = 'code' | ||
| 63 | + del sys.argv[0] | ||
| 64 | + | ||
| 65 | + # preserve filename before we del sys | ||
| 66 | + filename = sys.argv[0] | ||
| 67 | + | ||
| 68 | + # fix sys.path to be the script file dir | ||
| 69 | + sys.path[0] = '' | ||
| 70 | + | ||
| 71 | + # Load the debugger package | ||
| 72 | + try: | ||
| 73 | + if bundled_ptvsd: | ||
| 74 | + ptvs_lib_path = os.path.dirname(__file__) | ||
| 75 | + sys.path.insert(0, ptvs_lib_path) | ||
| 76 | + import ptvsd | ||
| 77 | + import ptvsd.debugger as vspd | ||
| 78 | + vspd.DONT_DEBUG.append(os.path.normcase(__file__)) | ||
| 79 | + except: | ||
| 80 | + traceback.print_exc() | ||
| 81 | + print(''' | ||
| 82 | + Internal error detected. Please copy the above traceback and report at | ||
| 83 | + https://go.microsoft.com/fwlink/?LinkId=293415 | ||
| 84 | + | ||
| 85 | + Press Enter to close. . .''') | ||
| 86 | + try: | ||
| 87 | + raw_input() | ||
| 88 | + except NameError: | ||
| 89 | + input() | ||
| 90 | + sys.exit(1) | ||
| 91 | + finally: | ||
| 92 | + if bundled_ptvsd: | ||
| 93 | + sys.path.remove(ptvs_lib_path) | ||
| 94 | + | ||
| 95 | + # and start debugging | ||
| 96 | + vspd.debug(filename, port_num, debug_id, debug_options, run_as) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,6 +5,7 @@ import { EventEmitter } from 'events'; | |||
| 5 | 5 | import * as path from 'path'; | |
| 6 | 6 | import * as vscode from 'vscode'; | |
| 7 | 7 | import { ConfigurationTarget, Uri } from 'vscode'; | |
| 8 | + import { isTestExecution } from './constants'; | ||
| 8 | 9 | import { | |
| 9 | 10 | IAutoCompeteSettings, | |
| 10 | 11 | IFormattingSettings, | |
@@ -22,11 +23,6 @@ const untildify = require('untildify'); | |||
| 22 | 23 | ||
| 23 | 24 | export const IS_WINDOWS = /^win/.test(process.platform); | |
| 24 | 25 | ||
| 25 | - export function isTestExecution(): boolean { | ||
| 26 | - // tslint:disable-next-line:interface-name no-string-literal | ||
| 27 | - return process.env['VSC_PYTHON_CI_TEST'] === '1'; | ||
| 28 | - } | ||
| 29 | - | ||
| 30 | 26 | // tslint:disable-next-line:completed-docs | |
| 31 | 27 | export class PythonSettings extends EventEmitter implements IPythonSettings { | |
| 32 | 28 | private static pythonSettings: Map<string, PythonSettings> = new Map<string, PythonSettings>(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -63,3 +63,8 @@ export namespace LinterErrors { | |||
| 63 | 63 | } | |
| 64 | 64 | ||
| 65 | 65 | export const STANDARD_OUTPUT_CHANNEL = 'STANDARD_OUTPUT_CHANNEL'; | |
| 66 | + | ||
| 67 | + export function isTestExecution(): boolean { | ||
| 68 | + // tslint:disable-next-line:interface-name no-string-literal | ||
| 69 | + return process.env['VSC_PYTHON_CI_TEST'] === '1'; | ||
| 70 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,13 +1,23 @@ | |||
| 1 | 1 | import { EventEmitter } from 'events'; | |
| 2 | + import { injectable } from 'inversify'; | ||
| 2 | 3 | import * as net from 'net'; | |
| 3 | - import { createDeferred } from '../../helpers'; | ||
| 4 | + import { createDeferred, Deferred } from '../../helpers'; | ||
| 5 | + import { ISocketServer } from '../../types'; | ||
| 4 | 6 | ||
| 5 | - export class SocketServer extends EventEmitter { | ||
| 7 | + @injectable() | ||
| 8 | + export class SocketServer extends EventEmitter implements ISocketServer { | ||
| 6 | 9 | private socketServer: net.Server | undefined; | |
| 10 | + private clientSocket: Deferred<net.Socket>; | ||
| 11 | + public get client(): Promise<net.Socket> { | ||
| 12 | + return this.clientSocket.promise; | ||
| 13 | + } | ||
| 7 | 14 | constructor() { | |
| 8 | 15 | super(); | |
| 16 | + this.clientSocket = createDeferred<net.Socket>(); | ||
| 17 | + } | ||
| 18 | + public dispose() { | ||
| 19 | + this.Stop(); | ||
| 9 | 20 | } | |
| 10 | - | ||
| 11 | 21 | public Stop() { | |
| 12 | 22 | if (!this.socketServer) { return; } | |
| 13 | 23 | try { | |
@@ -37,6 +47,9 @@ export class SocketServer extends EventEmitter { | |||
| 37 | 47 | } | |
| 38 | 48 | ||
| 39 | 49 | private connectionListener(client: net.Socket) { | |
| 50 | + if (!this.clientSocket.completed) { | ||
| 51 | + this.clientSocket.resolve(client); | ||
| 52 | + } | ||
| 40 | 53 | client.on('close', () => { | |
| 41 | 54 | this.emit('close', client); | |
| 42 | 55 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments