davidgranstrom / scnvim

Neovim frontend for SuperCollider.
GNU General Public License v3.0
191 stars 25 forks source link

[FR]: Support more of Document via SCNvim.luaeval #176

Open madskjeldgaard opened 2 years ago

madskjeldgaard commented 2 years ago

With the inclusion of SCNvim.luaeval in scnvim now, communication between sclang and neovim is tighter than before and I think we can implement a lot more of the methods from Document:

https://doc.sccode.org/Classes/Document.html

We'd have to map some of the neovim api stuff to this class or, alternatively, create a new sub class of Document called NeoVimDocument or something allowing editing features and methods as well as more information exchange between the two.

I think the API as it is now has some limitations, but that said I think a lot of the methods we are missing from Document are now possible to do :)

davidgranstrom commented 2 years ago

Yes, that would be really great!

My suggestion would be to continue implementing the Document API in https://github.com/davidgranstrom/scnvim/blob/main/scide_scnvim/Classes/Document.sc the functions needed for editor synchronization could be implemented in lua/scnvim/document.lua and called from the Document class with luaeval. We should also port the single function in autoload/scnvim/document.vim and move it to the corresponding lua implementation.

paum3 commented 2 years ago

Hi boys, I 've started to mess up with implementing some missing methods (code below), even I am not lua guy. I've stucked with implementing lua code with more lines, or functions. Did you make some progress on this ?

name {
        var name = PathName(this.path).fileName;
        ^name
}

title{
        ^this.name;
}

selectLine { |line|
    var luacode = "vim.api.nvim_command('normal "++line++"G0vL')";
        SCNvim.luaeval(luacode);
}