1313from debugpy .adapter import components , servers , sessions
1414
1515
16- class IDE (components .Component ):
17- """Handles the IDE side of a debug session."""
16+ class Client (components .Component ):
17+ """Handles the client side of a debug session."""
1818
1919 message_handler = components .Component .message_handler
2020
@@ -36,7 +36,7 @@ class Expectations(components.Capabilities):
3636
3737 def __init__ (self , sock ):
3838 if sock == "stdio" :
39- log .info ("Connecting to IDE over stdio..." , self )
39+ log .info ("Connecting to client over stdio..." , self )
4040 stream = messaging .JsonIOStream .from_stdio ()
4141 # Make sure that nothing else tries to interfere with the stdio streams
4242 # that are going to be used for DAP communication from now on.
@@ -46,22 +46,22 @@ def __init__(self, sock):
4646 stream = messaging .JsonIOStream .from_socket (sock )
4747
4848 with sessions .Session () as session :
49- super (IDE , self ).__init__ (session , stream )
49+ super (Client , self ).__init__ (session , stream )
5050
5151 self .client_id = None
5252 """ID of the connecting client. This can be 'test' while running tests."""
5353
5454 self .has_started = False
55- """Whether the "launch" or "attach" request was received from the IDE , and
55+ """Whether the "launch" or "attach" request was received from the client , and
5656 fully handled.
5757 """
5858
5959 self .start_request = None
60- """The "launch" or "attach" request as received from the IDE .
60+ """The "launch" or "attach" request as received from the client .
6161 """
6262
6363 self ._initialize_request = None
64- """The "initialize" request as received from the IDE , to propagate to the
64+ """The "initialize" request as received from the client , to propagate to the
6565 server later."""
6666
6767 self ._deferred_events = []
@@ -70,11 +70,11 @@ def __init__(self, sock):
7070 """
7171
7272 self ._known_subprocesses = set ()
73- """servers.Connection instances for subprocesses that this IDE has been
73+ """servers.Connection instances for subprocesses that this client has been
7474 made aware of.
7575 """
7676
77- session .ide = self
77+ session .client = self
7878 session .register ()
7979
8080 # For the transition period, send the telemetry events with both old and new
@@ -97,26 +97,26 @@ def __init__(self, sock):
9797 )
9898
9999 def propagate_after_start (self , event ):
100- # pydevd starts sending events as soon as we connect, but the IDE doesn't
100+ # pydevd starts sending events as soon as we connect, but the client doesn't
101101 # expect to see any until it receives the response to "launch" or "attach"
102- # request. If IDE is not ready yet, save the event instead of propagating
102+ # request. If client is not ready yet, save the event instead of propagating
103103 # it immediately.
104104 if self ._deferred_events is not None :
105105 self ._deferred_events .append (event )
106106 log .debug ("Propagation deferred." )
107107 else :
108- self .ide .channel .propagate (event )
108+ self .client .channel .propagate (event )
109109
110110 def _propagate_deferred_events (self ):
111- log .debug ("Propagating deferred events to {0}..." , self .ide )
111+ log .debug ("Propagating deferred events to {0}..." , self .client )
112112 for event in self ._deferred_events :
113113 log .debug ("Propagating deferred {0}" , event .describe ())
114- self .ide .channel .propagate (event )
115- log .info ("All deferred events propagated to {0}." , self .ide )
114+ self .client .channel .propagate (event )
115+ log .info ("All deferred events propagated to {0}." , self .client )
116116 self ._deferred_events = None
117117
118- # Generic event handler. There are no specific handlers for IDE events, because
119- # there are no events from the IDE in DAP - but we propagate them if we can, in
118+ # Generic event handler. There are no specific handlers for client events, because
119+ # there are no events from the client in DAP - but we propagate them if we can, in
120120 # case some events appear in future protocol versions.
121121 @message_handler
122122 def event (self , event ):
@@ -166,7 +166,6 @@ def initialize_request(self, request):
166166 # See https://github.com/microsoft/vscode/issues/4902#issuecomment-368583522
167167 # for the sequence of request and events necessary to orchestrate the start.
168168 def _start_message_handler (f ):
169-
170169 @components .Component .message_handler
171170 def handle (self , request ):
172171 assert request .is_request ("launch" , "attach" )
@@ -195,7 +194,9 @@ def handle(self, request):
195194 # The launcher is doing output redirection, so we don't need the
196195 # server to do it, as well.
197196 arguments = dict (arguments )
198- arguments ["debugOptions" ] = list (debug_options - {"RedirectOutput" })
197+ arguments ["debugOptions" ] = list (
198+ debug_options - {"RedirectOutput" }
199+ )
199200
200201 if arguments .get ("redirectOutput" ):
201202 arguments = dict (arguments )
@@ -232,7 +233,7 @@ def handle(self, request):
232233 },
233234 )
234235
235- # Let the IDE know that it can begin configuring the adapter.
236+ # Let the client know that it can begin configuring the adapter.
236237 self .channel .send_event ("initialized" )
237238
238239 self .start_request = request
@@ -310,12 +311,12 @@ def attach_request(self, request):
310311 #
311312 # If neither is specified, and "waitForAttach" is false, this is attach-by-socket
312313 # in which the server has spawned the adapter via debugpy.listen(). There
313- # is no PID known to the IDE in advance, but the server connection should be
314+ # is no PID known to the client in advance, but the server connection should be
314315 # either be there already, or the server should be connecting shortly, so there
315316 # must be a timeout.
316317 #
317318 # In the last two cases, if there's more than one server connection already,
318- # this is a multiprocess re-attach. The IDE doesn't know the PID, so we just
319+ # this is a multiprocess re-attach. The client doesn't know the PID, so we just
319320 # connect it to the oldest server connection that we have - in most cases, it
320321 # will be the one for the root debuggee process, but if it has exited already,
321322 # it will be some subprocess.
@@ -379,7 +380,7 @@ def configurationDone_request(self, request):
379380 self .start_request .respond ({})
380381 self ._propagate_deferred_events ()
381382
382- # Notify the IDE of any child processes of the debuggee that aren't already
383+ # Notify the client of any child processes of the debuggee that aren't already
383384 # being debugged.
384385 for conn in servers .connections ():
385386 if conn .server is None and conn .ppid == self .session .pid :
@@ -418,15 +419,15 @@ def debugpySystemInfo_request(self, request):
418419
419420 @message_handler
420421 def terminate_request (self , request ):
421- self .session .finalize ('IDE requested "terminate"' , terminate_debuggee = True )
422+ self .session .finalize ('client requested "terminate"' , terminate_debuggee = True )
422423 return {}
423424
424425 @message_handler
425426 def disconnect_request (self , request ):
426427 terminate_debuggee = request ("terminateDebuggee" , bool , optional = True )
427428 if terminate_debuggee == ():
428429 terminate_debuggee = None
429- self .session .finalize ('IDE requested "disconnect"' , terminate_debuggee )
430+ self .session .finalize ('client requested "disconnect"' , terminate_debuggee )
430431 return {}
431432
432433 def notify_of_subprocess (self , conn ):
@@ -460,7 +461,7 @@ def notify_of_subprocess(self, conn):
460461
461462def serve (host , port ):
462463 global listener
463- listener = sockets .serve ("IDE " , IDE , host , port )
464+ listener = sockets .serve ("Client " , Client , host , port )
464465 return listener .getsockname ()
465466
466467
0 commit comments