swiftlang / sourcekit-lsp

Language Server Protocol implementation for Swift and C-based languages
Apache License 2.0
3.3k stars 275 forks source link

Throw an error when creating a DocumentURI from a URL with no scheme instead of hitting an assertion #1290

Closed ahoppen closed 4 months ago

ahoppen commented 5 months ago

We should throw an error from here instead of crashing sourcekit-lsp by hitting an assertion failure.

https://github.com/apple/sourcekit-lsp/blob/4bff5603b490ac6835e7df69e99c8cfd4846f87a/Sources/LanguageServerProtocol/SupportTypes/DocumentURI.swift#L75

ahoppen commented 5 months ago

Synced to Apple’s issue tracker as rdar://128036062

ahoppen commented 4 months ago

Looks like URL can never be created without a scheme, so we shouldn’t be able to hit the assertion and everything is fine.