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 proper handling of escape characters in LSP URIs #1941

Merged
merged 5 commits into from
Jun 15, 2023

Conversation

glatosinski
Copy link
Collaborator

This PR adds methods for encoding and decoding URIs and filesystem paths in the LSP (so that URIs follow RFC 3986 URI specification).

@codecov-commenter
Copy link

codecov-commenter commented Jun 6, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (d87f242) 92.83% compared to head (fe8029e) 92.84%.

❗ Current head fe8029e differs from pull request most recent head c05cf52. Consider uploading reports for the commit c05cf52 to get more accurate results

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1941   +/-   ##
=======================================
  Coverage   92.83%   92.84%           
=======================================
  Files         355      355           
  Lines       26073    26115   +42     
=======================================
+ Hits        24206    24247   +41     
- Misses       1867     1868    +1     
Impacted Files Coverage Δ
common/lsp/lsp-file-utils.cc 100.00% <100.00%> (ø)
verilog/tools/ls/lsp-parse-buffer.cc 95.65% <100.00%> (ø)
verilog/tools/ls/symbol-table-handler.cc 89.89% <100.00%> (ø)
verilog/tools/ls/verilog-language-server.cc 93.91% <100.00%> (-0.87%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@glatosinski glatosinski marked this pull request as ready for review June 7, 2023 13:08
Copy link
Collaborator

@hzeller hzeller left a comment

Choose a reason for hiding this comment

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

Looks good in general; a few comments.

common/lsp/lsp-file-utils.cc Show resolved Hide resolved
common/lsp/lsp-file-utils.cc Outdated Show resolved Hide resolved
common/lsp/lsp-file-utils.cc Outdated Show resolved Hide resolved
common/lsp/lsp-file-utils.cc Outdated Show resolved Hide resolved
common/lsp/lsp-file-utils.cc Outdated Show resolved Hide resolved
common/lsp/lsp-file-utils.cc Outdated Show resolved Hide resolved
common/lsp/lsp-file-utils_test.cc Outdated Show resolved Hide resolved
common/lsp/lsp-file-utils_test.cc Show resolved Hide resolved
common/lsp/lsp-file-utils_test.cc Show resolved Hide resolved
common/lsp/lsp-file-utils_test.cc Outdated Show resolved Hide resolved
@hzeller
Copy link
Collaborator

hzeller commented Jun 8, 2023

It does look like the Windows installation or at least the interaction with bazel is hosed on the CI, that probably has to be fixed first.

@glatosinski glatosinski force-pushed the lsp-uri-decoding branch 2 times, most recently from 1486051 to ec0cb96 Compare June 13, 2023 12:33
@glatosinski glatosinski marked this pull request as draft June 13, 2023 12:56
@glatosinski glatosinski force-pushed the lsp-uri-decoding branch 4 times, most recently from 1a903c9 to 8b146b5 Compare June 13, 2023 15:50
@hzeller
Copy link
Collaborator

hzeller commented Jun 13, 2023

#1945 is merged, so after a rebase, this might compile.

…s in URIs

The URIs in LSP requests from editors are following RFC 3986 - this
commit adds parsing escaped symbols in the paths, such as spaces, colons

Signed-off-by: Grzegorz Latosinski <glatosinski@antmicro.com>
Signed-off-by: Grzegorz Latosinski <glatosinski@antmicro.com>
Copy link
Collaborator

@hzeller hzeller left a comment

Choose a reason for hiding this comment

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

Looks like we now also need to modify the tests in language server test that use the ScopedTestFile.

Previously they were just assuming that the output paths are "file://" + module_b.filename(), but now we will have to look if they are PathToLSPUri(module_b.filename()).

common/lsp/lsp-file-utils_test.cc Outdated Show resolved Hide resolved
Signed-off-by: Grzegorz Latosinski <glatosinski@antmicro.com>
Signed-off-by: Grzegorz Latosinski <glatosinski@antmicro.com>
…LSPUri instead of custom URI conversion

Signed-off-by: Grzegorz Latosinski <glatosinski@antmicro.com>
@glatosinski
Copy link
Collaborator Author

The tests are updated now

@glatosinski glatosinski marked this pull request as ready for review June 15, 2023 11:29
@glatosinski glatosinski requested a review from hzeller June 15, 2023 19:31
Copy link
Collaborator

@hzeller hzeller left a comment

Choose a reason for hiding this comment

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

LGTM

@hzeller hzeller merged commit ddcea37 into chipsalliance:master Jun 15, 2023
35 checks passed
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.

None yet

3 participants