Bug 452078 - Make it easier to modify default LSP config
Summary: Make it easier to modify default LSP config
Status: RESOLVED WORKSFORME
Alias: None
Product: kate
Classification: Applications
Component: general (other bugs)
Version First Reported In: Git
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-30 14:56 UTC by Nicolas Fella
Modified: 2023-02-26 20:18 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Fella 2022-03-30 14:56:00 UTC
Currently when I want to make a minor adjustment to the default LSP config, e.g. add an additional arg to clangd I have to copy the default config, modify it, save the file somewhere and load it. 

It would be cool if I could just press some "Edit" button, type my modifications and apply without worrying about where to save the resulting file
Comment 1 Waqar Ahmed 2022-03-30 15:10:01 UTC
Are you talking about the `.clangd` file or the config under "User Server Settings"?
Comment 2 Nicolas Fella 2022-03-30 22:16:39 UTC
The config under "User Server Settings"
Comment 3 Waqar Ahmed 2022-03-31 06:17:00 UTC
"User Server Settings" are directly modifiable in the config tab and you don't need to save it somewhere else. But maybe I misunderstand you?

Anyways, maybe you can tell the arguments that you add to clangd, maybe there is an alternative solution to that since clangd has a limited number of arguments most of which are something that you set only need to be set once.
Comment 4 Nicolas Fella 2022-03-31 11:56:57 UTC
Okay, I just found out I can copy/paste the settings from the default settings tab to the user settings tab and save.

Maybe it would make sense to merge the "User Server Settings" and "Default Server Settings" tabs so that the default settings are directly editable and have a "Reset to defaults" button?

In particular I wanted to add "-header-insertion=never" to clangd since it usually doesn't insert the header I want (e.g. it includes "qvector.h" instead of <QVector>)
Comment 5 Christoph Cullmann 2022-03-31 12:02:20 UTC
I don't think having just one field is a good idea, as you can e.g. just add new servers in the local field and that will not alter the settings we ship. If there is just one field, how to show that?

e.g. I do in most cases just add a new server in my field there, but I don't want to fixate the other settings to the state of my first configuration.
Comment 6 Waqar Ahmed 2022-03-31 12:12:55 UTC
There is a setting for that: "Configure Kate... -> LSP -> Add imports automatically upon completion". With Qt it doesn't work well atm but will get a lot better with clang 14 hopefully.


> ... "User Server Settings" and "Default Server Settings" tabs so that the default settings are directly editable and have a "Reset to defaults" button?

The current style is more like vscode/sublime where you have an immutable default setting file and user one.

Also, if you need to change only one property of the server (for e.g., initializationOptions), then specifying that is enough. The plugin merges User and Default config automatically.
Comment 7 Christoph Cullmann 2022-06-16 16:27:11 UTC
I think the current state is not that bad, you don't need to copy stuff you don't need, just the differences.
Naturally it might make sense to have a better UI for this than raw JSON, but I don't see how that is easy to achieve.
Comment 8 Christoph Cullmann 2023-02-26 20:18:32 UTC
I think the current json merging is ok as is.
I fail to see some realistic way to improve that.
Naturally if somebody shows up with some merge request to prove me wrong one can reconsider.