daveleroy / SublimeDebugger

Graphical Debugger for Sublime Text for debuggers that support the debug adapter protocol
MIT License
366 stars 41 forks source link

Unable to start adapter: 'projectName' in java debugger #221

Open o-oconnell opened 1 year ago

o-oconnell commented 1 year ago

A couple of questions that might resolve this before you look at the bug report:

So I am getting this bug after running the start method in the java adapter, but I am not sure how to reproduce it. I have fixed it previously by copying all of my code into a new directory and creating a new sublime-project, but I am still not sure why that worked. The java code in examples always works for me.

Configuration (in /home/xxxx/Downloads/Downloads/www2/src/main/java/compiler/conf.sublime-project)

{
    "folders":
    [
        {
            "path": "/home/hjkl/www2",
        }
    ],
    "debugger_configurations":
    [
        {
            "type": "java",
            "name": "Launch with Arguments Prompt",
            "request": "launch",
            "mainClass": "compiler.puny",
            "args": "-dot /home/hjkl/www2/src/main/java/good_semantics_cse107/winds.py"
        },
    ],
}

Console:

matches is [{'filePath': '/home/xxxx/Downloads/Downloads/www2/src/main/java/compiler/puny.java', 'mainClass': 'compiler.puny'}] (my print statement)
Debugger: error: Unable to start adapter: 'projectName'
Traceback (most recent call last):
  File "/home/xxxx/.config/sublime-text/Packages/Debugger/modules/dap/session.py", line 192, in _launch
    transport = await self.adapter_configuration.start(log=self.log, configuration=self.configuration)
  File "/home/xxxx/.config/sublime-text/Packages/Debugger/modules/adapters/java.py", line 36, in start
    configuration['mainClass'], configuration['projectName'] = await self._get_mainclass_project_name(None if _is_undefined('mainClass') else configuration['mainClass'])
  File "/home/xxxx/.config/sublime-text/Packages/Debugger/modules/adapters/java.py", line 69, in _get_mainclass_project_name
    return matches[0]['mainClass'], matches[0]['projectName']
KeyError: 'projectName'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/xxxx/.config/sublime-text/Packages/Debugger/modules/dap/session.py", line 162, in launch
    await self.launching_async
  File "/home/xxxx/.config/sublime-text/Packages/Debugger/modules/dap/session.py", line 194, in _launch
    raise core.Error(f'Unable to start adapter: {e}')
Debugger.modules.core.error.Error: Unable to start adapter: 'projectName'
LDAP commented 1 year ago

Can you provide a minimal example where that issue occurs?

daveleroy commented 1 year ago

The sublime adapter for debugging plugins is still a work in progress

To restart you should generally be able to save the start.py and it will reload the entire package