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

fix(lsp): process Fenced Code Block in JSDoc on completion correctly #23822

Merged
merged 6 commits into from
May 22, 2024

Conversation

Hajime-san
Copy link
Contributor

partially fixing #23820

expected_compressed.mp4

BTW, it is out of scope on this PR that to process type of @param to be an code block due to it's a bit complicated.

@Hajime-san
Copy link
Contributor Author

Hajime-san commented May 15, 2024

It seems to cause a regression, I'll take a look later.
https://github.com/denoland/deno/actions/runs/9090653859/job/24983822826?pr=23822

log
failures:

---- inspector::inspector_with_ts_files stdout ----
command /home/runner/work/deno/deno/target/debug/deno run --check --inspect-brk=127.0.0.1:9242 /home/runner/work/deno/deno/tests/testdata/inspector/test.ts
command cwd /home/runner/work/deno/deno/tests
STDERR: Debugger listening on ws://127.0.0.1:9242/ws/9e4419bc-7813-48ce-977f-c9cbd72056c9
STDERR: Visit chrome://inspect to connect to the debugger.
STDERR: Deno is waiting for debugger to connect.
STDERR: Check file:///home/runner/work/deno/deno/tests/testdata/inspector/test.ts
thread 'inspector::inspector_with_ts_files' panicked at tests/integration/inspector_tests.rs:913:3:
assertion `left == right` failed
  left: "\u{1b}[0m\u{1b}[32mCheck\u{1b}[0m file:///home/runner/work/deno/deno/tests/testdata/inspector/test.ts"
 right: "Debugger session started."
stack backtrace:
   0:     0xaabd4ffab15c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hece1148e1500c9a2
   1:     0xaabd4ffd3a54 - core::fmt::write::hb4e3acbf271edb44
   2:     0xaabd4ffa726c - std::io::Write::write_fmt::hb83a638df96325d6
   3:     0xaabd4ffaaf88 - std::sys_common::backtrace::print::h2b12b67a16e9135f
   4:     0xaabd4ffaccc4 - std::panicking::default_hook::{{closure}}::hf72040aae8f7970a
   5:     0xaabd4ffac934 - std::panicking::default_hook::hff2a626330bfd796
   6:     0xaabd4e2f4828 - test::test_main::{{closure}}::hd47ed5093982c2ae
   7:     0xaabd4ffad284 - std::panicking::rust_panic_with_hook::hdbe957ea7e1caf24
   8:     0xaabd4ffad000 - std::panicking::begin_panic_handler::{{closure}}::h5f3c13bf100f9a71
   9:     0xaabd4ffab62c - std::sys_common::backtrace::__rust_end_short_backtrace::hd8a0426804ef2ca9
  10:     0xaabd4ffacda0 - rust_begin_unwind
  11:     0xaabd4d896d04 - core::panicking::panic_fmt::heae5498d3da202ba
  12:     0xaabd4d8970bc - core::panicking::assert_failed_inner::h5c70987ee849eb03
  13:     0xaabd4dfd99d8 - core::panicking::assert_failed::he8a574d8edadf44c
  14:     0xaabd4e2353e0 - integration_tests::inspector::inspector_with_ts_files::{{closure}}::h4b92206ac71e0183
  15:     0xaabd4e290c90 - <core::pin::Pin<P> as core::future::future::Future>::poll::h2c1ad40b62381778
  16:     0xaabd4e2913cc - <core::pin::Pin<P> as core::future::future::Future>::poll::he52c61f3d6386b7f
  17:     0xaabd4df40370 - tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}::{{closure}}::{{closure}}::h33ca5d4091e832fb
  18:     0xaabd4df401cc - tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}::{{closure}}::hfef41328b6b1461e
  19:     0xaabd4df1ecf0 - tokio::runtime::scheduler::current_thread::Context::enter::h4322677e67ef5906
  20:     0xaabd4df3817c - tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}::haee595b67993728f
  21:     0xaabd4df2fa24 - tokio::runtime::scheduler::current_thread::CoreGuard::enter::{{closure}}::h0bb58a5238f5f674
  22:     0xaabd4e081e50 - tokio::runtime::context::scoped::Scoped<T>::set::ha0d51b81ebbe0871
  23:     0xaabd4e1f7878 - tokio::runtime::context::set_scheduler::{{closure}}::h58ef10c0af114fd7
  24:     0xaabd4df706dc - std::thread::local::LocalKey<T>::try_with::hdcd5e1ca3817ad2b
  25:     0xaabd4df58d90 - std::thread::local::LocalKey<T>::with::h1da8dfcd4080de9a
  26:     0xaabd4e1f7100 - tokio::runtime::context::set_scheduler::h7271ab9213e90ebd
  27:     0xaabd4df2d988 - tokio::runtime::scheduler::current_thread::CoreGuard::enter::h92c0606b7edcabb5
  28:     0xaabd4df30a38 - tokio::runtime::scheduler::current_thread::CoreGuard::block_on::ha62fc345b3708c21
  29:     0xaabd4df16e9c - tokio::runtime::scheduler::current_thread::CurrentThread::block_on::{{closure}}::hb4a4ef052f66c00e
  30:     0xaabd4ded8fbc - tokio::runtime::context::runtime::enter_runtime::h0678d44a5627e5ac
  31:     0xaabd4df11cac - tokio::runtime::scheduler::current_thread::CurrentThread::block_on::hb0cddffbba596dfb
  32:     0xaabd4df10d0c - tokio::runtime::runtime::Runtime::block_on::hf6a90b49cb72cbb7
  33:     0xaabd4e234bf8 - integration_tests::inspector::inspector_with_ts_files::h4e56df67a650964f
  34:     0xaabd4e234b04 - integration_tests::inspector::inspector_with_ts_files::{{closure}}::h4145d1e8bedef43e
  35:     0xaabd4de65510 - core::ops::function::FnOnce::call_once::h9996c0bbe2e96c92
  36:     0xaabd4e2f8f7c - test::__rust_begin_short_backtrace::hbd62e6cb9b9e1726
  37:     0xaabd4e2f8184 - test::run_test::{{closure}}::ha79628f5f47a4e0f
  38:     0xaabd4e2ca264 - std::sys_common::backtrace::__rust_begin_short_backtrace::h0c5ebfb7a6fdb3c6
  39:     0xaabd4e2cebf0 - core::ops::function::FnOnce::call_once{{vtable.shim}}::ha4571d8d874c7402
  40:     0xaabd4ffb2798 - std::sys::pal::unix::thread::Thread::new::thread_start::h1a4b48df802ee0a8
  41:     0xff7b9be4d5c8 - <unknown>
  42:     0xff7b9beb5edc - <unknown>
  43:                0x0 - <unknown>

