コード例 #1
0
ファイル: ide.py プロジェクト: Adespinoza/dotfiles
 class Expectations(components.Capabilities):
     PROPERTIES = {
         "locale": "en-US",
         "linesStartAt1": True,
         "columnsStartAt1": True,
         "pathFormat": json.enum("path"),  # we don't support "uri"
     }
コード例 #2
0
ファイル: ide.py プロジェクト: Adespinoza/dotfiles
    def launch_request(self, request):
        from ptvsd.adapter import launchers

        if self.session.id != 1 or len(servers.connections()):
            raise request.cant_handle('"attach" expected')

        sudo = request("sudo",
                       json.default("Sudo" in self.session.debug_options))
        if sudo:
            if sys.platform == "win32":
                raise request.cant_handle(
                    '"sudo":true is not supported on Windows.')
        else:
            if "Sudo" in self.session.debug_options:
                raise request.isnt_valid(
                    '"sudo":false and "debugOptions":["Sudo"] are mutually exclusive'
                )

        # Launcher doesn't use the command line at all, but we pass the arguments so
        # that they show up in the terminal if we're using "runInTerminal".
        if "program" in request:
            args = request("program",
                           json.array(unicode, vectorize=True, size=(1, )))
        elif "module" in request:
            args = ["-m"] + request(
                "module", json.array(unicode, vectorize=True, size=(1, )))
        elif "code" in request:
            args = ["-c"] + request(
                "code", json.array(unicode, vectorize=True, size=(1, )))
        else:
            args = []
        args += request("args", json.array(unicode))

        console = request(
            "console",
            json.enum(
                "internalConsole",
                "integratedTerminal",
                "externalTerminal",
                optional=True,
            ),
        )
        console_title = request("consoleTitle",
                                json.default("Python Debug Console"))

        launchers.spawn_debuggee(self.session, request, sudo, args, console,
                                 console_title)
コード例 #3
0
    def launch_request(self, request):
        sudo = request("sudo",
                       json.default("Sudo" in self.session.debug_options))
        if sudo:
            if platform.system() == "Windows":
                raise request.cant_handle(
                    '"sudo":true is not supported on Windows.')
        else:
            if "Sudo" in self.session.debug_options:
                raise request.isnt_valid(
                    '"sudo":false and "debugOptions":["Sudo"] are mutually exclusive'
                )

        # Launcher doesn't use the command line at all, but we pass the arguments so
        # that they show up in the terminal if we're using "runInTerminal".
        if "program" in request:
            args = request("program",
                           json.array(unicode, vectorize=True, size=(1, )))
        elif "module" in request:
            args = ["-m"] + request(
                "module", json.array(unicode, vectorize=True, size=(1, )))
        elif "code" in request:
            args = ["-c"] + request(
                "code", json.array(unicode, vectorize=True, size=(1, )))
        else:
            args = []
        args += request("args", json.array(unicode))

        console = request(
            "console",
            json.enum(
                "internalConsole",
                "integratedTerminal",
                "externalTerminal",
                optional=True,
            ),
        )
        console_title = request("consoleTitle",
                                json.default("Python Debug Console"))

        self.session.spawn_debuggee(request, sudo, args, console,
                                    console_title)

        if "RedirectOutput" in self.session.debug_options:
            # The launcher is doing output redirection, so we don't need the server.
            request.arguments["debugOptions"].remove("RedirectOutput")