Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ToggleSourceAndHeaderCommandHandler seems to use wrong URIs in TextDocumentIdentifier #255

Open
travkin79 opened this issue Feb 14, 2024 · 1 comment

Comments

@travkin79
Copy link
Contributor

travkin79 commented Feb 14, 2024

While debugging for another feature I looked deeper into the ToggleSourceAndHeaderCommandHandler and found out that the URI looks different compared to other URIs used in LSP4E. I think, that might lead to various problems.

I didn't find yet any issue that a cdt lsp user would experience because of that. But I had a problem with another LS request when I created the document identifier the same way as in ToggleSourceAndHeaderCommandHandler. In my case, the LS responded that it did not find my document. After fixing the document identifier creation, the LS found my document. Thus, I think, there might be a similar problem with the ToggleSourceAndHeaderCommandHandler, too.

Maybe someone should check that.

Details

The ToggleSourceAndHeaderCommandHandler creates document URIs with the following code
new TextDocumentIdentifier(fileUri.toString())
which leads to URIs like
file:/workspaces/.../src/instrumentmodel/ConsistencyCheckErrorReporter.cpp.
LSP4E uses the utility method LSPEclipseUtils.toTextDocumentIdentifier(IDocument) to create such URIs and these look a little different. For the above example we get the URI
file:///workspaces/.../src/instrumentmodel/ConsistencyCheckErrorReporter.cpp.
Please note that the first URI begins with file:/while the second begins with file:///.

@ddscharfe
Copy link
Contributor

Hi @travkin79,

you are right, the first URI lacks the (empty) authority, the second one seems correct. I guess I didn't think about this when I wrote the initial implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants