-
-
Notifications
You must be signed in to change notification settings - Fork 92
fix(main): move language server installation to separate shell script #892
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(main): move language server installation to separate shell script #892
Conversation
PR SummaryRefactored language server installations by moving them into dedicated shell scripts for each LSP, improving modularity and maintainability. Introduced a new Bash language server with ShellCheck integration, enhancing support for Bash scripting. The terminal setup process was also streamlined by extracting common utility functions into a shared Changes
autogenerated by presubmit.ai |
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.
🚨 Pull request needs attention.
Review Summary
Commits Considered (2)
Files Processed (19)
- core/main/src/main/assets/terminal/lsp/bash.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/css.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/eslint.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/html.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/json.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/markdown.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/python.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/typescript.sh (1 hunk)
- core/main/src/main/assets/terminal/universal_runner.sh (1 hunk)
- core/main/src/main/java/com/rk/libcommons/editor/ScopeRegistry.kt (2 hunks)
- core/main/src/main/java/com/rk/libcommons/editor/lspServers/Bash.kt (1 hunk)
- core/main/src/main/java/com/rk/libcommons/editor/lspServers/CSS.kt (2 hunks)
- core/main/src/main/java/com/rk/libcommons/editor/lspServers/ESLint.kt (2 hunks)
- core/main/src/main/java/com/rk/libcommons/editor/lspServers/HTML.kt (2 hunks)
- core/main/src/main/java/com/rk/libcommons/editor/lspServers/JSON.kt (2 hunks)
- core/main/src/main/java/com/rk/libcommons/editor/lspServers/Markdown.kt (2 hunks)
- core/main/src/main/java/com/rk/libcommons/editor/lspServers/Python.kt (2 hunks)
- core/main/src/main/java/com/rk/libcommons/editor/lspServers/TypeScript.kt (2 hunks)
- core/main/src/main/java/com/rk/xededitor/ui/screens/terminal/TerminalFiles.kt (1 hunk)
Actionable Comments (2)
-
core/main/src/main/assets/terminal/lsp/bash.sh [34-34]
possible bug: "Fix typo in command existence check."
-
core/main/src/main/assets/terminal/lsp/python.sh [22-22]
possible bug: "Fix typo in installation message."
Skipped Comments (5)
-
core/main/src/main/assets/terminal/lsp/bash.sh [3-17]
maintainability: "Refactor common utility functions in shell scripts."
-
core/main/src/main/assets/terminal/lsp/bash.sh [20-20]
performance: "Optimize package update and upgrade process."
-
core/main/src/main/assets/terminal/lsp/bash.sh [24-24]
possible issue: "Adjust
curlinstallation placement." -
core/main/src/main/assets/terminal/lsp/bash.sh [41-41]
usability: "Review usage of
clearcommand." -
core/main/src/main/java/com/rk/xededitor/ui/screens/terminal/TerminalFiles.kt [73-73]
best practice: "Ensure all parent directories are created."
| export PATH="/home/.npm-global/bin:$PATH" | ||
| } | ||
|
|
||
| if ! command_exists node || ! command_exist npm; then |
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.
There is a typo in command_exist npm. It should be command_exists npm to correctly call the defined function.
| info 'Preparing installation...' | ||
| apt update && apt upgrade -y | ||
|
|
||
| apt 'Installing pipx...' |
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.
The line apt 'Installing pipx...' appears to be a typo. apt is a package manager command, not a function for printing messages. It should likely be info 'Installing pipx...' to use the custom info function defined in the script.
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.
✅ LGTM!
Review Summary
Commits Considered (1)
- 4e207c8: chore(main): refactor terminal file setup
Files Processed (4)
- core/main/src/main/assets/terminal/lsp/bash.sh (1 hunk)
- core/main/src/main/java/com/rk/libcommons/editor/ScopeRegistry.kt (2 hunks)
- core/main/src/main/java/com/rk/libcommons/editor/lspServers/Bash.kt (1 hunk)
- core/main/src/main/java/com/rk/xededitor/ui/screens/terminal/TerminalFiles.kt (1 hunk)
Actionable Comments (0)
Skipped Comments (4)
-
core/main/src/main/assets/terminal/lsp/bash.sh [20-20]
best practice: "Refine package upgrade strategy in installation script."
-
core/main/src/main/assets/terminal/lsp/bash.sh [27-27]
maintainability: "Verify target directory for global npm packages."
-
core/main/src/main/assets/terminal/lsp/bash.sh [41-41]
readability: "Avoid clearing terminal output after installation."
-
core/main/src/main/java/com/rk/xededitor/ui/screens/terminal/TerminalFiles.kt [63-63]
maintainability: "Consider dynamic discovery for LSP files."
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.
🚨 Pull request needs attention.
Review Summary
Commits Considered (1)
- c6dc4ef: fix(main): correct spelling mistakes
Files Processed (8)
- core/main/src/main/assets/terminal/lsp/bash.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/css.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/eslint.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/html.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/json.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/markdown.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/python.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/typescript.sh (1 hunk)
Actionable Comments (1)
-
core/main/src/main/assets/terminal/lsp/bash.sh [25-25]
security: "Mitigate security risk of piping curl to bash."
Skipped Comments (4)
-
core/main/src/main/assets/terminal/lsp/bash.sh [22-36]
maintainability: "Refactor duplicated Node.js installation logic."
-
core/main/src/main/assets/terminal/lsp/bash.sh [20-20]
best practice: "Avoid full system upgrade in installation scripts."
-
core/main/src/main/assets/terminal/lsp/bash.sh [41-41]
maintainability: "Review use of
clearcommand." -
core/main/src/main/assets/terminal/lsp/python.sh [24-24]
possible bug: "Ensure
pipxis in PATH beforepipx ensurepath."
|
Btw, in the Bash LSP, you should also install ShellCheck |
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.
🚨 Pull request needs attention.
Review Summary
Commits Considered (1)
- 0e19078: fix(main): add shellcheck to
bash.shscript and add-yflag to curl installation
Files Processed (7)
- core/main/src/main/assets/terminal/lsp/bash.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/css.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/eslint.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/html.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/json.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/markdown.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/typescript.sh (1 hunk)
Actionable Comments (1)
-
core/main/src/main/assets/terminal/lsp/bash.sh [3-32]
maintainability: "Refactor duplicated utility and installation logic into a shared script."
Skipped Comments (1)
-
core/main/src/main/assets/terminal/lsp/bash.sh [20-20]
best practice: "Review
apt upgrade -yfor potential unintended side effects."
| info() { | ||
| printf '\033[34;1m[*] \033[0m%s\n' "$1" | ||
| } | ||
|
|
||
| warn() { | ||
| printf '\033[33;1m[!] \033[0m%s\n' "$1" | ||
| } | ||
|
|
||
| error() { | ||
| printf '\033[31;1m[x] \033[0m%s\n' "$1" | ||
| } | ||
|
|
||
| command_exists() { | ||
| command -v "$1" >/dev/null 2>&1 | ||
| } | ||
|
|
||
| info 'Preparing installation...' | ||
| apt update && apt upgrade -y | ||
|
|
||
| install_nodejs() { | ||
| info "Installing Node.js LTS..." | ||
| apt install -y curl | ||
| curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - | ||
| apt install -y nodejs | ||
| mkdir -p /home/.npm-global | ||
| npm config set prefix '/home/.npm-global' | ||
| grep -qxF "export PATH=\"/home/.npm-global/bin:\$PATH\"" ~/.bashrc || \ | ||
| echo "export PATH=\"/home/.npm-global/bin:\$PATH\"" >> ~/.bashrc | ||
| export PATH="/home/.npm-global/bin:$PATH" | ||
| } |
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.
The info, warn, error, command_exists utility functions, and the install_nodejs function are duplicated across all the new language server installation scripts. This leads to significant code duplication and makes maintenance harder. Consider extracting these common functions into a separate shell script (e.g., utils.sh) that can be sourced by all language server scripts. This would improve maintainability and reduce the effort required to update or fix issues in these common components.
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.
This is important, I still have to do it
Even with ShellCheck installed, I don't get any diagnostics |
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.
✅ LGTM!
Review Summary
Commits Considered (7)
- 5b9dfb1: Merge branch 'main' into fix/lsp-improvements
- b1e6e83: fix(main): improve terminal file setup and extract util methods into
utils.sh - 0e19078: fix(main): add shellcheck to
bash.shscript and add-yflag to curl installation - c6dc4ef: fix(main): correct spelling mistakes
- 4e207c8: chore(main): refactor terminal file setup
- 082c290: feat(main): add Bash language server
- 01d6ddb: fix(main): move language server installation to separate shell script
Files Processed (23)
- core/main/src/main/assets/terminal/init.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/bash.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/css.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/eslint.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/html.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/json.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/markdown.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/python.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/typescript.sh (1 hunk)
- core/main/src/main/assets/terminal/setup.sh (1 hunk)
- core/main/src/main/assets/terminal/universal_runner.sh (2 hunks)
- core/main/src/main/assets/terminal/utils.sh (1 hunk)
- core/main/src/main/java/com/rk/libcommons/editor/ScopeRegistry.kt (2 hunks)
- core/main/src/main/java/com/rk/libcommons/editor/lspServers/Bash.kt (1 hunk)
- core/main/src/main/java/com/rk/libcommons/editor/lspServers/CSS.kt (2 hunks)
- core/main/src/main/java/com/rk/libcommons/editor/lspServers/ESLint.kt (2 hunks)
- core/main/src/main/java/com/rk/libcommons/editor/lspServers/HTML.kt (2 hunks)
- core/main/src/main/java/com/rk/libcommons/editor/lspServers/JSON.kt (2 hunks)
- core/main/src/main/java/com/rk/libcommons/editor/lspServers/Markdown.kt (2 hunks)
- core/main/src/main/java/com/rk/libcommons/editor/lspServers/Python.kt (2 hunks)
- core/main/src/main/java/com/rk/libcommons/editor/lspServers/TypeScript.kt (2 hunks)
- core/main/src/main/java/com/rk/runner/runners/UniversalRunner.kt (1 hunk)
- core/main/src/main/java/com/rk/xededitor/ui/screens/terminal/TerminalFiles.kt (1 hunk)
Actionable Comments (0)
Skipped Comments (4)
-
core/main/src/main/assets/terminal/lsp/bash.sh [6-7]
maintainability: "Consolidate system update commands."
-
core/main/src/main/assets/terminal/lsp/bash.sh [8-18]
maintainability: "Extract common Node.js installation logic."
-
core/main/src/main/assets/terminal/lsp/bash.sh [30-30]
maintainability: "Review use of
clearcommand in installation scripts." -
core/main/src/main/assets/terminal/lsp/bash.sh [6-6]
possible issue: "Consider implications of
apt upgrade -yin automated installations."
Changes
$PATHvariable expanding in.bashrcfile