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

Fix the LSP Development command #1724

Merged
merged 4 commits into from
Jun 5, 2021
Merged

Fix the LSP Development command #1724

merged 4 commits into from
Jun 5, 2021

Conversation

daggy1234
Copy link
Contributor

With this fix the tooling command for generating a schema is fixed. As discussed in the discord server!. Just adds a few is-instance checks!

Copy link
Member

@rwols rwols left a comment

Choose a reason for hiding this comment

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

can you instead use this?

diff --git a/plugin/tooling.py b/plugin/tooling.py
index 9bcdc6f..21febe0 100644
--- a/plugin/tooling.py
+++ b/plugin/tooling.py
@@ -1,4 +1,5 @@
 from .core.css import css
+from .core.logging import debug
 from .core.registry import windows
 from .core.sessions import get_plugin
 from .core.transports import create_transport
@@ -41,7 +42,12 @@ def _preprocess_properties(translations: Optional[Dict[str, str]], properties: D
 
     - Replace description translation placeholders by their English translation
     - Discard the "scope" key
+    - Removes key/values whose value is not a dict
     """
+    non_dict_keys = [k for k, v in properties.items() if not isinstance(v, dict)]
+    for k in non_dict_keys:
+        debug("discarding key:", k)
+        properties.pop(k)
     for v in properties.values():
         v.pop("scope", None)
         descr = v.get("description")

@daggy1234 daggy1234 requested a review from rwols June 5, 2021 07:48
plugin/tooling.py Outdated Show resolved Hide resolved
plugin/tooling.py Outdated Show resolved Hide resolved
@@ -161,6 +167,8 @@ def run(self, base_package_name: str) -> None:
self.view.assign_syntax("Packages/JSON/JSON.sublime-syntax")
self.writeline("{")
for k, v in sorted(properties.items()):
if not isinstance(v, dict):
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 this check is actually necessary now. But better safe than sorry I suppose :)

@rwols rwols merged commit f4f7e66 into sublimelsp:main Jun 5, 2021
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