zls icon indicating copy to clipboard operation
zls copied to clipboard

Feature Request: Add auto semicolon completion

Open Ulrich-Tonmoy opened this issue 2 years ago • 6 comments

Since zls already auto format the unused variable and for semicolon it exactly gives the correct message in which column semicolon is missing so auto completing this would be a better experience as i am a JS dev so most of the time i forgot to add semicolon and the prettier formatter auto complete that. I guess it would be a great feature.

and

instead of this

const verices = [_]f32{
        -0.5, -0.5, 0,
        0.5,  -0.5, 0,
        0,    0.5,  0,
    };

this would be better

const verices = [_]f32{
        -0.5, -0.5, 0,
         0.5, -0.5, 0,
         0,    0.5, 0,
    };

Ulrich-Tonmoy avatar Sep 27 '23 12:09 Ulrich-Tonmoy

zls just uses zig fmt, it doesn't control formatting, so the second idea isn't relevant here

InKryption avatar Sep 27 '23 12:09 InKryption

It would be doable using TextEdits like we do for autofix, though. I can try hacking this right now if you'd like to see how the UX feels - I have a suspicion it'll be pretty bad but you never know :)

SuperAuguste avatar Sep 27 '23 12:09 SuperAuguste

@Ulrich-Tonmoy please let me know if the linked PR is to your liking. You can check out the branch (auguste/add-semicolon-autoinsert), then build ZLS locally and point your editor to zls_repo_path/zig-out/bin/zls and then mess around with it :)

SuperAuguste avatar Sep 27 '23 14:09 SuperAuguste

zls just uses zig fmt, it doesn't control formatting, so the second idea isn't relevant here

i guess then i will just have to add +before these 😂

Ulrich-Tonmoy avatar Sep 27 '23 15:09 Ulrich-Tonmoy

auguste

Yep just perfect 😇

Ulrich-Tonmoy avatar Sep 27 '23 16:09 Ulrich-Tonmoy

FYI: Zig has an open proposal for changes to alignment in zig fmt https://github.com/ziglang/zig/issues/17145

Techatrix avatar Sep 27 '23 19:09 Techatrix