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

refactor: utilize latest lsp_utils #33

Merged
merged 11 commits into from
Nov 28, 2020
Merged

Conversation

jfcherng
Copy link
Collaborator

resolves #30

Signed-off-by: Jack Cherng <jfcherng@gmail.com>
@jfcherng jfcherng added the enhancement New feature or request label Nov 24, 2020
Signed-off-by: Jack Cherng <jfcherng@gmail.com>
plugin.py Outdated Show resolved Hide resolved
Signed-off-by: Jack Cherng <jfcherng@gmail.com>
plugin.py Outdated Show resolved Hide resolved
@rchl
Copy link
Member

rchl commented Nov 24, 2020

Can you wait for new lsp_utils version? I'm planning to introduce common API for that.

Signed-off-by: Jack Cherng <jfcherng@gmail.com>
Signed-off-by: Jack Cherng <jfcherng@gmail.com>
Since we are waiting for the next lsp_utils release anyway...

Signed-off-by: Jack Cherng <jfcherng@gmail.com>
Signed-off-by: Jack Cherng <jfcherng@gmail.com>
Signed-off-by: Jack Cherng <jfcherng@gmail.com>
Signed-off-by: Jack Cherng <jfcherng@gmail.com>
Signed-off-by: Jack Cherng <jfcherng@gmail.com>
@jfcherng jfcherng changed the title refactor: use on_settings_changed() for ST 4 refactor: utilize latest lsp_utils Nov 25, 2020
plugin.py Show resolved Hide resolved
plugin.py Outdated Show resolved Hide resolved
Signed-off-by: Jack Cherng <jfcherng@gmail.com>

if settings.get("dev_environment") == "sublime_text":
server_settings = settings.get("settings", {}) # type: Dict[str, Any]
if self.get_plugin_setting("dev_environment") == "sublime_text":
Copy link
Member

@rchl rchl Nov 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might sound like a crazy idea but this get_plugin_setting wouldn't be necessary had we put our dev_environment inside the settings object.

The server will ignore unknown properties anyway and we'll get the benefit of merged settings automatically (not that important in this case but could be in other cases).

Notice that it's already happening (in VSCode at least) as the python settings are not really pyright specific in VSCode and the server still receives all of them.

Copy link
Collaborator Author

@jfcherng jfcherng Nov 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not against that but probably adding an extra prefix like sublimelsp.dev_environment?

Copy link
Member

@rchl rchl Nov 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel it's really necessary. We should treat those settings as ours as that's how normal users see them. Users don't need to know the distinction between our and original pyright settings.
IMO.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

having a dedicated prefix makes it more structured imho. now we only have one settings though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with a prefix but not sure what it would be.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose using the package name as the prefix, i.e., LSP-pyright.dev_environment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry but it sounds very redundant to put a LSP-pyright.* key inside the LSP-pyright.sublime-settings or inside the LSP-pyright object in project settings, for example.

I think it only achieves peace of mind for you, and possibly other developers working on the plugin, because you want to keep the settings of pyright and our additions separate. But as I said, I don't believe those should be treated as separate. To normal users, there is no distinction really.

That setting is a bit special as it affects/modifies other settings though. So from that perspective, I guess it might make sense to single it out somehow. But I really can't think of anything better right now. Personally, I would think that a name like environment_type would be enough.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That setting is a bit special as it affects/modifies other settings though. So from that perspective, I guess it might make sense to single it out somehow.

Does it imply only dev_environment (whatever its name) will be in server settings but not other non-server settings in the future?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that implies anything as we don't have strict rules for this. I'm just trying to think of what's best to do here.

But in the end, it's a trivial thing and we should probably not spend too much time discussing it.

Maybe just keep as it is now, even if it complicates the code internally...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I guess that can be discussed later if wanted. https://github.com/neoclide/coc-python#options seems to just use python as the prefix.

@jfcherng jfcherng merged commit 41934bd into master Nov 28, 2020
@jfcherng jfcherng deleted the refactor/use-on_settings_changed branch November 28, 2020 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ST4] Adjust extraPaths in the on_settings_changed callback
2 participants