Skip to content

Commit

Permalink
fix #71
Browse files Browse the repository at this point in the history
Signed-off-by: tracyone <tracyone@live.cn>
  • Loading branch information
tracyone committed Nov 10, 2022
1 parent 748e1cf commit b72f554
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion autoload/te/feat.vim
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function! te#feat#gen_feature_vim(reset) abort
endif
let l:temp2=te#feat#get_vim_version()
if v:shell_error != 0
let g:vinux_version='vinux V1.5.7'.' @'.l:temp2[0].'.'.l:temp2[1]
let g:vinux_version='vinux V1.5.8'.' @'.l:temp2[0].'.'.l:temp2[1]
else
let l:temp = matchstr(l:vinux_version[-1],'.*\(-\d\+-\w\+\)\@=')
if l:temp !=# ''
Expand Down
17 changes: 17 additions & 0 deletions autoload/te/lsp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,23 @@ function! te#lsp#is_server_running() abort
return 0
endfunction

function! te#lsp#get_lsp_server_name() abort
if te#env#IsNvim() >= 0.5
return v:lua.require('utils').get_client_name()
else
if exists("*lsp#get_server_status")
let l:ret = 0
let l:serve_name = lsp#get_allowed_servers()
for l:needle in l:serve_name
if stridx(lsp#get_server_status(l:needle), 'running') != -1
return l:needle
endif
endfor
return "0"
endif
endif
endfunction

function! te#lsp#gotodefinion() abort
if exists(':LspDefinition') == 2
:LspDefinition
Expand Down
10 changes: 10 additions & 0 deletions lua/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,14 @@ function module.is_lsp_running()
return get_size(client_obj)
end

function module.get_client_name()
local current_buf = vim.api.nvim_get_current_buf()
local client_obj = vim.lsp.get_active_clients{ buffer = current_buf }

for _, client in pairs(client_obj) do
return string.format("%s", client.name)
end
return string.format("0")
end

return module
2 changes: 1 addition & 1 deletion rc/options.vim
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ if get(g:,'feat_enable_airline') != 1
let l:mystatus_line.='cscope[%{cscope_connection()}]'.s:right_seperator
endif
if get(g:, 'feat_enable_lsp') == 1
let l:mystatus_line.='lsp[%{te#lsp#is_server_running()}]'.s:right_seperator
let l:mystatus_line.='lsp[%{te#lsp#get_lsp_server_name()}]'.s:right_seperator
endif
if a:type == 1
let l:mystatus_line.=s:git_branch
Expand Down

0 comments on commit b72f554

Please sign in to comment.