How can I enable file path autocompletion in the IPython console in PyCharm?

Propadovic Nenad <[email protected]> Tue, 22 Aug 2017 14:36:55 +0200
Newsgroups gmane.comp.python.ipython.devel
Message-ID <CAD0yHOzQ_ggP2UHjD4KSQwBJ-q8jCqa6CFybPsD-OoFgxOYqDg@mail.gmail.com>
--===============2735407317938539439==
Content-Type: multipart/alternative; boundary="001a113b9bbac9b967055756d9e0"

--001a113b9bbac9b967055756d9e0
Content-Type: text/plain; charset="UTF-8"

(I hope that sending variations of the same question to StacKOverflow,
Reddit and here is not considered spamming...)

Path autocompletion in the IPython console in PyCharm does not work well:

c:/U<TAB>

should autocomplete to:

cd c:/Users/

on my machine; instead, the best it manages is:

cd c:/UserWarning

which is plain wrong. IPython in the Anaconda prompt, however, behaves as
it should.

My strong assumption is that this is due to PyCharm not using the standard
IPython configuration files.

I'm aware of the console starting script ins PyCharm:

Settings->Build, Execution, Deployment->Console->Python console

and I've successfully used it to activate a simple magic command I've
written.

So here my question: is there a code configuration snippet that could be
inserted there, and that could just enable file path autocompletion? Or a
pointer to a general description on how IPython configuration files "work",
that would enable me to figure it out myself? That is, I imagine, the most
doable hack that would solve the problem for the time being.

Alternatively, any experiences with writing your own autocompletion using
the following libraries:

IPython.core.completer
IPython.core.completerlib

?

Is that doable? How much work can that be?

Thanks in advance!

Nenad

-----------------------------

Links supporting claims in the question(s) above:

1) Autocompletion in IPython console in PyCharm not working as it should

On StackOverflow there are three questions with similar wording, but not
one substantial answer:

https://stackoverflow.com/questions/32542289/pycharm-ipython-tab-completion-not-working-within-python-console
https://stackoverflow.com/questions/35612338/how-to-set-ipython-profile-in-pycharm
https://stackoverflow.com/questions/32458158/pycharm-python-console-autocompletion

(No, using Ctrl+Space instead of Tab does not solve anything.)

JetBrains (creators of PyCharm) know about this since, at least, two years:

https://intellij-support.jetbrains.com/hc/en-us/community/posts/205820389-Console-tab-completion-

and seems to have started working on it, but never finished it. Discussion
states " this is only the initial step to getting full IPython tab
completions": https://youtrack.jetbrains.com/issue/PY-9345 . But the issue
is closed since October 2016:
https://github.com/JetBrains/intellij-community/pull/440

2) PyCharm not using ipython_config.py to configure IPython Console:

https://intellij-support.jetbrains.com/hc/en-us/community/posts/206603035-Which-ipython-config-py-is-used-to-configure-IPython-for-Python-Console-

-----------------------------

My setup: PyCharm Community Edition 2017.2.1 Anaconda 2 (Python 2.7),
version 4.3.22 which contains IPython 5.1.0 on Windows 7 Professional N

--001a113b9bbac9b967055756d9e0
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail-usertext-body gmail-may-blank-within g=
mail-md-container"><div class=3D"gmail-md"><p>(I hope that sending variatio=
ns of the same question to StacKOverflow, Reddit and here is not considered=
 spamming...)<br></p>

<p>Path autocompletion in the IPython console in PyCharm does not work well=
:   </p>

<pre><code>c:/U&lt;TAB&gt;=20
</code></pre>

<p>should autocomplete to:</p>

<pre><code>cd c:/Users/
</code></pre>

<p>on my machine; instead, the best it manages is:</p>

<pre><code>cd c:/UserWarning
</code></pre>

<p>which is plain wrong. IPython in the Anaconda prompt, however, behaves a=
s it should.</p>

<p>My strong assumption is that this is due to PyCharm not using the standa=
rd IPython configuration files.</p>

<p>I&#39;m aware of the console starting script ins PyCharm:</p>

<pre><code>Settings-&gt;Build, Execution, Deployment-&gt;Console-&gt;Python=
 console
</code></pre>

<p>and I&#39;ve successfully used it to activate a simple magic command I&#=
39;ve written.</p>

<p>So here my question: is there a code configuration snippet that could
 be inserted there, and that could just enable file path autocompletion?
 Or a pointer to a general description on how IPython configuration=20
files &quot;work&quot;, that would enable me to figure it out myself? That =
is, I=20
imagine, the most doable hack that would solve the problem for the time=20
being.</p>

<p>Alternatively, any experiences with writing your own autocompletion usin=
g the following libraries:</p>

<pre><code>IPython.core.completer
IPython.core.completerlib
</code></pre>

<p>?</p>

<p>Is that doable? How much work can that be?</p>

<p>Thanks in advance!</p><p>Nenad<br></p><p>-----------------------------</=
p>

<p>Links supporting claims in the question(s) above:</p>

<p>1) Autocompletion in IPython console in PyCharm not working as it should=
</p>

<p>On StackOverflow there are three questions with similar wording, but not=
 one substantial answer:</p>

<p><a href=3D"https://stackoverflow.com/questions/32542289/pycharm-ipython-=
tab-completion-not-working-within-python-console">https://stackoverflow.com=
/questions/32542289/pycharm-ipython-tab-completion-not-working-within-pytho=
n-console</a>
<a href=3D"https://stackoverflow.com/questions/35612338/how-to-set-ipython-=
profile-in-pycharm">https://stackoverflow.com/questions/35612338/how-to-set=
-ipython-profile-in-pycharm</a>
<a href=3D"https://stackoverflow.com/questions/32458158/pycharm-python-cons=
ole-autocompletion">https://stackoverflow.com/questions/32458158/pycharm-py=
thon-console-autocompletion</a></p>

<p>(No, using  Ctrl+Space instead of Tab does not solve anything.)</p>

<p>JetBrains (creators of PyCharm) know about this since, at least, two yea=
rs:</p>

<p><a href=3D"https://intellij-support.jetbrains.com/hc/en-us/community/pos=
ts/205820389-Console-tab-completion-">https://intellij-support.jetbrains.co=
m/hc/en-us/community/posts/205820389-Console-tab-completion-</a></p>

<p>and seems to have started working on it, but never finished it.=20
Discussion states &quot; this is only the initial step to getting full=20
IPython tab completions&quot;: <a href=3D"https://youtrack.jetbrains.com/is=
sue/PY-9345">https://youtrack.jetbrains.com/issue/PY-9345</a> . But the iss=
ue is closed since October 2016: <a href=3D"https://github.com/JetBrains/in=
tellij-community/pull/440">https://github.com/JetBrains/intellij-community/=
pull/440</a></p>

<p>2) PyCharm not using ipython_config.py to configure IPython Console:</p>

<p><a href=3D"https://intellij-support.jetbrains.com/hc/en-us/community/pos=
ts/206603035-Which-ipython-config-py-is-used-to-configure-IPython-for-Pytho=
n-Console-">https://intellij-support.jetbrains.com/hc/en-us/community/posts=
/206603035-Which-ipython-config-py-is-used-to-configure-IPython-for-Python-=
Console-</a></p>

<p>-----------------------------</p><p>My setup:=20
PyCharm Community Edition 2017.2.1
Anaconda 2 (Python 2.7), version 4.3.22
which contains
IPython 5.1.0
on Windows 7 Professional N</p>
</div>
</div></div>

--001a113b9bbac9b967055756d9e0--

--===============2735407317938539439==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
IPython-dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/ipython-dev

--===============2735407317938539439==--