Bug 458401 - LSP Client global settings for fortran persist after repo LSP package purge
Summary: LSP Client global settings for fortran persist after repo LSP package purge
Status: RESOLVED NOT A BUG
Alias: None
Product: kate
Classification: Applications
Component: part (show other bugs)
Version: 20.12.2
Platform: Debian stable Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-27 19:28 UTC by zbinkz
Modified: 2022-08-28 09:19 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zbinkz 2022-08-27 19:28:13 UTC
SUMMARY
Fortran LSP global settings from official repo persist in LSP Plugin after purging LSP package from system. It is impossible to modify or override them. This makes it impossible to use a newer version of the Fortran language server installed locally with its own settings in `.local` and `.config/kate`.


STEPS TO REPRODUCE
1. Install `fortran-language-server` from official repo
2. Start `Kate`
3. Activate LSP Plugin
4. Close `Kate`
5. Purge `fortran-language-server`
6. Restart `Kate`

OBSERVED RESULT
Fortran LSP global settings of `fortran-language-server` are still displayed.

EXPECTED RESULT
Fortran LSP global settings of `fortran-language-server`  should be removed or editable.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Debian Bullseye 11.4
(available in About System)
KDE Plasma Version: 5.20.5
KDE Frameworks Version: 5.78.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Comment 1 Christoph Cullmann 2022-08-27 20:21:09 UTC
I must confess I fail a bit to understand the issue.

You can edit the settings for the servers as JSON in the Kate config dialog.
You can remove the accept/reject start decision settings there, too.

