The Sway Language Server server crashed 5 times in the last 3 minutes

Sometimes sway extension doesn’t work

Smells like this comment crush it inside impl MyContract for Contract {

    /**
     * @notice Initialize a new protocol instance
     * @param config The mapping of initial/constant parameters
     */

One of errors:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Char index out of bounds: char index 1951, Rope/RopeSlice char length 1376', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/ropey-1.5.0/src/rope.rs:345:41

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

[Error - 7:18:39 PM] The Sway Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.

For more information we can get in touch on discord and I can give more feedback on how the extension works in code.

45 Likes

Hmm I could not reproduce by just adding that comment in the impl block. Do you mind providing a full contract where that issue is reproducible?

15 Likes

You can try to autoformat 5 times this file

You can fork and test this version using these commands

git clone https://github.com/sway-gang/sway-lend
cd sway lend
git checkout
git checkout fe2508784f7dc11e6878dfd83136b81cb52e2701   
code ./contracts/market/src/main.sw

and autoformat 5 times

3 Likes

Thank you. I have created a Github issue here: LSP Crashing with ` Char index out of bounds` Β· Issue #3699 Β· FuelLabs/sway Β· GitHub. The LSP team should get to it soon.

9 Likes

Thank you too!!! You are doing great things. If there’s anything else I can help with, I’m at your service.

4 Likes

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.