Skip to content

Uncaught exception: 'java.project.listSourcePaths' already exists #2331

@davidpcaldwell

Description

@davidpcaldwell

When developing my own extension and running it under the Extension Development Host in the debugger (I have it set to pause on uncaught exceptions), on opening a Java project (with this extension installed), I am getting the following stack trace:

Exception has occurred: Error: command 'java.project.listSourcePaths' already exists
t u.registerCommand ([/Users/inonit/Applications/Visual]() Studio Code.app[/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:93:28683]())
	at Object.registerCommand ([/Users/inonit/Applications/Visual]() Studio Code.app[/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:107:30423]())
	at X.register ([/Users/inonit/.vscode/extensions/redhat.java-1.3.0/dist/extension.js:2:945419]())
	at [/Users/inonit/.vscode/extensions/redhat.java-1.3.0/dist/extension.js:2:966900]()
	at new Promise (<anonymous>)
	at w.handleRegistrationRequest ([/Users/inonit/.vscode/extensions/redhat.java-1.3.0/dist/extension.js:2:966543]())
	at [/Users/inonit/.vscode/extensions/redhat.java-1.3.0/dist/extension.js:2:957330]()
	at [/Users/inonit/.vscode/extensions/redhat.java-1.3.0/dist/extension.js:2:1106102]()
	at [/Users/inonit/.vscode/extensions/redhat.java-1.3.0/dist/extension.js:2:1107161]()
	at Immediate._onImmediate ([/Users/inonit/.vscode/extensions/redhat.java-1.3.0/dist/extension.js:2:1109867]())
	at processImmediate (internal[/timers.js:461:21]())
	at process.callbackTrampoline (internal[/async_hooks.js:131:14]())```

##### Environment
- Operating System: macOS (10.15.7 and 12.2.1)
- JDK version: Oracle JDK 1.8.0_212 and AdoptOpenJDK 11.0.8
- Visual Studio Code version: 1.64.2
- Java extension version: 1.3.0

##### Steps To Reproduce
1. Open Extension Development Host with my (unpublished) extension and with a window containing Java projects
2. Wait. I don't know the API well enough to know whether this is on a timer (the stack trace may suggest this) or whether it's more complicated than that (`processImmediate` is maybe just something to do with the event loop)?

##### Current Result
See stack trace of uncaught exception above.

##### Expected Result
No uncaught exception.

##### Additional Informations
![Screen Shot 2022-02-23 at 2 26 38 PM](https://user-images.githubusercontent.com/1809061/155395932-3a03d2f6-e15e-432d-8866-12721772c8b3.png)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions