Skip to content
This repository has been archived by the owner on Jul 6, 2021. It is now read-only.

The plugin always sets the locations list overwiting an existing one #54

Open
mg979 opened this issue Aug 21, 2020 · 0 comments
Open

The plugin always sets the locations list overwiting an existing one #54

mg979 opened this issue Aug 21, 2020 · 0 comments

Comments

@mg979
Copy link

mg979 commented Aug 21, 2020

  • nvim --version: NVIM v0.5.0-634-g161cdba1e
  • language server name/version: ?
  • Operating system/version: Linux Debian Buster
nvim -c ":checkhealth nvim nvim_lsp"
health#nvim#check
========================================================================
## Configuration
  - OK: no issues found

## Performance
  - OK: Build type: RelWithDebInfo

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=\177
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  - INFO: $VTE_VERSION='5402'
  - INFO: $COLORTERM='truecolor'

health#nvim_lsp#check
========================================================================
## Checking language server protocol configuration
lsp.log

The lsp log remains empty.

Actual behaviour

I set the location list to the list of changes in the working tree with this function:

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Function: git#to_qfix
" Fill the locations list window with git diff hunks
" From GitGutter plugin.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""
function! git#to_qfix()
  " {{{1
  silent! Gcd
  let locations = []
  let cmd = 'git --no-pager diff --no-ext-diff --no-color -U0'
  if exists('g:gitgutter_diff_base')
    let cmd .= ' ' . g:gitgutter_diff_base
  endif
  let diff = systemlist(cmd)
  let lnum = 0
  for line in diff
    if line =~ '^diff --git [^"]'
      let paths = line[11:]
      let mid = (len(paths) - 1) / 2
      let [fnamel, fnamer] = [paths[:mid-1], paths[mid+1:]]
      let fname = fnamel ==# fnamer ? fnamel : fnamel[2:]
    elseif line =~ '^diff --git "'
      let [_, fnamel, _, fnamer] = split(line, '"')
      let fname = fnamel ==# fnamer ? fnamel : fnamel[2:]
    elseif line =~ '^@@'
      let lnum = matchlist(line, '+\(\d\+\)')[1]
    elseif lnum > 0
      call add(locations, {'filename': fname, 'lnum': lnum, 'text': line})
      let lnum = 0
    endif
  endfor
  if !empty(locations)
    call setloclist(0, locations)
    lopen
    ll
  else
    echo '[git.vim] no changes'
  endif
endfunction "}}}

Initially the location list is set (it's not empty and I can see it if I print it with echomsg), but as soon as it switches to a buffer with a lsp client (sumneko_lua in this case) it is replaced by the LSP locations list (it says so in the window statusline). You can see it in this asciicast:

asciicast

Expected behaviour

Well if I set a location list I don't want LSP to mess with it...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant