# Autocomplete code lines for slicer in an IDE?

**URL:** <https://discourse.slicer.org/t/autocomplete-code-lines-for-slicer-in-an-ide/7390>\
**Category:** Support\
**Created:** [July 2, 2019, 10:05pm UTC](https://discourse.slicer.org/t/autocomplete-code-lines-for-slicer-in-an-ide/7390 "2019-07-02T22:05:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amine](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/amine/32/4844_2.png) [@Amine](https://discourse.slicer.org/u/Amine)\
**Post date:** [July 2, 2019, 10:05pm UTC](https://discourse.slicer.org/t/autocomplete-code-lines-for-slicer-in-an-ide/7390/1 "2019-07-02T22:05:47Z")

</div>

new to slicer development, saw this tutorial and they seem to use an IDE that supports autocompleting statements unique to slicer as in the python interactor:

https://www.youtube.com/embed/njoTEisxAJ4?feature=oembed&wmode=opaque&list=PLJWCUXz3GeAfmYLiFcKus_c0jcsMnVsgb

what IDE could i use for that feature ( or how to add slicer API support to IDEs like pycharm?)  
Thanks for your help.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 3, 2019, 1:22pm UTC](https://discourse.slicer.org/t/autocomplete-code-lines-for-slicer-in-an-ide/7390/2 "2019-07-03T13:22:47Z")

</div>

The easiest and most robust way of getting auto-complete in an IDE is to [attach a Python debugger](https://www.slicer.org/wiki/Documentation/Nightly/Developers/Tutorials/Debug_Instructions) put a breakpoint in the code where you want to add more code, and make the code stop there.

Auto-complete without debugging relies on static code analysis, which does not work very well for the dynamically constructed Python-wrapped C++ objects that Slicer and its libraries use, but you can give it a try. Specify “PythonSlicer” executable as your Python interpreter for the IDE. I’ve found that Eclipse (LiClipse) auto-complete and documentation lookup works reasonable well. Last time I tried, PyCharm’s skeleton generation failed for many components. I have [reported the issue](https://youtrack.jetbrains.com/issue/PY-31590), but there was no follow-up. The issue can be fixed manually by patching of the skeleton generator, but maybe Python wrapping of VTK should be improved instead to make it more friendly to current IDEs.

---

<div class="post-metadata">

**Author:** ![Amine](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/amine/32/4844_2.png) [@Amine](https://discourse.slicer.org/u/Amine)\
**Post date:** [July 3, 2019, 1:41pm UTC](https://discourse.slicer.org/t/autocomplete-code-lines-for-slicer-in-an-ide/7390/3 "2019-07-03T13:41:09Z")

</div>

i will try that, thanks a lot!!

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [July 8, 2019, 1:43pm UTC](https://discourse.slicer.org/t/autocomplete-code-lines-for-slicer-in-an-ide/7390/4 "2019-07-08T13:43:54Z")

</div>

> [@lassoan](#):
>
> but maybe Python wrapping of VTK should be improved instead to make it more friendly to current IDEs

Would have some more specific feedback regarding this ?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 9, 2019, 3:24am UTC](https://discourse.slicer.org/t/autocomplete-code-lines-for-slicer-in-an-ide/7390/5 "2019-07-09T03:24:21Z")

</div>

I think this is already on David Gobbi’s radar - see for example [https://discourse.vtk.org/t/vtk-8-2-python-and-vscode/704/3](https://discourse.vtk.org/t/vtk-8-2-python-and-vscode/704/3)

---

<div class="post-metadata">

**Author:** ![park](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/park/32/5717_2.png) [@park](https://discourse.slicer.org/u/park)\
**Post date:** [February 3, 2025, 2:08pm UTC](https://discourse.slicer.org/t/autocomplete-code-lines-for-slicer-in-an-ide/7390/6 "2025-02-03T14:08:28Z")

</div>

Hello,

I understand that Slicer’s Python auto-complete is not fully supported. [Through previous discussions and various configuration attempts](https://discourse.slicer.org/t/developing-slicer-modules-in-visual-studio-visual-studio-code/9496/25), I was able to confirm that auto-completion works to some extent when Slicer is connected to a debugger. However, after resetting my VSCode settings to reproduce the setup, I found that while debugging still works fine, auto-completion no longer functions.

Would you happen to know if there are any additional settings required to enable auto-completion while debugging? Also, I would appreciate any suggestions on how to improve the development experience.

Thank you in advance for your guidance.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [February 10, 2025, 4:41pm UTC](https://discourse.slicer.org/t/autocomplete-code-lines-for-slicer-in-an-ide/7390/7 "2025-02-10T16:41:24Z")

</div>

Personally I find the python console in Slicer the best way to debug and autocomplete. I don’t find existing IDEs as useful,

With some extra work, the [ScriptEditor](https://github.com/SlicerMorph/SlicerScriptEditor) code could be made really powerful for development and debugging, since it has access to everything needed during the completion callback (it can introspect the python API in addition to already allocated variables). If people have time to invest that’s where I would focus.
