Skip to content

Commit

Permalink
Remove the count variable from bazel#Execute
Browse files Browse the repository at this point in the history
problem: E46: Cannot change read-only variable "count"
solution: Remove the count variable

By default using "let var = value" tries to set the internal
variable var. To set the local variable, l: prefix should be
used i.e. "let l:var = value".

This issue only affected vim and not neovim.

Closes #4
  • Loading branch information
lakshayg committed Jun 16, 2021
1 parent 761890e commit 6fd9997
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions autoload/bazel.vim
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,15 @@ function! bazel#Execute(action, ...) abort
let targets = []

let i = 0
let count = len(a:000)

" Add all arguments that start with "--" to flags
while i < count && a:000[i] =~ "^--."
while i < a:0 && a:000[i] =~ "^--."
call add(flags, a:000[i])
let i = i + 1
endwhile

" Add everything until we find "--" to targets
while i < count && a:000[i] !~ "^--"
while i < a:0 && a:000[i] !~ "^--"
call add(targets, a:000[i])
let i = i + 1
endwhile
Expand Down

0 comments on commit 6fd9997

Please sign in to comment.