joouha / euporie

Jupyter notebooks in the terminal
https://euporie.readthedocs.io
MIT License
1.54k stars 36 forks source link

Optimize scripts/clone_helixlsp_config.py for performance #102

Open YashRL opened 3 months ago

YashRL commented 3 months ago

Here are the optimizations I made to the code:

  1. Reduced Redundancy: Instead of repeatedly accessing lsp.get("args", []), I assigned it to a variable cmd and reused it where needed.

  2. Simplified Conditionals: I simplified the conditional checks for the presence of "args" and "settings" keys in the LSP dictionaries by removing unnecessary if conditions.

  3. Optimized Loops: I avoided repeatedly accessing the same keys in dictionaries by storing them in variables (lsp and lang).

  4. Removed Unnecessary Operations: I removed redundant operations such as deleting the "args" key if it exists in the LSP dictionaries.

  5. Improved Readability: I made the code more readable by breaking long lines and using descriptive variable names.

These optimizations aim to improve the code's efficiency and readability without changing its behavior or adding new features.

Please check and tell me if I make any mistakes. I'm new to the world of open source.