Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't restart servers when userprefs change #2448

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

jwortmann
Copy link
Member

Currently, all language servers are restarted whenever the user settings in LSP.sublime-settings are saved. This is not really necessary, so with this PR they are only restarted if the "clients" setting (containing the server configs) is actually modified.

Note that not all UI features are immediately redrawn when the user settings change. For example if you change "diagnostics_gutter_marker", it still uses the old icons until new diagnostics arrive (usually after next buffer modification). That is because the icon is stored directly in the DiagrosticSeverityData object

LSP/plugin/core/views.py

Lines 68 to 78 in 5891ff4

class DiagnosticSeverityData:
__slots__ = ('regions', 'regions_with_tag', 'annotations', 'scope', 'icon')
def __init__(self, severity: int) -> None:
self.regions = [] # type: List[sublime.Region]
self.regions_with_tag = {} # type: Dict[int, List[sublime.Region]]
self.annotations = [] # type: List[str]
_, _, self.scope, self.icon, _, _ = DIAGNOSTIC_SEVERITY[severity - 1]
if userprefs().diagnostics_gutter_marker != "sign":
self.icon = "" if severity == DiagnosticSeverity.Hint else userprefs().diagnostics_gutter_marker

which was maybe not the optimal design choice, but I didn't want to do huge refactorings here.

Or for example if inlay hints get enabled/disabled, they are only added or cleared after the next buffer modification, but I think that should be okay.

@predragnikolic
Copy link
Member

I have not tested this,
but based on the code that I see

Previously,
if someone modified server settings,
because LSP restarts the server on setting change,
the server would pick it up the new changes once started again.

Now in this PR,
LSP will not restart the server, when we change server settings,
thus the server will not pick up new setting changes.

In order to address this,
the server would now need to be notified with didChangeConfiguration.


related to
#2044

@jwortmann
Copy link
Member Author

The server settings are part of the "clients" setting, so if they are modified, servers are still restarted.

didChangeConfiguration would need to be implemented separately.

This PR is only for the userprefs, i.e. UI settings and other LSP settings. It is not directly related to #2044.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants