Fix document layout and misspellings (#1127)

* fix document layout

* fix misspellings
This commit is contained in:
Linda_pp
2021-03-31 23:09:06 +09:00
committed by GitHub
parent 4d4a908224
commit ce3add957a
6 changed files with 41 additions and 39 deletions

View File

@@ -156,7 +156,7 @@ function! lsp#print_server_status() abort
endfunction endfunction
" @params {server_info} = { " @params {server_info} = {
" 'name': 'go-langserver', " requried, must be unique " 'name': 'go-langserver', " required, must be unique
" 'allowlist': ['go'], " optional, array of filetypes to allow, * for all filetypes " 'allowlist': ['go'], " optional, array of filetypes to allow, * for all filetypes
" 'blocklist': [], " optional, array of filetypes to block, * for all filetypes, " 'blocklist': [], " optional, array of filetypes to block, * for all filetypes,
" 'cmd': {server_info->['go-langserver]} " function that takes server_info and returns array of cmd and args, return empty if you don't want to start the server " 'cmd': {server_info->['go-langserver]} " function that takes server_info and returns array of cmd and args, return empty if you don't want to start the server

View File

@@ -1464,7 +1464,7 @@ endfunction
" \ 'env': {}, " \ 'env': {},
" \ }) " \ })
" call s:Stdin(1, 'hi') " call s:Stdin(1, 'hi')
" call s:Stdin(2, lsp#callbag#undefined()) " requried to close stdin " call s:Stdin(2, lsp#callbag#undefined()) " required to close stdin
function! lsp#callbag#spawn(cmd, ...) abort function! lsp#callbag#spawn(cmd, ...) abort
let l:data = { 'cmd': a:cmd, 'opt': a:0 > 0 ? copy(a:000[0]) : {} } let l:data = { 'cmd': a:cmd, 'opt': a:0 > 0 ? copy(a:000[0]) : {} }
return lsp#callbag#create(function('s:spawnCreate', [l:data])) return lsp#callbag#create(function('s:spawnCreate', [l:data]))

View File

@@ -49,7 +49,7 @@ function! lsp#internal#diagnostics#virtual_text#_enable() abort
let s:enabled = 1 let s:enabled = 1
if empty(s:namespace_id) if empty(s:namespace_id)
let s:namespace_id = nvim_create_namespace('vim_lsp_diagnotics_virtual_text') let s:namespace_id = nvim_create_namespace('vim_lsp_diagnostic_virtual_text')
endif endif
let s:Dispose = lsp#callbag#pipe( let s:Dispose = lsp#callbag#pipe(

View File

@@ -1,6 +1,6 @@
" options - { " options - {
" bufnr: bufnr('%') " required " bufnr: bufnr('%') " required
" type: '' " optional: defaults to visualmode(). overriden by opfunc " type: '' " optional: defaults to visualmode(). overridden by opfunc
" server - 'server_name' " optional " server - 'server_name' " optional
" sync: 0 " optional, defaults to 0 (async) " sync: 0 " optional, defaults to 0 (async)
" } " }

View File

@@ -29,7 +29,7 @@ endfunction
" 6. then the line is `call getbufline(|` in `s:on_complete_done_after` " 6. then the line is `call getbufline(|` in `s:on_complete_done_after`
" "
function! s:on_complete_done() abort function! s:on_complete_done() abort
" Somtimes, vim occurs `CompleteDone` unexpectedly. " Sometimes, vim occurs `CompleteDone` unexpectedly.
" We try to detect it by checking empty completed_item. " We try to detect it by checking empty completed_item.
if empty(v:completed_item) || get(v:completed_item, 'word', '') ==# '' && get(v:completed_item, 'abbr', '') ==# '' if empty(v:completed_item) || get(v:completed_item, 'word', '') ==# '' && get(v:completed_item, 'abbr', '') ==# ''
doautocmd <nomodeline> User lsp_complete_done doautocmd <nomodeline> User lsp_complete_done

View File

