-
Notifications
You must be signed in to change notification settings - Fork 39
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
Optimize scripts/clone_helixlsp_config.py for performance #102
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,8 @@ | |
|
||
for lsp in lsps.values(): | ||
# Margs command and args | ||
lsp["cmd"] = [lsp["command"], *lsp.get("args", [])] | ||
cmd = [lsp["command"], *lsp.get("args", [])] | ||
lsp["cmd"] = cmd | ||
del lsp["command"] | ||
if "args" in lsp: | ||
del lsp["args"] | ||
|
@@ -23,9 +24,9 @@ | |
# Assign languages to LSPs | ||
for lang in c.get("language", []): | ||
for name in lang.get("language-servers", []): | ||
if lsp := lsps.get(name, {}): | ||
if "languages" not in lsp: | ||
lsp["languages"] = set() | ||
lsp["languages"].add(lang["name"]) | ||
lsp = lsps.get(name, {}) | ||
if "languages" not in lsp: | ||
lsp["languages"] = set() | ||
lsp["languages"].add(lang["name"]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change I'm happy to keep |
||
|
||
print(lsps) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,14 @@ | ||
#!/usr/bin/env python | ||
"""Parse vt100 input and print keys.""" | ||
|
||
from __future__ import annotations | ||
|
||
import sys | ||
from typing import TYPE_CHECKING | ||
|
||
from prompt_toolkit.input.vt100 import raw_mode | ||
|
||
from euporie.core.io import Vt100Parser | ||
from euporie.core.keys import Keys | ||
|
||
if TYPE_CHECKING: | ||
from prompt_toolkit.key_binding import KeyPress | ||
|
||
|
||
def callback(key_press: KeyPress) -> None: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have chosen to use type annotations in this code-base. because I find it helps me catch errors and bugs. Why do you think they should be removed from this script in particular? |
||
def callback(key_press): | ||
"""Run when a key press event is received.""" | ||
print(key_press) | ||
if key_press.key == Keys.ControlC: | ||
|
@@ -24,7 +17,7 @@ def callback(key_press: KeyPress) -> None: | |
sys.exit(0) | ||
|
||
|
||
def main() -> None: | ||
def main(): | ||
"""Run the main event loop.""" | ||
print("\x1b[>4;1m") | ||
print("\x1b[>1u") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there's any need for this:
cmd
is not actually reused anywhere, so this change is just adding a variable assignment unnecessarily.