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

Long lines with comments crash the LSP #741

Open
bersbersbers opened this issue Feb 4, 2025 · 2 comments
Open

Long lines with comments crash the LSP #741

bersbersbers opened this issue Feb 4, 2025 · 2 comments
Labels
bug Something isn't working vscode

Comments

@bersbersbers
Copy link

Long lines that contain a comment crash the LSP for me (tamasfe.even-better-toml, 0.21.2, VS Code 1.96.4). Long lines without comments work fine, and short lines with comments also work fine.

# these work

looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong = false

short = false # looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong

# any of these fail, once commented in:

# short = false # loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong

# loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong = false # short
panicked at /Users/JounQin/Workspaces/GitHub/taplo/crates/taplo/src/formatter/mod.rs:684:25:
assertion failed: entry.comment.is_none()

Stack:

Error
    at EA.G.wbg.__wbg_new_abda76e883ba8a5f (c:\Users\bers\.vscode\extensions\tamasfe.even-better-toml-0.21.2\dist\server.js:2:4187)
    at console_error_panic_hook::Error::new::hd83448d5e1a1b88a (wasm://wasm/065ed00a:wasm-function[40242]:0x1249bc2)
    at console_error_panic_hook::hook_impl::h24434d5d3a31a46a (wasm://wasm/065ed00a:wasm-function[10411]:0xcf17fe)
    at console_error_panic_hook::hook::hb562c91cafc2c895 (wasm://wasm/065ed00a:wasm-function[59765]:0x12e59c7)
    at core::ops::function::Fn::call::h46d6beedf89bee9d (wasm://wasm/065ed00a:wasm-function[42879]:0x1275769)
    at std::panicking::rust_panic_with_hook::h8e8556df5e46d2ff (wasm://wasm/065ed00a:wasm-function[20551]:0xfc8712)
    at std::panicking::begin_panic_handler::{{closure}}::h142b9f459ded72d9 (wasm://wasm/065ed00a:wasm-function[25954]:0x10c54b9)
    at std::sys_common::backtrace::__rust_end_short_backtrace::h1c0d3278570375be (wasm://wasm/065ed00a:wasm-function[61550]:0x12e9f20)
    at rust_begin_unwind (wasm://wasm/065ed00a:wasm-function[42801]:0x12744d7)
    at core::panicking::panic_fmt::hbea4287e435ed8a3 (wasm://wasm/065ed00a:wasm-function[43645]:0x1280e86)


wasm://wasm/065ed00a:1


RuntimeError: unreachable
    at __rust_start_panic (wasm://wasm/065ed00a:wasm-function[63493]:0x12ec0f3)
    at rust_panic (wasm://wasm/065ed00a:wasm-function[56261]:0x12dbf09)
    at std::panicking::rust_panic_with_hook::h8e8556df5e46d2ff (wasm://wasm/065ed00a:wasm-function[20551]:0xfc8742)
    at std::panicking::begin_panic_handler::{{closure}}::h142b9f459ded72d9 (wasm://wasm/065ed00a:wasm-function[25954]:0x10c54b9)
    at std::sys_common::backtrace::__rust_end_short_backtrace::h1c0d3278570375be (wasm://wasm/065ed00a:wasm-function[61550]:0x12e9f20)
    at rust_begin_unwind (wasm://wasm/065ed00a:wasm-function[42801]:0x12744d7)
    at core::panicking::panic_fmt::hbea4287e435ed8a3 (wasm://wasm/065ed00a:wasm-function[43645]:0x1280e86)
    at core::panicking::panic::haa9f794b7d1c74c9 (wasm://wasm/065ed00a:wasm-function[41361]:0x125d8f9)
    at taplo::formatter::add_entries::hed6838edc1b01c33 (wasm://wasm/065ed00a:wasm-function[437]:0x3e5c50)
    at taplo::formatter::format_root::hcac06d9d442d0aa3 (wasm://wasm/065ed00a:wasm-function[256]:0x2eb0b1)

I think #734 is a duplicate, yet non-English and without clear reproduction steps, so reposting this here.

@toppk
Copy link

toppk commented Feb 13, 2025

poor workaround, but you can set the columnWidth to avoid the issue, e.g. "evenBetterToml.formatter.columnWidth": 150
`

@bersbersbers
Copy link
Author

bersbersbers commented Feb 14, 2025

set the columnWidth to avoid the issue, e.g. "evenBetterToml.formatter.columnWidth": 150 `

That's a good one. Consider also adding "evenBetterToml.formatter.arrayAutoCollapse": false so it doesn't collapse arrays onto such long lines.

@panekj panekj marked this as a duplicate of #747 Feb 14, 2025
@panekj panekj added bug Something isn't working vscode labels Feb 14, 2025
@panekj panekj marked this as a duplicate of #734 Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working vscode
Projects
None yet
Development

No branches or pull requests

3 participants