1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 07:10:06 +08:00

Fix error_clear (#2847)

This commit is contained in:
Wang Shidong 2019-05-26 22:01:20 +08:00 committed by GitHub
parent 66338440f0
commit b38414aea5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 62 additions and 28 deletions

View File

@ -13,18 +13,23 @@ let s:self._cmp = SpaceVim#api#import('vim#compatible')
let s:self.hi_info_group = 'Comment'
let s:self.hi_warn_group = 'WarningMsg'
let s:self.hi_error_group = 'ErrorMsg'
if exists('*nvim_create_namespace')
let s:self._hi_namespace = nvim_create_namespace('spacevim-signatures')
endif
if exists('*nvim_buf_set_virtual_text')
if exists('*nvim_create_namespace')
" @vimlint(EVL103, 1, a:col)
function! s:self.info(line, col, message) abort
call nvim_buf_set_virtual_text(0, bufnr('%'), a:line, [[a:message, self.hi_info_group],], {})
call nvim_buf_set_virtual_text(0, self._hi_namespace, a:line - 2, [[a:message, self.hi_info_group],], {})
endfunction
function! s:self.warn(line, col, message) abort
call nvim_buf_set_virtual_text(0, bufnr('%'), a:line, [[a:message, self.hi_warn_group],], {})
call nvim_buf_set_virtual_text(0, self._hi_namespace, a:line - 2, [[a:message, self.hi_warn_group],], {})
endfunction
function! s:self.error(line, col, message) abort
call nvim_buf_set_virtual_text(0, bufnr('%'), a:line, [[a:message, self.hi_error_group],], {})
call nvim_buf_set_virtual_text(0, self._hi_namespace, a:line - 2, [[a:message, self.hi_error_group],], {})
endfunction
" @vimlint(EVL103, 0, a:col)
else
function! s:self.info(line, col, message) abort
@ -44,12 +49,18 @@ endfunction
call s:self.set_group('SpaceVim_signatures')
function! s:self.clear() abort
for id in self.id
call matchdelete(id)
endfor
let self.id = []
endfunction
if exists('*nvim_create_namespace')
function! s:self.clear() abort
call nvim_buf_clear_namespace(0, self._hi_namespace, 0, -1)
endfunction
else
function! s:self.clear() abort
for id in self.id
call matchdelete(id)
endfor
let self.id = []
endfunction
endif
function! SpaceVim#api#vim#signatures#get() abort

View File

@ -539,11 +539,7 @@ function! SpaceVim#layers#core#statusline#def_colors() abort
exe 'hi! SpaceVim_statusline_ia gui=bold cterm=bold ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0]
exe 'hi! SpaceVim_statusline_b ctermbg=' . t[1][2] . ' ctermfg=' . t[1][3] . ' guibg=' . t[1][1] . ' guifg=' . t[1][0]
exe 'hi! SpaceVim_statusline_c ctermbg=' . t[2][2] . ' ctermfg=' . t[2][3] . ' guibg=' . t[2][1] . ' guifg=' . t[2][0]
if name ==# 'palenight' && t[9] ==# 'bright'
exe 'hi! SpaceVim_statusline_z ctermbg=' . t[3][1] . ' ctermfg=' . t[2][2] . ' guibg=' . t[3][0] . ' guifg=' . t[2][0]
else
exe 'hi! SpaceVim_statusline_z ctermbg=' . t[3][1] . ' ctermfg=' . t[4][3] . ' guibg=' . t[3][0] . ' guifg=' . t[4][0]
endif
exe 'hi! SpaceVim_statusline_z ctermbg=' . t[3][1] . ' ctermfg=' . t[2][2] . ' guibg=' . t[3][0] . ' guifg=' . t[2][0]
hi! SpaceVim_statusline_error ctermbg=003 ctermfg=Black guibg=#504945 guifg=#fb4934 gui=bold
hi! SpaceVim_statusline_warn ctermbg=003 ctermfg=Black guibg=#504945 guifg=#fabd2f gui=bold
call s:HI.hi_separator('SpaceVim_statusline_a', 'SpaceVim_statusline_b')

View File

@ -60,7 +60,6 @@ function! SpaceVim#mapping#guide#theme#palenight#palette() abort
\ [ s:guiBlack , s:gui05 , s:ctermWhite , s:cterm05 ],
\ ['#282828', '#689d6a', 235, 72],
\ ['#282828', '#8f3f71', 235, 132],
\ 'bright'
\ ]
else
return [
@ -73,7 +72,6 @@ function! SpaceVim#mapping#guide#theme#palenight#palette() abort
\ [ s:guiBlack , s:gui05 , s:ctermWhite , s:cterm05 ],
\ ['#282828', '#689d6a', 235, 72],
\ ['#282828', '#8f3f71', 235, 132],
\ 'dark',
\ ]
endif
endfunction

View File

@ -18,13 +18,12 @@ vim#signatures API provides some basic functions for showing signatures info.
## Functions ane varilues
| function name | description |
| ------------------------- | ---------------------------------------- |
| `info(line, col, msg)` | show info signature message on specific line and col |
| `warn(line, col, msg)` | show warn signature message on specific line and col |
| `error(line, col, msg)` | show error signature message on specific line and col |
| `clear()` | clear signatures info |
| `hi_info_group` | info message highlight group name |
| `hi_warn_group` | warn message highlight group name |
| `hi_error_group` | error message highlight group name |
| function name | description |
| ----------------------- | ----------------------------------------------------- |
| `info(line, col, msg)` | show info signature message on specific line and col |
| `warn(line, col, msg)` | show warn signature message on specific line and col |
| `error(line, col, msg)` | show error signature message on specific line and col |
| `clear()` | clear signatures info |
| `hi_info_group` | info message highlight group name |
| `hi_warn_group` | warn message highlight group name |
| `hi_error_group` | error message highlight group name |

View File

@ -0,0 +1,30 @@
---
title: "vim#signatures api"
description: "vim#signatures API 提供一些设置和获取 Vim 提示消息的函数。"
lang: cn
---
# [可用 APIs](../../) >> vim#signatures
<!-- vim-markdown-toc GFM -->
- [模块简介](#模块简介)
- [函数及变量](#函数及变量)
<!-- vim-markdown-toc -->
## 模块简介
vim#signatures API 提供一些设置和获取 Vim 提示消息的函数。
## 函数及变量
| 函数名称 | 功能描述 |
| ----------------------- | ----------------------------------------------------- |
| `info(line, col, msg)` | show info signature message on specific line and col |
| `warn(line, col, msg)` | show warn signature message on specific line and col |
| `error(line, col, msg)` | show error signature message on specific line and col |
| `clear()` | clear signatures info |
| `hi_info_group` | info message highlight group name |
| `hi_warn_group` | warn message highlight group name |
| `hi_error_group` | error message highlight group name |

View File

@ -2,6 +2,6 @@ Execute ( SpaceVim statusline theme ):
let g:_spacevim_built_in_themes = map(split(globpath('.', 'autoload/SpaceVim/mapping/guide/theme/*.vim'), "\n"), 'fnamemodify(v:val, ":t:r")')
for theme in g:_spacevim_built_in_themes
Log 'testing theme: ' . theme
AssertEqual len(call('SpaceVim#mapping#guide#theme#' . theme . '#palette', [])), 10
AssertEqual len(call('SpaceVim#mapping#guide#theme#' . theme . '#palette', [])), 9
endfor