Skip to content

Commit 5550f9d

Browse files
committed
feat(lsp): updated
♬ Italoconnection - Metropoli
1 parent 51d2705 commit 5550f9d

File tree

3 files changed

+26
-49
lines changed

3 files changed

+26
-49
lines changed

dev/lsp-installer/install.sh

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
#!/usr/bin/env bash
22
# Written in [Amber](https://amber-lang.com/)
3-
# version: 0.4.0-alpha
4-
# date: 2025-03-10 11:58:53
3+
# version: 0.4.0-alpha-23-g3ac9e0a
4+
# date: 2025-05-22 11:18:03
55
text_contains__14_v0() {
66
local text=$1
77
local phrase=$2
88
__0_command="$(if [[ "${text}" == *"${phrase}"* ]]; then
99
echo 1
1010
fi)"
11-
__status=$?
1211
result="${__0_command}"
1312
__ret_text_contains14_v0="$(
1413
[ "_${result}" != "_1" ]
@@ -21,7 +20,7 @@ dir_exists__32_v0() {
2120
local path=$1
2221
[ -d "${path}" ]
2322
__status=$?
24-
if [ $__status != 0 ]; then
23+
if [ "${__status}" != 0 ]; then
2524
__ret_dir_exists32_v0=0
2625
return 0
2726
fi
@@ -33,7 +32,7 @@ file_exists__33_v0() {
3332
local path=$1
3433
[ -f "${path}" ]
3534
__status=$?
36-
if [ $__status != 0 ]; then
35+
if [ "${__status}" != 0 ]; then
3736
__ret_file_exists33_v0=0
3837
return 0
3938
fi
@@ -48,7 +47,6 @@ symlink_create__37_v0() {
4847
__ret_file_exists33_v0__41_8="${__ret_file_exists33_v0}"
4948
if [ "${__ret_file_exists33_v0__41_8}" != 0 ]; then
5049
ln -s "${origin}" "${destination}"
51-
__status=$?
5250
__ret_symlink_create37_v0=1
5351
return 0
5452
fi
@@ -64,7 +62,6 @@ file_chmod__39_v0() {
6462
__ret_file_exists33_v0__61_8="${__ret_file_exists33_v0}"
6563
if [ "${__ret_file_exists33_v0__61_8}" != 0 ]; then
6664
chmod "${mode}" "${path}"
67-
__status=$?
6865
__ret_file_chmod39_v0=1
6966
return 0
7067
fi
@@ -77,7 +74,7 @@ is_command__96_v0() {
7774
local command=$1
7875
[ -x "$(command -v "${command}")" ]
7976
__status=$?
80-
if [ $__status != 0 ]; then
77+
if [ "${__status}" != 0 ]; then
8178
__ret_is_command96_v0=0
8279
return 0
8380
fi
@@ -87,7 +84,6 @@ is_command__96_v0() {
8784

8885
is_root__101_v0() {
8986
__1_command="$(id -u)"
90-
__status=$?
9187
if [ "$(
9288
[ "_${__1_command}" != "_0" ]
9389
echo $?
@@ -110,13 +106,10 @@ file_download__138_v0() {
110106
__ret_is_command96_v0__15_9="${__ret_is_command96_v0}"
111107
if [ "${__ret_is_command96_v0__9_9}" != 0 ]; then
112108
curl -L -o "${path}" "${url}"
113-
__status=$?
114109
elif [ "${__ret_is_command96_v0__12_9}" != 0 ]; then
115110
wget "${url}" -P "${path}"
116-
__status=$?
117111
elif [ "${__ret_is_command96_v0__15_9}" != 0 ]; then
118112
aria2c "${url}" -d "${path}"
119-
__status=$?
120113
else
121114
__ret_file_download138_v0=0
122115
return 0
@@ -148,12 +141,11 @@ move_to_bin__143_v0() {
148141
if [ "${__ret_file_download138_v0__16_15}" != 0 ]; then
149142
mv "${binary}" "/usr/local/bin"
150143
__status=$?
151-
if [ $__status != 0 ]; then
144+
if [ "${__status}" != 0 ]; then
152145
echo "Move ${binary} to /usr/local/bin failed"'!'""
153146
exit 1
154147
fi
155148
file_chmod__39_v0 "/usr/local/bin/${binary}" "+x"
156-
__ret_file_chmod39_v0__21_9="${__ret_file_chmod39_v0}"
157149
else
158150
echo "Download for ${binary} at ${download_url} failed"
159151
exit 1
@@ -171,17 +163,12 @@ download_to_bin__144_v0() {
171163
__ret_text_contains14_v0__31_16="${__ret_text_contains14_v0}"
172164
if [ "${__ret_text_contains14_v0__31_16}" != 0 ]; then
173165
tar -zxvf "./${packed_file}" -C ./ >/dev/null 2>&1
174-
__status=$?
175166
mv "./${binary}" "/usr/local/bin"
176-
__status=$?
177167
else
178168
gunzip -c "${packed_file}" >"/usr/local/bin/${binary}"
179-
__status=$?
180169
fi
181170
rm "./${packed_file}"
182-
__status=$?
183171
file_chmod__39_v0 "/usr/local/bin/${binary}" "+x"
184-
__ret_file_chmod39_v0__39_9="${__ret_file_chmod39_v0}"
185172
else
186173
echo "Download for ${binary} at ${download_url} failed"
187174
exit 1
@@ -217,29 +204,26 @@ __ret_dir_exists32_v0__67_8="${__ret_dir_exists32_v0}"
217204
if [ "$(echo '!' "${__ret_dir_exists32_v0__67_8}" | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//')" != 0 ]; then
218205
cd "/opt/" || exit
219206
git clone https://github.com/LuaLS/lua-language-server
220-
__status=$?
221207
cd "lua-language-server" || exit
222208
else
223209
cd "/opt/lua-language-server" || exit
224210
fi
225211
git pull >/dev/null 2>&1
226-
__status=$?
227212
./make.sh >/dev/null 2>&1
228213
__status=$?
229214
symlink_create__37_v0 "/opt/lua-language-server/bin/lua-language-server" "/usr/local/bin/lua-language-server"
230-
__ret_symlink_create37_v0__78_1="${__ret_symlink_create37_v0}"
231215
cd "/tmp" || exit
232216
__3_array=("vscode-langservers-extracted" "@tailwindcss/language-server" "@olrtg/emmet-language-server" "intelephense" "bash-language-server")
233217
__0_npm_lsp=("${__3_array[@]}")
234218
__4_array=("CSS, HTML, JSON LSP" "Tailwind LSP" "Emmet LSP" "Intelephense LSP" "Bash LSP")
235219
__1_npm_lsp_name=("${__4_array[@]}")
236220
index=0
237221
for lsp in "${__0_npm_lsp[@]}"; do
238-
echo "Install ${__1_npm_lsp_name["${index}"]}"
222+
echo "Install ${__1_npm_lsp_name[${index}]}"
239223
npm i -g "${lsp}"
240224
__status=$?
241-
if [ $__status != 0 ]; then
242-
echo "Error"'!'" Exit code: $__status"
225+
if [ "${__status}" != 0 ]; then
226+
echo "Error"'!'" Exit code: ${__status}"
243227
fi
244228
((index++)) || true
245229
done
@@ -249,11 +233,11 @@ __6_array=("Python LSP" "Ruby LSP")
249233
__3_command_lsp_name=("${__6_array[@]}")
250234
index=0
251235
for lsp in "${__2_command_lsp[@]}"; do
252-
echo "Install ${__3_command_lsp_name["${index}"]}"
236+
echo "Install ${__3_command_lsp_name[${index}]}"
253237
${lsp}
254238
__status=$?
255-
if [ $__status != 0 ]; then
256-
echo "Error"'!'" Exit code: $__status"
239+
if [ "${__status}" != 0 ]; then
240+
echo "Error"'!'" Exit code: ${__status}"
257241
fi
258242
((index++)) || true
259243
done

misc/kill-process-3gb.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

misc/kill-process-7gb.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
# Kill any process if the memory used is over the limit
3+
4+
LIMIT=$((6 * 1024 * 1024)) # in KB
5+
6+
while true; do
7+
ps -eo pid,rss,comm --no-headers | while read pid rss comm; do
8+
if [ "$rss" -gt "$LIMIT" ]; then
9+
echo "Killing $comm (PID $pid) using ${rss}KB RAM"
10+
kill -9 $pid
11+
fi
12+
done
13+
sleep 10
14+
done

0 commit comments

Comments
 (0)