Long lines with comments crash the LSP
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.
poor workaround, but you can set the columnWidth to avoid the issue, e.g. "evenBetterToml.formatter.columnWidth": 150
`
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.
I bumped into this bug with this TOML file:
Toggle to see the file
[profile.default]
auto_detect_solc = false
bytecode_hash = "none"
evm_version = "shanghai" # needed for greater coverage of EVM chains
fs_permissions = [{ access = "read", path = "package.json" }]
gas_limit = 9223372036854775807
optimizer = true
optimizer_runs = 100_000_000
out = "out"
script = "scripts/solidity"
sender = "0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38"
solc = "0.8.29"
src = "src"
test = "tests"
[profile.default.fuzz]
max_test_rejects = 1_000_000 # Number of times `vm.assume` can fail
runs = 1000
[profile.default.invariant]
call_override = false # Override unsafe external calls to perform reentrancy checks
depth = 20 # Number of calls executed in one run
fail_on_revert = true
runs = 20
# Speed up compilation and tests during development
[profile.lite]
fuzz.runs = 50
# Compile only the production code and the test mocks with via IR
[profile.optimized]
out = "out-optimized"
test = "tests/mocks"
via_ir = true
# See "SMTChecker and Formal Verification" in the Solidity docs
[profile.smt]
ignored_error_codes = [
7737, # Disable inline assembly warnings
]
out = "out-optimized"
script = "src"
test = "src"
via_ir = true
[profile.smt.model_checker]
engine = "chc" # constrained Horn clauses
invariants = ["contract", "reentrancy"]
show_proved_safe = true
show_unproved = true
show_unsupported = true
timeout = 100_000 # in milliseconds, per solving query
targets = ["assert", "constantCondition", "divByZero", "outOfBounds", "overflow", "underflow"]
# Test the optimized contracts without re-compiling them
[profile.test-optimized]
src = "tests"
[doc]
ignore = ["**/*.t.sol"]
out = "docs"
repository = "https://github.com/sablier-labs/airdrops"
[etherscan]
etherscan = { key = "${ETHERSCAN_API_KEY}" }
[fmt]
bracket_spacing = true
int_types = "long"
line_length = 120
multiline_func_header = "all"
number_underscore = "thousands"
quote_style = "double"
tab_width = 4
wrap_comments = true
[rpc_endpoints]
# mainnets
arbitrum = "https://arbitrum-mainnet.infura.io/v3/${API_KEY_INFURA}"
avalanche = "https://avalanche-mainnet.infura.io/v3/${API_KEY_INFURA}"
base = "https://mainnet.base.org"
berachain = "https://rpc.berachain.com"
blast = "https://rpc.blast.io"
bnb = "https://bsc-mainnet.infura.io/v3/${API_KEY_INFURA}"
chiliz = "https://rpc.chiliz.com"
core_dao = "https://rpc.coredao.org"
form = "https://rpc.form.network/http"
gnosis = "https://rpc.gnosischain.com"
lightlink = "https://replicator.phoenix.lightlink.io/rpc/v1"
linea = "https://rpc.linea.build"
mainnet = "https://mainnet.infura.io/v3/${API_KEY_INFURA}"
meld = "https://rpc-1.meld.com"
mode = "https://mainnet.mode.network/"
morph = "https://rpc.morphl2.io"
optimism = "https://optimism-mainnet.infura.io/v3/${API_KEY_INFURA}"
polygon = "https://polygon-mainnet.infura.io/v3/${API_KEY_INFURA}"
scroll = "https://rpc.scroll.io/"
sei = "https://evm-rpc.sei-apis.com"
superseed = "https://mainnet.superseed.xyz"
taiko_mainnet = "https://rpc.mainnet.taiko.xyz"
xdc = "https://rpc.xdc.org"
# testnets
arbitrum_sepolia = "https://arbitrum-sepolia-rpc.publicnode.com"
base_sepolia = "https://sepolia.base.org"
berachain_artio = "https://bartio.rpc.berachain.com/"
blast_sepolia = "https://sepolia.blast.io"
linea_sepolia = "https://rpc.sepolia.linea.build"
localhost = "http://localhost:8545"
mode_sepolia = "https://sepolia.mode.network/"
monat_testnet = "https://testnet-rpc.monad.xyz"
morph_holesky = "https://rpc-holesky.morphl2.io"
optimism_sepolia = "https://sepolia.optimism.io"
sei_testnet = "https://evm-rpc.arctic-1.seinetwork.io"
sepolia = "https://sepolia.infura.io/v3/${API_KEY_INFURA}"
superseed_sepolia = "https://sepolia.superseed.xyz"
taiko_hekla = "https://rpc.hekla.taiko.xyz"
I bumped into this bug with this TOML file:
Sure. Would you suggest everyone who bumps into this bug also post their files here, @PaulRBerg ? 😉
I was not suggesting that.
I am sorry if you found my comment unhelpful. Happy to delete it, or let you (or a contributor) hide our comments.
It's fine now, but I would like if issues didn't devolve into series of comments "I have same issue" and/or "Here's file that breaks for me too" if the issue can be easily reproduced.