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

Various refactorings #2366

Merged
merged 6 commits into from
Dec 1, 2023
Merged

Various refactorings #2366

merged 6 commits into from
Dec 1, 2023

Conversation

jwortmann
Copy link
Member

@jwortmann jwortmann commented Nov 18, 2023

These are a bunch of minor refactorings that I wanted to do. Most of it just moves some code to other places where it makes more sense, but there are no functional changes. See the individual commits for details.

Everything touched by this PR should just be internal functions and constants, so I believe it should be safe to do. At some time the public API for LSP-* packages in LSP/plugin/__init__.py should probably be revised and extended, because various packages already import utility functions directly from LSP/plugin/core/views.py.

To be released together with:

@jwortmann
Copy link
Member Author

Oh wow, I didn't know that you used the TreeView somewhere else. That is cool.

The reason I initially put new_tree_view_sheet into core/registry.py was only to avoid cyclic imports which I didn't know how to fix differently at that time. But I think it would be cleaner code now with the TYPE_CHECKING approach that I used in this PR, and then we could just update the import in LSP-volar?

And I could do a PR to update the imports in LSP-jdtls with the next LSP release. I guess that would be easier than to leave behind some aliases to those constants in views.py for backwards compatibility.

@rchl
Copy link
Member

rchl commented Nov 18, 2023

Yeah, new paths are nicer. Only that we should make sure to update those and do a synced release.

plugin/hover.py Outdated Show resolved Hide resolved
@rchl
Copy link
Member

rchl commented Nov 27, 2023

Created sublimelsp/LSP-volar#212

@rchl
Copy link
Member

rchl commented Nov 27, 2023

Looks like this needs to be rebased to be be able to use "reabse and merge" strategy.

The "index" argument name is already used by various built-in commands
(see Default/Main.sublime-menu), so let's follow that example.
It is possible to avoid the import loop by using the TYPE_CHECKING
constant from the typing module to avoid the import of TreeViewSheet at
runtime, because it is only used for the type comment.
@rchl rchl merged commit fe32c17 into sublimelsp:main Dec 1, 2023
4 checks passed
@jwortmann jwortmann deleted the refactorings branch December 1, 2023 18:36
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.

3 participants