Which other settings persists there?
Comment 2 zbinkz 2022-08-27 20:41:50 UTC
(In reply to Christoph Cullmann from comment #1)
> I must confess I fail a bit to understand the issue.
> 
> You can edit the settings for the servers as JSON in the Kate config dialog.
> You can remove the accept/reject start decision settings there, too.
> 
> Which other settings persists there?

The Kate config dialog provides the `User Server Settings` tab to add user settings. The global settings in the `Default Server Settings` tab cannot be edited and I cannot find the JSON settings file anywhere in the package files (is there one?).

Even when you add user settings, the global settings of the Debian repo package persist.
Comment 3 Christoph Cullmann 2022-08-27 21:10:06 UTC
(In reply to zbinkz from comment #2)
> (In reply to Christoph Cullmann from comment #1)
> > I must confess I fail a bit to understand the issue.
> > 
> > You can edit the settings for the servers as JSON in the Kate config dialog.
> > You can remove the accept/reject start decision settings there, too.
> > 
> > Which other settings persists there?
> 
> The Kate config dialog provides the `User Server Settings` tab to add user
> settings. The global settings in the `Default Server Settings` tab cannot be
> edited and I cannot find the JSON settings file anywhere in the package
> files (is there one?).
> 
> Even when you add user settings, the global settings of the Debian repo
> package persist.

If you want to overwrite global settings, just copy the Fortran part of the JSON description to the local config.
Each entry you have there will overwrite the global defaults.
Comment 4 zbinkz 2022-08-27 21:14:41 UTC
(In reply to Christoph Cullmann from comment #3)
> 
> If you want to overwrite global settings, just copy the Fortran part of the
> JSON description to the local config.
> Each entry you have there will overwrite the global defaults.

That's precisely the point. I did copy the Fortran part to the local config and adapted to my needs, but the global config settings persist even though the Debian repo package fortran-language-server to which the global settings refer has been purged.
Comment 5 Christoph Cullmann 2022-08-27 21:21:47 UTC
Could you paste here what you added to the "User Server Settings" tab?
Comment 6 zbinkz 2022-08-27 21:33:37 UTC
(In reply to Christoph Cullmann from comment #5)
> Could you paste here what you added to the "User Server Settings" tab?

User Server Settings:
{
    "servers": {
        "fortran": {
            "command": ["/home/zbinkz/.local/bin/fortls"],
            "rootIndicationFileNames": [".fortls"],
            "url": "https://github.com/gnikit/fortls",
            "highlightingModeRegex": "^Fortran.*$"
        }
    }
}

Default Server Settings (extracted Fortran part):
        "fortran": {
            "command": ["fortls"],
            "rootIndicationFileNames": [".fortls"],
            "url": "https://github.com/hansec/fortran-language-server",
            "highlightingModeRegex": "^Fortran.*$"
        }
Comment 7 Christoph Cullmann 2022-08-27 21:38:08 UTC
On the first glance that looks fine for me.
But I assume it still launches the normal fortls?
Comment 8 zbinkz 2022-08-27 22:27:26 UTC
(In reply to Christoph Cullmann from comment #7)
> On the first glance that looks fine for me.
> But I assume it still launches the normal fortls?

The only fortls installed is the one from pip, in /home/zbinkz/.local/bin/fortls. Running `which fortls` in konsole returns `/home/zbinkz/.local/bin/fortls`, so I would say that is the one that launches. The other one from Debian repo is not even installed.
Comment 9 Waqar Ahmed 2022-08-27 22:29:19 UTC
Trying to understand a bit. What are you expecting?

Do you expect that the default server setting for Fortran should be removed if you purged the fortls package? Or something else?
Comment 10 Waqar Ahmed 2022-08-27 22:36:04 UTC
The "default server settings" are not editable and will be there regardless of whatever package you have installed. For example, you might not have clangd installed but the setting is there.

We do not allow editing default servers, but we allow overriding it. This is intentional and will not change as it's kind of a fallback.
Comment 11 Waqar Ahmed 2022-08-27 22:38:05 UTC
Also, the default servers json is baked into kate, so you will not find any json file for it. If someone needs to change something, it can be overridden in the Local Config.
Comment 12 zbinkz 2022-08-27 22:51:11 UTC
(In reply to Waqar Ahmed from comment #11)
> Also, the default servers json is baked into kate, so you will not find any
> json file for it. If someone needs to change something, it can be overridden
> in the Local Config.

The default server settings for Fortran appeared in the LSP Client when I first installed fortran-language-server package from Debian repos. They were not there before and I expect them to be removed when I purge fortran-language-server package. I also expect the user settings to override the global ones. None of these two expectations happen.

I noticed that when after purging the repo package and installing a newer version from pip. The LSP Client still parsed my entire home for fortan code, which is a setting from the Debian repo version, implemented in LSP client global settings. I managed to override with a local .fortls file in the project folder, but that's not how it is meant to work.
Comment 13 Waqar Ahmed 2022-08-27 23:20:18 UTC
The only explanation I have for the first one is that you probably missed to see it before. We *hardcode* that json file in Kate. It never gets updated ever. And as mentioned already, this is intentional. 

For the second, please refer to https://gnikit.github.io/fortls/options.html and https://gnikit.github.io/fortls/editor_integration.html#editor-integration for providing a better command line than our default setting so that your home dir is not parser. It parsing your home directory is not a Kate problem. The lspclient plugin in Kate just reads data from the server and presents it to you. 

If you come up with better cmd line options, we can change our default config to use that instead.
Comment 14 zbinkz 2022-08-27 23:49:11 UTC
(In reply to Waqar Ahmed from comment #13)
> The only explanation I have for the first one is that you probably missed to
> see it before. We *hardcode* that json file in Kate. It never gets updated
> ever. And as mentioned already, this is intentional. 
> 
> For the second, please refer to https://gnikit.github.io/fortls/options.html
> and
> https://gnikit.github.io/fortls/editor_integration.html#editor-integration
> for providing a better command line than our default setting so that your
> home dir is not parser. It parsing your home directory is not a Kate
> problem. The lspclient plugin in Kate just reads data from the server and
> presents it to you. 
> 
> If you come up with better cmd line options, we can change our default
> config to use that instead.

Last week when I loaded a fortran code in Kate, for the first time in 10+ years, I got no completions whatsoever. I went to the LSP Client settings looking for fortran and there was nothing. After some searching I installed the repo package fortran-language-server and the fortran options appeared. They were not there before and I remember all that vividly!

And yet again, the user settings do NOT override the global settings unless I do manual change to fortls in the project folder outside of Kate scope. I am already aware of the info contained in the links you provided because this is where I found the fix.

I don't have a problem with investigating this further on my own, but it will take time cause I'm not familiar with Kate inner code. Until then the bug report should remain open. Don't you think?
Comment 15 Christoph Cullmann 2022-08-28 09:19:33 UTC
That global settings are hard backed into our tool.
That is even compiled into the library as a resource.
No external package can alter this.

We did not always have Fortran support, perhaps you did update the Kate package.
But beside a Kate package update, nothing will change that.

> I don't have a problem with investigating this further on my own, but it will take time cause I'm not familiar with Kate inner code. Until then the bug report should remain open. Don't you think?

There is nothing to investigate, this is a json file we bundle as resource inside the lspplugin .so file.
Please trust us there.

As "proof", here is the Qt resource file that will bundle it

https://invent.kde.org/utilities/kate/-/blob/master/addons/lspclient/plugin.qrc