---- lsp::lsp_completions stdout ----
thread 'lsp::lsp_completions' panicked at tests/integration/lsp_tests.rs:6715:3:
assertion failed: `(left == right)`

Diff < left / right > :
 Object {
     "label": String("build"),
     "kind": Number(6),
     "detail": String("const Deno.build: {\n    target: string;\n    arch: \"x86_64\" | \"aarch64\";\n    os: \"darwin\" | \"linux\" | \"android\" | \"windows\" | \"freebsd\" | \"netbsd\" | \"aix\" | \"solaris\" | \"illumos\";\n    vendor: string;\n    env?: string | undefined;\n}"),
     "documentation": Object {
         "kind": String("markdown"),
<        "value": String("\n\n*@category* - Runtime"),
>        "value": String("Information related to the build of the current Deno runtime.\n\nUsers are discouraged from code branching based on this information, as\nassumptions about what is available in what build environment might change\nover time. Developers should specifically sniff out the features they\nintend to use.\n\nThe intended use for the information is for logging and debugging purposes.\n\n*@category* - Runtime"),
     },
     "sortText": String("1"),
     "insertTextFormat": Number(1),
 }


stack backtrace:
   0:     0xaabd4ffab15c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hece1148e1500c9a2
   1:     0xaabd4ffd3a54 - core::fmt::write::hb4e3acbf271edb44
   2:     0xaabd4ffa726c - std::io::Write::write_fmt::hb83a638df96325d6
   3:     0xaabd4ffaaf88 - std::sys_common::backtrace::print::h2b12b67a16e9135f
   4:     0xaabd4ffaccc4 - std::panicking::default_hook::{{closure}}::hf72040aae8f7970a
   5:     0xaabd4ffac934 - std::panicking::default_hook::hff2a626330bfd796
   6:     0xaabd4e2f4828 - test::test_main::{{closure}}::hd47ed5093982c2ae
   7:     0xaabd4ffad284 - std::panicking::rust_panic_with_hook::hdbe957ea7e1caf24
   8:     0xaabd4ffad000 - std::panicking::begin_panic_handler::{{closure}}::h5f3c13bf100f9a71
   9:     0xaabd4ffab62c - std::sys_common::backtrace::__rust_end_short_backtrace::hd8a0426804ef2ca9
  10:     0xaabd4ffacda0 - rust_begin_unwind
  11:     0xaabd4d896d04 - core::panicking::panic_fmt::heae5498d3da202ba
  12:     0xaabd4dc49b08 - integration_tests::lsp::lsp_completions::hfdd9cc45d286f9c1
  13:     0xaabd4dc473e0 - integration_tests::lsp::lsp_completions::{{closure}}::h39715ee21ce2987d
  14:     0xaabd4de61d24 - core::ops::function::FnOnce::call_once::h72ae31eb92664dfc
  15:     0xaabd4e2f8f7c - test::__rust_begin_short_backtrace::hbd62e6cb9b9e1726
  16:     0xaabd4e2f8184 - test::run_test::{{closure}}::ha79628f5f47a4e0f
  17:     0xaabd4e2ca264 - std::sys_common::backtrace::__rust_begin_short_backtrace::h0c5ebfb7a6fdb3c6
  18:     0xaabd4e2cebf0 - core::ops::function::FnOnce::call_once{{vtable.shim}}::ha4571d8d874c7402
  19:     0xaabd4ffb2798 - std::sys::pal::unix::thread::Thread::new::thread_start::h1a4b48df802ee0a8
  20:     0xff7b9be4d5c8 - <unknown>
  21:     0xff7b9beb5edc - <unknown>
  22:                0x0 - <unknown>

