Giter VIP home page Giter VIP logo

Comments (9)

tarruda avatar tarruda commented on July 17, 2024

This shouldn't be too hard to implement, I'm gonna give a shot after #34 is merged. Thanks for reporting.

from pynvim.

bjin avatar bjin commented on July 17, 2024

Ping. It will be great to have it implemented.

from pynvim.

tarruda avatar tarruda commented on July 17, 2024

Ping. It will be great to have it implemented.

Sorry, I had completely forgot about this. I'm a bit out of time lately, could you test if this patch fixes the problem? If it does I will merge to master later today.

diff --git a/neovim/api/buffer.py b/neovim/api/buffer.py
index c33c249..e0f7b3b 100644
--- a/neovim/api/buffer.py
+++ b/neovim/api/buffer.py
@@ -115,7 +115,9 @@ class Buffer(Remote):

     def range(self, start, end):
         """Return a `Range` object, which represents part of the Buffer."""
-        return Range(self, start, end)
+        rv = Range(self, start, end)
+        self._session.current_range = rv
+        return rv

     @property
     def name(self):
diff --git a/neovim/api/nvim.py b/neovim/api/nvim.py
index cd9eb4c..f55143c 100644
--- a/neovim/api/nvim.py
+++ b/neovim/api/nvim.py
@@ -229,6 +229,10 @@ class Current(object):
     def tabpage(self, tabpage):
         return self._session.request('vim_set_current_tabpage', tabpage)

+    @property
+    def range(self):
+        return getattr(self._session, 'current_range', None)
+

 class ExtHook(SessionHook):
     def __init__(self, types):

from pynvim.

bjin avatar bjin commented on July 17, 2024

It now gives error AttributeError("'NoneType' object has no attribute 'start'",)

from pynvim.

tarruda avatar tarruda commented on July 17, 2024

Now that I read python-vim documentation more carefully, I saw that this will requires changes on both nvim and the python client. The problem is that the python/pyfile commands can receive ranges but it's not currently being passed to the python provider. Would you mind opening an issue on nvim repository?

from pynvim.

bjin avatar bjin commented on July 17, 2024

I opened a new issue at the main repo.

from pynvim.

tarruda avatar tarruda commented on July 17, 2024

@bjin thanks, I tagged the issue as entry-level. If no one does this until the of next week I will do it myself.

from pynvim.

tarruda avatar tarruda commented on July 17, 2024

@bjin If you update Neovim/python-client to the latest versions this issue should be fixed

from pynvim.

bjin avatar bjin commented on July 17, 2024

Yes, I can verify that it works. Thanks. Closing

from pynvim.

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.