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

Add support for URI fragments #1387

Merged
merged 3 commits into from
Oct 7, 2024
Merged

Add support for URI fragments #1387

merged 3 commits into from
Oct 7, 2024

Conversation

Lysxia
Copy link
Contributor

@Lysxia Lysxia commented Oct 4, 2024

This is useful because in VSCode, file system URIs can contain line numbers in the fragment: file:///path#N.

@voodoos
Copy link
Collaborator

voodoos commented Oct 7, 2024

Do you have examples of requests to the server that require correct handling of these fragments ? Or is it that you use the lsp library in another application ?

@Lysxia
Copy link
Contributor Author

Lysxia commented Oct 7, 2024

I am using lsp in my own language server where I would like to send a URI with a fragment to the client. Specifically, I'm trying to use the DocumentLink feature to link to another file. The target of DocumentLink can only be a URI, with no field for position information. The fragment lets a URI point to a file location.

Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
@rgrinberg
Copy link
Member

Thanks for the contribution. I think you forgot to promote the test. Can you review them at 73363fd (#1387)

If those look correct to you, this PR is good to go.

Copy link
Contributor Author

@Lysxia Lysxia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests look good to me!

@rgrinberg
Copy link
Member

LGTM. Bear in mind that the LSP library offers no API stability.

@rgrinberg rgrinberg merged commit 4023b01 into ocaml:master Oct 7, 2024
4 of 7 checks passed
@Lysxia Lysxia deleted the uri-fragment branch October 7, 2024 18:20
@coveralls
Copy link

Pull Request Test Coverage Report for Build 4589

Details

  • 3 of 4 (75.0%) changed or added relevant lines in 1 file are covered.
  • 17 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.007%) to 21.913%

Changes Missing Coverage Covered Lines Changed/Added Lines %
lsp/src/uri0.ml 3 4 75.0%
Files with Coverage Reduction New Missed Lines %
ocaml-lsp-server/src/import.ml 1 34.69%
lsp/src/uri_lexer.ml 16 79.76%
Totals Coverage Status
Change from base Build 4580: 0.007%
Covered Lines: 5562
Relevant Lines: 25382

💛 - Coveralls

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

Successfully merging this pull request may close these issues.

4 participants