SublimeDebugger icon indicating copy to clipboard operation
SublimeDebugger copied to clipboard

Unable to start adapter: 'projectName' in java debugger

Open o-oconnell opened this issue 2 years ago • 2 comments

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

  • How do you determine the behavior of the vscode.java.xxxx commands? Is it via reading the code of https://github.com/Microsoft/java-debug? Is that jar bundled in the lsp-jdtls package?
  • What is the workflow for debugging/editing Debugger? Do you use the sublime_debug adapter? I have tried unsetting the development flag but it does not seem to show up in any menus for me. I have also tried quickly reloading the plugin with the sublime_plugin.reload_plugin() method which gives no output (but does not fail) yet does not seem to successfully reload the plugin, so I have had to shut down and restart sublime text repeatedly.

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'

o-oconnell avatar May 14 '23 18:05 o-oconnell

Can you provide a minimal example where that issue occurs?

LDAP avatar May 14 '23 20:05 LDAP

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

daveleroy avatar May 14 '23 20:05 daveleroy