@@ -451,8 +451,9 @@ g:lsp_diagnostics_echo_delay *g:lsp_diagnostics_echo_delay*
Type: |Number| Type: |Number|
Default: `500` Default: `500`
Delay milliseconds to echo diagnostic error for the current line to status. Requires Delay milliseconds to echo diagnostic error for the current line to status.
|g:lsp_diagnostics_enabled| and |g:lsp_diagnostics_echo_cursor| set to 1. Requires |g:lsp_diagnostics_enabled| and |g:lsp_diagnostics_echo_cursor| set
to 1.
Example: > Example: >
let g:lsp_diagnostics_echo_delay = 200 let g:lsp_diagnostics_echo_delay = 200
@@ -462,8 +463,9 @@ g:lsp_diagnostics_float_cursor *g:lsp_diagnostics_float_cursor*
Type: |Number| Type: |Number|
Default: `0` Default: `0`
Enables a floating window of diagnostic error for the current line to status. Requires Enables a floating window of diagnostic error for the current line to
nvim_win_open() or popup_create is available, and |g:lsp_diagnostics_enabled| set to 1. status. Requires nvim_win_open() or popup_create is available, and
|g:lsp_diagnostics_enabled| set to 1.
Example: > Example: >
let g:lsp_diagnostics_float_cursor = 1 let g:lsp_diagnostics_float_cursor = 1
@@ -515,7 +517,7 @@ g:lsp_diagnostics_highlights_enabled *g:lsp_diagnostics_highlights_enabled*
highlight link LspErrorHighlight Error highlight link LspErrorHighlight Error
g:lsp_diagnostics_highlights_insert_mode_enabled g:lsp_diagnostics_highlights_insert_mode_enabled
*g:lsp_diagnostics_highlights_insert_mode_enabled* *g:lsp_diagnostics_highlights_insert_mode_enabled*
Type: |Number| Type: |Number|
Default: `1` Default: `1`
@@ -526,7 +528,7 @@ g:lsp_diagnostics_highlights_insert_mode_enabled
let g:lsp_diagnostics_highlights_insert_mode_enabled = 1 let g:lsp_diagnostics_highlights_insert_mode_enabled = 1
let g:lsp_diagnostics_highlights_insert_mode_enabled = 0 let g:lsp_diagnostics_highlights_insert_mode_enabled = 0
g:lsp_diagnostics_highlights_delay *g:lsp_diagnostics_highlights_delay* g:lsp_diagnostics_highlights_delay *g:lsp_diagnostics_highlights_delay*
Type: |Number| Type: |Number|
Default: `500` Default: `500`
@@ -883,7 +885,8 @@ g:lsp_snippet_expand *g:lsp_snippet_expand*
Type: |List| Type: |List|
The integration point to other snippet plugin. The integration point to other snippet plugin.
vim-lsp may invoke the first item of this value when it needs snippet expansion. vim-lsp may invoke the first item of this value when it needs snippet
expansion.
g:lsp_completion_resolve_timeout *g:lsp_completion_resolve_timeout* g:lsp_completion_resolve_timeout *g:lsp_completion_resolve_timeout*
Type: |Number| Type: |Number|
@@ -1073,19 +1076,19 @@ The vim |dict| containing information about the server.
For example: > For example: >
'config': { 'prefer_local': 1 } 'config': { 'prefer_local': 1 }
< <
This can then be used by cmd function. This can then be used by cmd function.
> >
function! s:myserver_cmd(server_info) abort function! s:myserver_cmd(server_info) abort
let l:config = get(a:server_info, 'config', {}) let l:config = get(a:server_info, 'config', {})
let l:prefer_local = get(l:config, 'prefer_local', 1) let l:prefer_local = get(l:config, 'prefer_local', 1)
if (l:prefer_local) if (l:prefer_local)
return ['./local-executable'] return ['./local-executable']
else else
return ['/bin/global-exectuable'] return ['/bin/global-exectuable']
endif endif
endfunction endfunction
'cmd': function('s:myserver_cmd') 'cmd': function('s:myserver_cmd')
< <
Using the `config` key, you can also specify a custom 'typed word Using the `config` key, you can also specify a custom 'typed word
pattern', or a custom filter for completion items, see pattern', or a custom filter for completion items, see
@@ -1204,7 +1207,8 @@ You can use this function to add custom command handler.
}) })
< <
For example, the rust-analyzer expects the client handles some custom command as below example. For example, the rust-analyzer expects the client handles some custom command
as below example.
> >
function! s:rust_analyzer_apply_source_change(context) function! s:rust_analyzer_apply_source_change(context)
let l:command = get(a:context, 'command', {}) let l:command = get(a:context, 'command', {})
@@ -1227,17 +1231,16 @@ Stream api to listen to responses and notifications from language server or
vim-lsp. Always verify the existence of request, response and server before vim-lsp. Always verify the existence of request, response and server before
accessing. Subscribing to stream should never throw an error. accessing. Subscribing to stream should never throw an error.
> >
function! s:on_textDocumentDiagnostics(x) abort function! s:on_textDocumentDiagnostics(x) abort
echom 'Diagnostics for ' . a:x['server'] . ' ' . json_encode(a:x['response']) echom 'Diagnostics for ' . a:x['server'] . ' ' . json_encode(a:x['response'])
endfunction endfunction
au User lsp_setup call lsp#callbag#pipe( au User lsp_setup call lsp#callbag#pipe(
\ lsp#stream(), \ lsp#stream(),
\ lsp#callbag#filter({x-> has_key(x, 'response') && !has_key(x['response'], 'error') && get(x['response'], 'method', '') == 'textDocument/publishDiagnostics'}), \ lsp#callbag#filter({x-> has_key(x, 'response') && !has_key(x['response'], 'error') && get(x['response'], 'method', '') == 'textDocument/publishDiagnostics'}),
\ lsp#callbag#subscribe({ 'next':{x->s:on_textDocumentDiagnostics(x)} }), \ lsp#callbag#subscribe({ 'next':{x->s:on_textDocumentDiagnostics(x)} }),
\ ) \ )
< <
Custom vim-lsp notifications streams: Custom vim-lsp notifications streams:
vimp-lsp events mimic lsp server notifications. vimp-lsp events mimic lsp server notifications.
* `server` is always `$vimlsp`. * `server` is always `$vimlsp`.
@@ -1271,7 +1274,6 @@ lsp#get_server_status({name-of-server}) *lsp#get_server_status()*
Get the status of a server. Get the status of a server.
Example: > Example: >
call lsp#get_server_status('name-of-server') call lsp#get_server_status('name-of-server')
< <
@@ -1326,7 +1328,7 @@ This method is mainly used to generate 'root_uri' when registering server.
* If there is not directory with the specific files or diretories * If there is not directory with the specific files or diretories
found, the method will return an empty string. found, the method will return an empty string.
lsp#enable_diagnostics_for_buffer() *lsp#enable_diagnotics_for_buffer()* lsp#enable_diagnostics_for_buffer() *lsp#enable_diagnostic_for_buffer()*
Re-enable diagnsostics for the specified buffer. By default diagnostics are Re-enable diagnsostics for the specified buffer. By default diagnostics are
enabled for all buffers. enabled for all buffers.
@@ -1817,8 +1819,8 @@ https://github.com/thomasfaingnaert/vim-lsp-ultisnips
https://github.com/Shougo/neosnippet.vim https://github.com/Shougo/neosnippet.vim
https://github.com/thomasfaingnaert/vim-lsp-neosnippet https://github.com/thomasfaingnaert/vim-lsp-neosnippet
Refer to the readme and docs of vim-vsnip, vim-lsp-ultisnips and vim-lsp-neosnippet Refer to the readme and docs of vim-vsnip, vim-lsp-ultisnips and
for more information and configuration options. vim-lsp-neosnippet for more information and configuration options.
============================================================================== ==============================================================================
Folding *vim-lsp-folding* Folding *vim-lsp-folding*
@@ -1850,7 +1852,7 @@ To display open and closed folds at the side of the window, see
If you want to remove the dashes at the end of the folds, you can change If you want to remove the dashes at the end of the folds, you can change
the fold item of 'fillchars'. the fold item of 'fillchars'.
=============================================================================== ==============================================================================
Semantic highlighting *vim-lsp-semantic* Semantic highlighting *vim-lsp-semantic*
To use semantic highlighting, you need Neovim highlights, or Vim with the To use semantic highlighting, you need Neovim highlights, or Vim with the
@@ -1929,7 +1931,7 @@ want function calls to still use the |Label| group, but use |Identifier| for
\ } \ }
\ }) \ })
< <
=============================================================================== ==============================================================================
License *vim-lsp-license* License *vim-lsp-license*
The MIT License (MIT) The MIT License (MIT)