Git Product home page Git Product logo

Comments (6)

jalvesaq avatar jalvesaq commented on September 16, 2024

Please, review you post. It seems that there is something wrong with the markdown format.

What happens if you end the function with

    }
}

instead of

    }}

from nvim-r.

jalvesaq avatar jalvesaq commented on September 16, 2024

If I copied your code correctly, I think <LocalLeader>ff is getting the function correctly. It does not rely on indentation, and it is getting the nested function completely. If you want to send the outer function to R, you should either put the cursor outside the nested function or mark the block of code and press <LocalLeader>bb.

from nvim-r.

zamaterian avatar zamaterian commented on September 16, 2024

Correct, but since the inner function is part of the lexical scope for the outer function, then the inner function should only be reload in context of the outer function. Not in the global scope.

A similar case is when you have a tryCatch function, where you have defined error, warning, interrupt function. You need to move to the outer function outside of the tryCatch to reload/ otherwise you get an compile error.

from nvim-r.

jalvesaq avatar jalvesaq commented on September 16, 2024

Certainly you are right for most use cases, but in some circumstances the user might want to test only the inner function. Anyway, it would be too complicated to implement a smart algorithm that decides what to send to R based on context. Unless someone is wanting to implement this, it might be better to remove the functionality triggered by <LocalLeader>ff than having the currently broken one.

We already have an alternative in the plugin: to send a marked block of lines. The user has only to press, for example, ma before the lines that must be sent and mb after them to mark the block and, then, press <LocalLeader>bb. In the Nvim-R documentation I suggest the use of vim-signature plugin to make the marks visible.

from nvim-r.

zamaterian avatar zamaterian commented on September 16, 2024

I would probably keep the current imp; maybe change the documentation to indicate it only loads current function scope.

I could probably try to cook something together like <localleader>ft (reload toplevel function in scope).

I think I have a hackup unction somewhere that does it for clojure.

from nvim-r.

jalvesaq avatar jalvesaq commented on September 16, 2024

I added a note on this other limitation to section 5.3 (6428766).

from nvim-r.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.