Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix error handling in LSP to guard against empty results from the compiler. #6480

Merged
merged 3 commits into from
Aug 29, 2024

Conversation

JoshuaBatty
Copy link
Member

@JoshuaBatty JoshuaBatty commented Aug 29, 2024

Description

Fixes the crashes that we were seeing in CI. We now return an error if the last results is empty so we don't index oob when accessing the Engines during traversal or when creating runnables.

closes #6458

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@JoshuaBatty JoshuaBatty requested a review from a team as a code owner August 29, 2024 01:02
@JoshuaBatty JoshuaBatty requested a review from a team August 29, 2024 01:02
@JoshuaBatty JoshuaBatty self-assigned this Aug 29, 2024
@JoshuaBatty JoshuaBatty added bug Something isn't working language server LSP server labels Aug 29, 2024
Copy link

Benchmark for e063831

Click to view benchmark
Test Base PR %
code_action 5.0±0.09ms 5.0±0.01ms 0.00%
code_lens 283.2±5.53ns 293.3±34.94ns +3.57%
compile 1882.8±55.97ms 1910.4±54.14ms +1.47%
completion 4.4±0.09ms 4.4±0.03ms 0.00%
did_change_with_caching 1791.0±22.22ms 1826.8±29.51ms +2.00%
document_symbol 866.7±8.58µs 903.8±17.71µs +4.28%
format 83.0±0.99ms 83.2±1.19ms +0.24%
goto_definition 336.6±3.57µs 346.3±5.48µs +2.88%
highlight 8.7±0.12ms 8.9±0.75ms +2.30%
hover 345.0±4.97µs 355.3±6.52µs +2.99%
idents_at_position 117.2±0.38µs 118.2±0.97µs +0.85%
inlay_hints 640.6±25.74µs 630.8±11.23µs -1.53%
on_enter 1936.0±38.25ns 2.1±0.13µs +8.47%
parent_decl_at_position 3.5±0.03ms 3.6±0.02ms +2.86%
prepare_rename 335.0±7.32µs 345.8±6.15µs +3.22%
rename 9.0±0.20ms 9.0±0.01ms 0.00%
semantic_tokens 1182.1±20.74µs 1211.9±12.78µs +2.52%
token_at_position 331.4±2.94µs 331.3±4.43µs -0.03%
tokens_at_position 3.5±0.04ms 3.6±0.03ms +2.86%
tokens_for_file 400.0±2.00µs 394.9±1.93µs -1.28%
traverse 33.7±0.55ms 34.0±0.71ms +0.89%

@JoshuaBatty JoshuaBatty merged commit 2b0376b into master Aug 29, 2024
39 checks passed
@JoshuaBatty JoshuaBatty deleted the josh/lsp_concurrent_slab_bug branch August 29, 2024 01:25
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working language server LSP server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LSP can crash when accessing a non existent type from the concurrent slab
3 participants