Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

thisProcess.nowExecutingPath #36

Open
davidgranstrom opened this issue Nov 4, 2017 · 9 comments
Open

thisProcess.nowExecutingPath #36

davidgranstrom opened this issue Nov 4, 2017 · 9 comments

Comments

@davidgranstrom
Copy link
Contributor

Something I've missed for a long time in scvim is using thisProcess.nowExecutingPath in a .scd file to get the current buffer's absolute path.

I think the way to achive this is to implement Document support for scvim. I have a proof-of-concept here which works for neovim using the neovim-remote tool. It should be easy to adopt for regular vim as well which already include the --remote-expr flag by default.

Implementing Document for scvim comes with some issues though, because you get a "duplicate class" conflict when using the IDE (ScIDE.sc also implements Document). I have looked at ScelDocument, which inherits another implementation of Document (found in editors/scel), so I'm guessing scel-users suffer the same problem with the "duplicate class" error in the IDE. Maybe someone using emacs/scel could confirm this? I'm hoping there is some way to only include SCVim.sc when running sclang with the -i scvim flag, but I haven't found one yet.

Does anyone with more experience with Document have any thoughts on this?

@davidgranstrom
Copy link
Contributor Author

In order to get the proof-of-concept working I had to start a new nvim instance using nvr foo.scd (even though the documentation of nvr says this should not be necessary) haven't debugged that yet.

@dvzrv
Copy link
Member

dvzrv commented Nov 4, 2017

Last time I looked into that, I found that scvim and scel lack proper implementation. Here's some relevant mailing list doc:
https://www.listarc.bham.ac.uk/lists/sc-dev-2015/msg54676.html

@davidgranstrom
Copy link
Contributor Author

@dvzrv Thanks for the link! Dan's answer worked. After creating scide_scvim/ in SCClassLibrary and symlinked SCVim.sc there I could use both scvim and ScIDE without the duplicate class conflict. So this looks like the correct approach. Now its only a matter of properly implementing the Document class for scvim ^^

@dvzrv
Copy link
Member

dvzrv commented Nov 4, 2017

Hmm, the thing is: scvim is now a submodule. We have to find out, how to do this, so it works out of the box for SuperCollider, when using vim/scvim.

@dvzrv
Copy link
Member

dvzrv commented Nov 4, 2017

Also: Awesome! I never had time to look into it again :)

@davidgranstrom
Copy link
Contributor Author

Yes, for sure. I somehow feel like this approach of putting SCVim.sc in scide_scvim should be the default installation method. I've always had it in my Extensions dir, but then it gets compiled with rest of the class library when using the IDE which shouldn't be necessary when using that environment.

Maybe manually creating scide_scvim/ wherever SCClassLibrary lives and symlinking SCVim.sc there could be added to the installation instruction at some point in the future? (It doesn't matter much now if there is no Document support). It would be nice with an automated approach of course, but it would be hard to know which SCClassLibrary a user is sourcing (if they use the checked out version from git, or the one packaged in SuperCollider.app for instance).

@grirgz
Copy link
Contributor

grirgz commented Aug 7, 2018

Based on @davidgranstrom solution, i've made it work for vim, but this require to start vim in server mode. If I understand correctly, there is no start script, so i guess this up to the user to start vim in correct mode and correct server name

@grirgz
Copy link
Contributor

grirgz commented Aug 7, 2018

see pull request #48

@capocasa
Copy link
Member

capocasa commented Nov 7, 2019

Closed the pull request, as it was, unfortunately- I missed this feature as well. I also didn't know it was working for neovim. I actually thought about this some more, but I just can't justify to myself scvim not behaving identically across platforms in order to support this feature, and also not the code complexity.

I still think is very worthwhile to do, but we need something that's easy on the user- the more I think about it, the more I like the idea of executing an additional command in sclang to set the value that loadRelative needs before executing the proper command, but some thought may be required on how to prevent that idea from breaking stuff. Using a global variable with a long name should work, even with environments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants