mirror of
https://oauth2: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@github.com/m1ngsama/chopsticks.git
synced 2026-05-14 04:51:08 +08:00
Improve first-time LSP setup guidance (#25)
This commit is contained in:
parent
c98d04200c
commit
5544b74545
2 changed files with 19 additions and 0 deletions
|
|
@ -229,6 +229,10 @@ function! s:ChopsticksStatus() abort
|
||||||
|
|
||||||
call add(l:lines, '── lsp servers ── (:LspInstallServer to install)')
|
call add(l:lines, '── lsp servers ── (:LspInstallServer to install)')
|
||||||
call add(l:lines, s:LspStackCheck())
|
call add(l:lines, s:LspStackCheck())
|
||||||
|
if get(g:, 'chopsticks_enable_lsp', 1)
|
||||||
|
call add(l:lines, ' LSP actions are buffer-local and start after a server attaches.')
|
||||||
|
call add(l:lines, ' Missing one? Open that filetype and run :LspInstallServer once.')
|
||||||
|
endif
|
||||||
call add(l:lines, s:LspCheck('python', 'pylsp'))
|
call add(l:lines, s:LspCheck('python', 'pylsp'))
|
||||||
call add(l:lines, s:LspCheck('go', 'gopls'))
|
call add(l:lines, s:LspCheck('go', 'gopls'))
|
||||||
call add(l:lines, s:LspCheck('rust', 'rust-analyzer'))
|
call add(l:lines, s:LspCheck('rust', 'rust-analyzer'))
|
||||||
|
|
@ -350,6 +354,7 @@ function! s:CheatSheet() abort
|
||||||
\ ' ,o outline',
|
\ ' ,o outline',
|
||||||
\ ' [g ]g LSP diagnostics',
|
\ ' [g ]g LSP diagnostics',
|
||||||
\ ' :LspInstallServer setup LSP',
|
\ ' :LspInstallServer setup LSP',
|
||||||
|
\ ' :ChopsticksStatus check LSP setup',
|
||||||
\ ])
|
\ ])
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -198,6 +198,8 @@ check_vim() {
|
||||||
fi
|
fi
|
||||||
grep -Fq 'OK vim-lsp stack (installed)' "$TMP_ROOT/status-default.txt"
|
grep -Fq 'OK vim-lsp stack (installed)' "$TMP_ROOT/status-default.txt"
|
||||||
grep -Fq 'python (:LspInstallServer in a python file)' "$TMP_ROOT/status-default.txt"
|
grep -Fq 'python (:LspInstallServer in a python file)' "$TMP_ROOT/status-default.txt"
|
||||||
|
grep -Fq 'LSP actions are buffer-local and start after a server attaches.' "$TMP_ROOT/status-default.txt"
|
||||||
|
grep -Fq 'Open that filetype and run :LspInstallServer once.' "$TMP_ROOT/status-default.txt"
|
||||||
|
|
||||||
XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \
|
XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \
|
||||||
-c 'silent! delcommand LspStatus' \
|
-c 'silent! delcommand LspStatus' \
|
||||||
|
|
@ -219,6 +221,10 @@ check_vim() {
|
||||||
-c 'qa!' 2>&1
|
-c 'qa!' 2>&1
|
||||||
grep -Fq 'off vim-lsp stack (LSP disabled by profile)' "$TMP_ROOT/status-minimal.txt"
|
grep -Fq 'off vim-lsp stack (LSP disabled by profile)' "$TMP_ROOT/status-minimal.txt"
|
||||||
grep -Fq 'off python (LSP disabled by profile)' "$TMP_ROOT/status-minimal.txt"
|
grep -Fq 'off python (LSP disabled by profile)' "$TMP_ROOT/status-minimal.txt"
|
||||||
|
if grep -Fq 'LSP actions are buffer-local' "$TMP_ROOT/status-minimal.txt"; then
|
||||||
|
cat "$TMP_ROOT/status-minimal.txt"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir -p "$TMP_ROOT/missing-home/.vim/autoload"
|
mkdir -p "$TMP_ROOT/missing-home/.vim/autoload"
|
||||||
cp "$HOME/.vim/autoload/plug.vim" "$TMP_ROOT/missing-home/.vim/autoload/plug.vim"
|
cp "$HOME/.vim/autoload/plug.vim" "$TMP_ROOT/missing-home/.vim/autoload/plug.vim"
|
||||||
|
|
@ -231,6 +237,14 @@ check_vim() {
|
||||||
-c 'qa!' 2>&1
|
-c 'qa!' 2>&1
|
||||||
grep -Fq 'vim-lsp not installed; run :PlugInstall' "$TMP_ROOT/status-missing-plugin.txt"
|
grep -Fq 'vim-lsp not installed; run :PlugInstall' "$TMP_ROOT/status-missing-plugin.txt"
|
||||||
|
|
||||||
|
XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \
|
||||||
|
-c 'normal ,?' \
|
||||||
|
-c "redir! > $TMP_ROOT/cheat-default.txt" \
|
||||||
|
-c 'silent %print' \
|
||||||
|
-c 'redir END' \
|
||||||
|
-c 'qa!' 2>&1
|
||||||
|
grep -Fq ':ChopsticksStatus check LSP setup' "$TMP_ROOT/cheat-default.txt"
|
||||||
|
|
||||||
vim -u NONE -i NONE -es -N \
|
vim -u NONE -i NONE -es -N \
|
||||||
-c 'let g:chopsticks_profile = "minimal"' \
|
-c 'let g:chopsticks_profile = "minimal"' \
|
||||||
-c 'source .vimrc' \
|
-c 'source .vimrc' \
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue