mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-13 05:31:49 +08:00
Use relative paths when previewing file locations (#2238)
* Use relative paths when previewing file locations Example: ALEFindReferences -relative
This commit is contained in:
@@ -41,16 +41,23 @@ endfunction
|
||||
|
||||
" Show a location selection preview window, given some items.
|
||||
" Each item should have 'filename', 'line', and 'column' keys.
|
||||
function! ale#preview#ShowSelection(item_list) abort
|
||||
function! ale#preview#ShowSelection(item_list, ...) abort
|
||||
let l:options = get(a:000, 0, {})
|
||||
let l:sep = has('win32') ? '\' : '/'
|
||||
let l:lines = []
|
||||
|
||||
" Create lines to display to users.
|
||||
for l:item in a:item_list
|
||||
let l:match = get(l:item, 'match', '')
|
||||
let l:filename = l:item.filename
|
||||
|
||||
if get(l:options, 'use_relative_paths')
|
||||
let l:filename = substitute(l:item.filename, '^' . getcwd() . l:sep, '', '') " no-custom-checks
|
||||
endif
|
||||
|
||||
call add(
|
||||
\ l:lines,
|
||||
\ l:item.filename
|
||||
\ l:filename
|
||||
\ . ':' . l:item.line
|
||||
\ . ':' . l:item.column
|
||||
\ . (!empty(l:match) ? ' ' . l:match : ''),
|
||||
|
||||
Reference in New Issue
Block a user