PyCharm has this very useful warnings where it underlines/highlights any problematic code and give you hints of how to fix it, like when you hint a variable type and then you provide another type: var: int = ~"Hello World!"~.
Or when you are typing a indented code, but you forget to add the colons
for i in range(3)~~
print("Hello World!")
And also give you hints about the "cleanness" of your code to follow the PEPs, like if you type ~a=2*4~ it will tell you to write a = 2 * 4.
All this little hints seem very useful, specially for a beginner, but when I chose to use jupyter lab as my IDE, I discovered that there was almost no hints; To get the errors you have to run the code each time to check you didn't missed any vital part, and then solve one by one the problems that prevent the code from running.
I'm new, so maybe there is an option that was there and I haven't noticed, but in case there is not, is there any way to instal a warning system for Jupyter Lab, specially one that detects the two first issues.
P.D.: I apologise if the I wasn't clear, I'm not really sure about the terminology for this warnings, and thank you in advance.
The jupyterlab-lsp extension includes in-code diagnostics and features a diagnostics panel:
The small triangle on the screenshot indicates missing colon; the triangle indicator is only available in jupyterlab-lsp 5.0 targeting JupyterLab 4.0+ which is currently in pre-release but can be installed using
pip install --pre jupyterlab-lsp. This and older versions include the underlines, and other highlights (e.g. strike-through for deprecated messages).On the screenshot above it did not detect the type issue because function was malformed (no colon), but when there is no syntax errors it highlights type issues correctly:
With jupyterlab-lsp you are not limited to any single implementation of the linting service - you can for example use:
Since JupyterLab 4.0 some of the LSP code is shipped by default but the extension installation is required because the LSP features are opt-in.