---- lsp::lsp_completions_complete_function_calls stdout ----
thread 'lsp::lsp_completions_complete_function_calls' panicked at tests/integration/lsp_tests.rs:9961:3:
assertion failed: `(left == right)`

Diff < left / right > :
 Object {
     "label": String("map"),
     "kind": Number(2),
     "detail": String("(method) Array<never>.map<U>(callbackfn: (value: never, index: number, array: never[]) => U, thisArg?: any): U[]"),
     "documentation": Object {
         "kind": String("markdown"),
<        "value": String("\n\n*@param* - callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.  \n\n*@param* - thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value."),
>        "value": String("Calls a defined callback function on each element of an array, and returns an array that contains the results.\n\n*@param* - callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.*@param* - thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value."),
     },
     "sortText": String("1"),
     "insertText": String("map(${1:callbackfn})"),
     "insertTextFormat": Number(2),
 }


stack backtrace:
   0:     0xaabd4ffab15c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hece1148e1500c9a2
   1:     0xaabd4ffd3a54 - core::fmt::write::hb4e3acbf271edb44
   2:     0xaabd4ffa726c - std::io::Write::write_fmt::hb83a638df96325d6
   3:     0xaabd4ffaaf88 - std::sys_common::backtrace::print::h2b12b67a16e9135f
   4:     0xaabd4ffaccc4 - std::panicking::default_hook::{{closure}}::hf72040aae8f7970a
   5:     0xaabd4ffac934 - std::panicking::default_hook::hff2a626330bfd796
   6:     0xaabd4e2f4828 - test::test_main::{{closure}}::hd47ed5093982c2ae
   7:     0xaabd4ffad284 - std::panicking::rust_panic_with_hook::hdbe957ea7e1caf24
   8:     0xaabd4ffad000 - std::panicking::begin_panic_handler::{{closure}}::h5f3c13bf100f9a71
   9:     0xaabd4ffab62c - std::sys_common::backtrace::__rust_end_short_backtrace::hd8a0426804ef2ca9
  10:     0xaabd4ffacda0 - rust_begin_unwind
  11:     0xaabd4d896d04 - core::panicking::panic_fmt::heae5498d3da202ba
  12:     0xaabd4dce8bd4 - integration_tests::lsp::lsp_completions_complete_function_calls::h3e5f640093a754ee
  13:     0xaabd4dce5e8c - integration_tests::lsp::lsp_completions_complete_function_calls::{{closure}}::h42a726c1ac556145
  14:     0xaabd4de62d04 - core::ops::function::FnOnce::call_once::h7d6afff6dec64046
  15:     0xaabd4e2f8f7c - test::__rust_begin_short_backtrace::hbd62e6cb9b9e1726
  16:     0xaabd4e2f8184 - test::run_test::{{closure}}::ha79628f5f47a4e0f
  17:     0xaabd4e2ca264 - std::sys_common::backtrace::__rust_begin_short_backtrace::h0c5ebfb7a6fdb3c6
  18:     0xaabd4e2cebf0 - core::ops::function::FnOnce::call_once{{vtable.shim}}::ha4571d8d874c7402
  19:     0xaabd4ffb2798 - std::sys::pal::unix::thread::Thread::new::thread_start::h1a4b48df802ee0a8
  20:     0xff7b9be4d5c8 - <unknown>
  21:     0xff7b9beb5edc - <unknown>
  22:                0x0 - <unknown>


failures:
    inspector::inspector_with_ts_files
    lsp::lsp_completions
    lsp::lsp_completions_complete_function_calls

test result: FAILED. 1446 passed; 3 failed; 12 ignored; 0 measured; 0 filtered out; finished in 87.59s

error: test failed, to rerun pass `-p cli_tests --test integration_tests`
error: test failed, to rerun pass `-p deno --test integration`
Error: Process completed with exit code 101.

Copy link
Member

@nathanwhit nathanwhit left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for fixing this!

@nathanwhit nathanwhit merged commit cbddf46 into denoland:main May 22, 2024
17 checks passed
@Hajime-san Hajime-san deleted the fix-lsp-jsdoc branch May 23, 2024 02:45
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

2 participants