Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Account for one of the multiple GoTo handlers throwing an exception
The GoTo subcommand might have multiple LSP handlers associated with it. Mostly, it is `textDocument/definition` and `textDocument/declaration`. Normally, we cycle through handlers until one of two things happens: 1. The handler returns more than one location. 2. The handler returns a single location, but that doese not contain the cursor. This breaks if any of the handlers throws an exception. When that happens, we immediately propagate the error, instead of trying the next handler. However, we can not simply swallow exceptions, because there's a possibility for all handlers to throw. Or some throws and some return zero locations. Current idea: 1. Do not throw as soon as a handler reports zero locations. 2. If the current handler returns more than a single location, replace previous result with the current one. 3. If there's more than one location or the single location does not contain cursor, break out of the loop - we have valid results. Otherwise, move to the next handler. 4. After exiting the handler loop, if the results are falsey, *now* throw an exception.
- Loading branch information