You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please consider adding type stubs. Without static type information, it feels like walking in total darkness: no auto-completion, no types, no parameters, nor return values—nothing. It is very easy to introduce bugs, and you just can't predict what will happen in the code.
I made my own stubs based on PythonScript docs and Scintilla docs, but due to the lack of details and my zero prior experience with stubs, especially for code that interfaces with C++, I'm afraid they can't be fully correct without some help.
Let me know if you are interested in adding my type stubs to the project. I can open a pull request with the necessary changes for you to review.
Afaik boost::python offers no possibility to create the pyi files automatically from the C++ sources. Another problem could be how to use PythonScript and where to place the resulting Npp.pyi file. Currently I create my stubs file by querying the Npp object itself.
@chcg
I'm not sure, but can we have a workflow action which starts Npp and the file would be created via the startup.py?
Now I'm confused, PythonScript is a Notepad++ plugin and its only purpose is to be used with Notepad++. So... why would someone use VSC, for example, to write a script to be used with Notepad++?
Notepad++ serves another purpose, and it's not worth making an IDE out of it.
I do my PythonScripting development with N++; PS dev doesn't really have power IDE features (e.g. debug), but it could more easily have the stuff being discussed in this issue. There are some other efforts underway, e.g. LSP...
@chcg – I have updated the gist, the script is now more robust than before and only contains three special cases, all of which are simple ifs and have been documented.
Activity
Ekopalypse commentedon Jul 11, 2024
Afaik boost::python offers no possibility to create the pyi files automatically from the C++ sources. Another problem could be how to use PythonScript and where to place the resulting Npp.pyi file. Currently I create my stubs file by querying the Npp object itself.
@chcg
I'm not sure, but can we have a workflow action which starts Npp and the file would be created via the startup.py?
tooruu commentedon Jul 11, 2024
I place Npp.pyi in the Scripts directory of the plugin, where all script files reside. This way the IDE picks it up automatically during development.
Ekopalypse commentedon Jul 11, 2024
but if you use e.g. a local Python installation and pyls, then the search path knows nothing about PythonScript directories.
alankilborn commentedon Jul 12, 2024
Which IDE?
The IDE I'd like to see do this (auto-completion, types, parameters, return values) is N++ itself. :-)
tooruu commentedon Jul 12, 2024
PyCharm/VSC. IMO Notepad++ serves another purpose, and it's not worth making an IDE out of it.
Ekopalypse commentedon Jul 12, 2024
Now I'm confused, PythonScript is a Notepad++ plugin and its only purpose is to be used with Notepad++. So... why would someone use VSC, for example, to write a script to be used with Notepad++?
alankilborn commentedon Jul 12, 2024
I do my PythonScripting development with N++; PS dev doesn't really have power IDE features (e.g. debug), but it could more easily have the stuff being discussed in this issue. There are some other efforts underway, e.g. LSP...
chcg commentedon Oct 3, 2024
@Ekopalypse What is necessary to create such a pyi file? I think it is sufficient to create it together with my local runs of https://github.com/bruderstein/PythonScript/blob/master/PythonScript/src/CreateWrapper.py when syncs from N++ are done.
Ekopalypse commentedon Oct 4, 2024
@chcg - thank you for your continued commitment to the PythonScript project.
To create the stubs file, I use this script.
Without your recent changes, this would create an incorrect file.
Also, if you look at the code, you'll notice that
NppReMatchis ignored because it looks like it's not being used by any Npp method.Let me know if there is anything else I can help you with.
Ekopalypse commentedon Mar 9, 2026
@chcg – I have updated the gist, the script is now more robust than before and only contains three special cases, all of which are simple ifs and have been documented.