Bug 437012 - LSP function autocompletion gets in the way for Haskell
Summary: LSP function autocompletion gets in the way for Haskell
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: Git
Platform: Other All
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-13 07:04 UTC by Gleb Popov
Modified: 2021-06-01 19:13 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 21.08.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gleb Popov 2021-05-13 07:04:52 UTC
The following MR

https://invent.kde.org/utilities/kate/-/merge_requests/342#note_211353

introduced adding "()" after completing an item of function kind.

In Haskell even things like "x = 1" are basically 0-ary functions and are reported as such by Haskell LSP. Consequently, Kate places "()" for every completion I select, which in turn produce invalid Haskell syntax.

Maybe this feature could be an option?
Comment 1 Alois Wohlschlager 2021-05-15 14:16:00 UTC
Can't reproduce this with the OCaml language server.
Comment 2 Christoph Cullmann 2021-05-22 17:32:02 UTC
Hmm, valid issue.

Waqar, what do you think?
Perhaps it would make sense to have this turned on/off via some entry in the LSP JSON file?
Then one could turn this on just for languages that actually want () for function calls.
Or perhaps there is even a nicer solution.
Comment 3 Gleb Popov 2021-05-22 18:11:00 UTC
I believe, it should be an option in the "Settings" UI of the "LSP" plugin. As for JSON option, I don't mind.
Comment 4 Christoph Cullmann 2021-05-22 18:13:21 UTC
(In reply to Gleb Popov from comment #3)
> I believe, it should be an option in the "Settings" UI of the "LSP" plugin.
> As for JSON option, I don't mind.

Hmm, I don't think a option in the settings UI would not be that useful, given many people work with multiple languages, it will still be wrong for some then.

We can already configure this "correctly" for the pre-shipped LSP stuff and people can then fine tune it for their own servers.
Comment 5 Gleb Popov 2021-05-22 18:15:58 UTC
All right, if you think so, I'm fine with JSON option too.
Comment 6 Waqar Ahmed 2021-05-22 21:43:58 UTC
The problem with this whole thing is that it is completely wrong even though it is helpful sometimes. It can be a pain with C/C++ easily, consider:

- &Class::PtrToFunc

One can introduce a new Json option but I think it is not the right solution. We need to reverse this and come up with a better way, something that utilizes the lsp info automatically to decide whether inserting brackets makes sense or not.
Comment 7 Christoph Cullmann 2021-05-22 21:49:49 UTC
Reverting the change is fine for me, too.
Comment 8 Christoph Cullmann 2021-06-01 19:13:24 UTC
Should be fixed for 21.08

https://invent.kde.org/utilities/kate/-/commit/f82159c82ed3ca90117304079a5515f5374091f7