sjl / splice.vim

A Vim plugin for managing three-way merges.
MIT License
235 stars 21 forks source link

Splice fails to load if any input file is missing #23

Open srathbun opened 10 years ago

srathbun commented 10 years ago

Attempting to open splice with less than four input files results in the following traceback:

"README.markdown" 18L, 672C
Error detected while processing function splice#SpliceInit:
line    2:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/srathbun/.vim/bundle/splice/autoload/splice.py", line 13, in <module>
    import splicelib.init as splice
  File "/Users/srathbun/.vim/bundle/splice/autoload/splicelib/init.py", line 2, in <module>
    import modes
  File "/Users/srathbun/.vim/bundle/splice/autoload/splicelib/modes.py", line 893, in <module>
    loupe = LoupeMode()
  File "/Users/srathbun/.vim/bundle/splice/autoload/splicelib/modes.py", line 433, in __init__
    self._current_buffer = buffers.result
  File "/Users/srathbun/.vim/bundle/splice/autoload/splicelib/util/bufferlib.py", line 52, in result
    return Buffer(4)
  File "/Users/srathbun/.vim/bundle/splice/autoload/splicelib/util/bufferlib.py", line 14, in __init__
    self.name = self._buffer.name
AttributeError: 'Buffer' object has no attribute '_buffer'
line    3:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'SpliceInit' is not defined

This also happens if you have four input files, but some of them are the same file.

Placing a print statement in the init method for buffer shows that the first buffer created is 4, and if there are less than 4 vim buffers, none are matched and the _buffer property is never defined.

errael commented 1 month ago

Hi @srathbun,

I've just released Splice9; it's pure vim9script, no python; it's compatible with the original Splice with additional features, particularly UI. I've addressed some issues against the original Splice (see below) and I'm wondering about this issue.

What are the expectations when there are missing input files? Proper error message then exit? Difftool mode?

Feature: #30, #15, https://github.com/errael/splice9/issues/16

srathbun commented 1 month ago

Hi @errael, it's been years since I thought about this! I can't remember exactly what I was doing at the time, but I believe I was mostly just surprised that putting in the wrong options caused it to explode. Then I was surprised when I tried to get it to use the same file as an input and output.

I would want a proper error message when I give invalid inputs so that I'm getting feedback I can work with.

errael commented 2 weeks ago

Thanks @srathbun. Just added Check file args: 4, unique, must exist with writable result with popup as needed and released v1.0.0. Appropriate, since first thing, when I started porting splice to vim9script in early 2022 was verifying every config value.