Git Product home page Git Product logo

Comments (11)

nickeisenberg avatar nickeisenberg commented on June 30, 2024 1

@anku94 Can you try this

    local python_formatter = require("iron.fts.common").bracketed_paste_python
    iron.setup {
      config = {
        ...
        repl_definition = {
          python = {
            command = { "ipython", "--no-autoindent" },
            format = python_formatter,
          }
        }
        ...
      },
      ...
    }

Also I'm not sure why it complained about being set to nil. I have mine set to nil.

from iron.nvim.

anku94 avatar anku94 commented on June 30, 2024 1

This works - thank you!! :)

from iron.nvim.

f3fora avatar f3fora commented on June 30, 2024

Dear @nickeisenberg ,

I think the last approach for formatting python code of the last commits and PRs is not so solid.

I think, parsing and splitting the code, should not be done manually and by case.
I think that you can try to achieve better, more robust and general result with the appropriate tools, e.g. treesitter.

See for example #210

from iron.nvim.

nickeisenberg avatar nickeisenberg commented on June 30, 2024

@f3fora Did send_file or send_until_cursor ever work for you? I had errors with those in the past when only common.bracked_paste was used.

And I understand what you are saying about the formatting, when I have more time I will try and find better way. However, I believe I have a fix your your send_file and send_until_cursor issue now. The latest commit should work now.

from iron.nvim.

f3fora avatar f3fora commented on June 30, 2024

@f3fora Did send_file or send_until_cursor ever work for you? I had errors with those in the past when only common.bracked_paste was used.

It worked until 95383e0 .

And I understand what you are saying about the formatting, when I have more time I will try and find better way. However, I believe I have a fix your your send_file and send_until_cursor issue now. The latest commit should work now.

Thanks. It works. There is still some empty lines that are not required and fill the interpreter.

from iron.nvim.

nickeisenberg avatar nickeisenberg commented on June 30, 2024

I just checkout out the commit prior to the one you referenced. Are you using IPython? send_file works for me on that commit for IPython but it fails when using python3 as the repl_definition.

When I have some time, I'll see about removing that extra line that is added when sending to the terminal. Thanks!

from iron.nvim.

anku94 avatar anku94 commented on June 30, 2024

Same problem, using IPython --no-autoindent with python3.10 - both send_file and send_until_cursor are broken. send_visual and send_line work.

@nickeisenberg maybe try a somewhat "complicated" example? I can try figuring out a reproducible example if you are unable to reproduce.

from iron.nvim.

nickeisenberg avatar nickeisenberg commented on June 30, 2024

@anku94 its still not working after the latest commit to master? I cant produce an example where send_file fails now.

Im going to close this issue as I can't produce a example that causes an error, please reopen a new issue if you have an example that causes a bug though!

from iron.nvim.

anku94 avatar anku94 commented on June 30, 2024

@nickeisenberg sorry for the delayed response, I still seem to have issues.

The extension now seems to separate code blocks by blank lines, and as a result, function definitions with blank lines end up getting passed as separate code blocks. Example code:

def f():
  a = 5

  print(a)

Will produce:

Python 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC
 11.3.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.13.2 -- An enhanced Interactive Python. Type '?' for help.

In [1]: def f():
   ...:     a = 5
   ...: 

In [2]:     print(a)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[2], line 1
----> 1 print(a)

NameError: name 'a' is not defined

This is with both send_until_cursor and send_line.

from iron.nvim.

nickeisenberg avatar nickeisenberg commented on June 30, 2024

@anku94 this is weird, I do not have that issue

def f():
  a = 5

  print(a)
  
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.24.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: def f():
   ...:   a = 5
   ...:   print(a)
   ...: 

In [2]: 

by any chance, does your config look like this?

    iron.setup {
      config = {
         ...
        repl_definition = {python = {command = {"ipython", "--no-autoindent"}}},
        ...
      },

from iron.nvim.

anku94 avatar anku94 commented on June 30, 2024

Yes, that's what my config looks like. I did not have anything for python, and the new update complained about repl_definition.python being set to nil, so I added this.

from iron.nvim.

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.