LuaLS / lua-language-server

A language server that offers Lua language support - programmed in Lua
https://luals.github.io
MIT License
3.26k stars 306 forks source link

Disable automatic insertion of "---@" on Enter #2861

Open swajj opened 3 hours ago

swajj commented 3 hours ago

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows

What is the issue affecting?

Annotations, Completion, Formatting

Expected Behaviour

When I hit Enter at the end of a class/parameter/etc. annotation, I get a new blank line.

Actual Behaviour

When I type an annotation and hit Enter, I get ---@ automatically inserted.

Reproduction steps

  1. Type ---@class test
  2. Press Enter

Additional Notes

I know this is an "intentional feature", but I would like a way to disable it. There is no setting that disables this (and only this) - turning "Editor: Auto Indent" to 'brackets' or lower disables this unwanted behavior, but then I lose auto-indent.

See https://github.com/LuaLS/lua-language-server/discussions/2786

Log File

No response

swajj commented 3 hours ago

I could also work with something like immediately pressing enter on the lone ---@ causes it to revert to a blank line.

CppCXY commented 1 hour ago

I think a better approach would be to provide ---@ completion options after pressing Enter, rather than directly adding ---@.

swajj commented 1 hour ago

yes, having the auto complete suggest ---@ prefixed options on a blank line would be great as long as it didnt trigger on every blank line :)

On Thu, Sep 19, 2024, 7:01 PM CppCXY @.***> wrote:

I think a better approach would be to provide ---@ completion options after pressing Enter, rather than directly adding @.***

— Reply to this email directly, view it on GitHub https://github.com/LuaLS/lua-language-server/issues/2861#issuecomment-2362559601, or unsubscribe https://github.com/notifications/unsubscribe-auth/A7X76MRPR2WGSVDNUUB7RU3ZXN6Y7AVCNFSM6AAAAABOQ6MPF6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRSGU2TSNRQGE . You are receiving this because you authored the thread.Message ID: @.***>