No More Python Docstring Despair: Highlight Them in VSCode!
Python Visual Studio Code autoDocstring Configuration - Stack Overflow
Wrote an open source VSCode plugin to generate docstrings, using a self-hosted server
AI written docstrings for your Python code
Hey everyone!
I'm excited to share a simple yet effective tool I've developed that's all about enhancing your Python coding experience in VSCode. We all know how Docstrings are crucial for understanding and documenting our Python code, but they often blend into the background, treated as standard comments in VSCode. This can make them harder to read and differentiate from the rest of your code.
That's why I created a Python Docstring Highlighter for VSCode that recognizes the main styles (Google, NumPy, and Sphinx). This extension not only makes your code more readable but also allows you to customize the highlighting to fit your theme, making your coding environment as comfortable and productive as possible.
Python Docstring Highlighter Demo (google style)Whether you're documenting your own project or navigating through others', this extension is designed to make your life easier and your code more accessible. Give it a try and see the difference for yourself!
Source code
Install extension (VSCode)
Looking forward to your feedback and suggestions. Happy coding!
You have to go to:
File > Preferences > Settings in Windows/Linux
Code > Preferences > Settings in Mac
Then choose at the right side of the open document if you want to change the configuration for all the user sessions or only this workspace.
The workspace case would be:
{
"autoDocstring.docstringFormat": "sphinx"
}
When moving the mouse around the option, a little pencil appears that shows all the accepted values for the option.
This answer is almost the same as PyCharm generates on vscode with this shortcut ctrl+sfhit+2
{
"autoDocstring.docstringFormat": "sphinx"
}
Hi, Pythonistas
I wanted to share something I’ve worked on recently: I wrote a proof of concept plugin for VSCode to generate docstrings.
You can find it on GitHub: https://github.com/paolorechia/oasis
It is open source and runs completely local, using a Large Language Model of permissive license (Salesforce Codegen).
This means you can use this in any scenario, even if you don’t have access to GitHub Copilot or other tools that share your code through the cloud.
It works by using a library called guidance, which improves how well the model generation fits into the expected format.
With this we can use the smaller models that run on CPU and still generate docstrings in the correct format.
For instance, I can have the inference server running on an 2019 intel MacBook Pro and it runs smoothly when using Salesforce/Codegen-350M.
Of course, it’s still just a proof of concept, but I think this shows some potential on having open source codegen tooling.
I also wrote a Medium article describing the development process of this plugin, which you can find in the git repository’s README.
Thanks for reading this post, cheers!