Comments (11)
@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.
This works - thank you!! :)
from iron.nvim.
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.
@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 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
andsend_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.
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.
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.
@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.
@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.
@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.
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)
- On start error, the REPL window closes immediately so one can't read the error
- config broken? HOT 2
- basic config leads to python unexpected indent HOT 7
- Allow 'cwd' option on repl_definition? Potential PR HOT 1
- repl on the bottom makes status window disappear HOT 1
- code is sent to the ipython console but not run HOT 16
- iron.core not found with LazyVim HOT 1
- Why am I not able to resize the REPL window/split? HOT 2
- How to detach from the IronFocus window HOT 4
- Connect to python kernel and virtual environment
- Abandoned? HOT 2
- Highlights randomly appears and disappears
- How to resize REPL window HOT 1
- Fix broken tests
- Error Using Visual Send with IPython -- Identical issue with closed issue 225 HOT 1
- close option gets ignored when sending one line HOT 2
- Visual selection sent and evaluated line-by-line rather than as a chunk HOT 5
- Error from fts/common.lua attempt to index python
- [feature request] images in REPL
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iron.nvim.