Uh oh!
There was an error while loading. Please reload this page.
WIP: Refactor server_dap to use command-registration style - #10
Conversation
| end | ||
| def process | ||
| register_command('disconnect') do |args, req| |
| @width = 80 | ||
| @repl = true | ||
| @session = nil | ||
| @commands = {} # used in UI_DAP |
There was a problem hiding this comment.
- I think
requestsuits the server context better. How about@registered_requests? - We probably don't want to touch the CDP server for this refactor. So perhaps we'll initialise this in the DAP server instead?
There was a problem hiding this comment.
@andyw8 Sorry that I wasn't clear, but by renaming command to request, I meant the API should be called register_request too. And ServerCommand could be RequestHandler.
Because in Session, the term command actually maps to the commands users type. So I hope we can make a clearer distinction in the server class.
3ef7c84 to
650ffa7Compare| ## boot/configuration | ||
| # no tests in test/protocol | ||
| register_request 'launch' do |_args, req, instance| | ||
| instance.instance_eval do |
There was a problem hiding this comment.
I feel like there's a better way to structure this to avoid the repeated use of instance_eval but I'm unsure how.
There was a problem hiding this comment.
In process, use instance_exec instead, like:
self.instance_exec(args,req, &cmd.block)And then you can remove all the instance.instance_eval
cdfd8ed to
122f9d4Compareandyw8
commented
Mar 9, 2023
Re-opened against |
https://github.com/Shopify/ruby-dev-exp-issues/issues/840
FYI @st0012
(I know this doesn't belong in
issues-workaround, just branching off that for convenience).I recommend viewing with whitespace changes ignored: https://github.com/Shopify/debug/pull/10/files?w=1