simplenote-vim / simplenote.vim

vim plugin to interact with the simplenote service
http://www.vim.org/scripts/script.php?script_id=3582
MIT License
368 stars 31 forks source link

Random note 'd|..' displays at line 1 #116

Open ChefYeum opened 3 years ago

ChefYeum commented 3 years ago

Every time I open the plugin, it seemingly displays a random note that I didn't create.

The Vim output from SimplenoteList looks like the following:

  1 d|Invoice                                                              [] [Fri, 25 Jun 2021 05:25:18
  2 what                                                                 [] [Mon, 28 Jun 2021 19:09:45]
  3 Invoice                                                              [] [Fri, 25 Jun 2021 05:25:18]
  4                                                                      [] [Fri, 25 Jun 2021 04:59:36]
  5 Anam flat Checklist                                                  [] [Tue, 22 Jun 2021 02:56:06]

In the above output, the notes at Line 2-5 are notes I created and displayed as expected. d|Invoice in Line, however, 1 is not a valid note I generated.

Opening this note outputs the following error:

Error detected while processing function <SNR>62_GetNoteToCurrentBuffer:
line    4:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/chefyeum/Documents/simplenote.vim/autoload/SimplenoteUtilities.py", line 315, in display_n
ote_in_scratch_buffer
    firstline = regex.sub("_", note["content"].split("\n")[0])
TypeError: sequence index must be integer, not 'str'
Press ENTER or type command to continue
atomicules commented 3 years ago

Seems to be linked to this: https://github.com/simplenote-vim/simplenote.vim/blob/3ad229235fbb1a0ace5f8dec381181e62a43f304/autoload/SimplenoteUtilities.py#L159

From what you've posted looks like note 1 and 3 are the same. Not sure why it's displaying twice though.

I'll try to warm up my brain and see if I can reproduce.

Thanks for the report!

ChefYeum commented 3 years ago

@atomicules Please let me know how you get on.

ChefYeum commented 3 years ago

On a different note, may I ask how you set up your debugger for Vim scripts written in Python? I believe I can't just use ordinary debuggers from an IDE?

If I can get the debugger working, I think it will be easier for me to have a look at the issue myself.