lacygoill / vim9asm

17 stars 0 forks source link

Some hints improvements #6

Open monkoose opened 2 years ago

monkoose commented 2 years ago
  1. There is only one instruction per line, not sure why it is required to put cursor on instruction word to show it.
  2. Maybe would be good to show virtual text of instructions instead of popup window with some option. Maybe even for every line (so cursor movement would not be required).
monkoose commented 2 years ago

Not related to the issue. Just some question i'm not sure where to ask (can i reach you somewhere besides github or some other users interested in vim9?).

disassembly of the add(list, val) with list and val as previouly defined variables for me shows something like

LOAD $0
LOAD $1
    # /home/monkoose
DROP

Do you know what is going on here?

lacygoill commented 2 years ago

There is only one instruction per line, not sure why it is required to put cursor on instruction word to show it.

Because when I implemented the feature, I didn't want to compute the right position for the popup, so I left that issue to popup_atcursor() which requires the cursor to be on the instruction name.

As a benefit, it gives more control to the user. They decide when the popup should be displayed by moving the cursor in/out of the instruction name. I don't like the popup being always displayed. It might hide something which I want to read. And I don't want to run a command every time that happens. I prefer to simply move the cursor at the start of the line.


Maybe would be good to show virtual text of instructions instead of popup window with some option. Maybe even for every line (so cursor movement would not be required).

I tried to implement the feature in this commit. Not sure how well it works. I prefer a single popup, over virtual texts for all instructions (that adds too much noise).


can i reach you somewhere besides github or some other users interested in vim9?.

Sorry, I don't have any other account, and I don't know any place dedicated to Vim9 script.

I thought about asking to set up discussions on the Vim repo for users which want to ask questions or share snippets of code, but I'm not sure the request would be accepted.

I also thought about asking if people were interested in creating a plugins repo owned by the Vim organization. The goal would be to re-write some default legacy plugins in Vim9 (netrw, matchit, ...). Taking inspiration from vim/colorschemes which has succeeded in re-writing old color schemes.

It could help reduce the number of issues opened on the main repo.

Not sure enough people would be interested in working on such a project though.


disassembly of the add(list, val) with list and val as previouly defined variables for me shows something like

Sorry, but I can't reproduce the issue:

vim9script
def g:Func()
    var list = []
    var val = 123
    add(list, val)
enddef
disassemble g:Func
Func
    var list = []
   0 NEWLIST size 0
   1 STORE $0

    var val = 123
   2 STORE 123 in $1

    add(list, val)
   3 LOAD $0
   4 LOAD $1
   5 LISTAPPEND
   6 DROP
      7 RETURN void