SelfIsThis
See the Python file you're editing as Java-style syntax, side by side, as you type.
Built for people who know Java or C# and are reading Python for the first time —
or the reverse. It isn't a transpiler and the output isn't meant to compile. It's
a reading aid: the same logic, spelled in syntax you already recognise.
What it does
- Live preview. The panel updates as you type, in a side view next to your code.
- Line mapping. Move the cursor in Python and the matching Java lines highlight.
Click a Java line to jump back to its Python source.
- Reads your theme. Syntax colours follow your active VS Code colour theme.
- Comments carry across. Docstrings become Javadoc;
# comments stay where
they were.
- Types are inferred. Annotations are used when present. Otherwise types come
from literals, assignments, and how values are used — including generics like
List<String> and Map<String, Integer>.
- Python-only constructs get explained rather than dropped. Comprehensions
expand into explicit loops.
with is shown as try-with-resources. Keyword
arguments are kept as comments, since Java matches arguments by position.
Requirements
Python 3.7 or newer on your PATH. Only the standard library is used — nothing is
installed, and your code is parsed locally and never leaves your machine.
If python3 isn't the right command on your system, set selfIsThis.pythonPath.
Settings
| Setting |
Default |
What it does |
selfIsThis.pythonPath |
python3 |
Interpreter used to parse your code. |
selfIsThis.debounceMs |
120 |
Delay after a keystroke before refreshing. |
selfIsThis.syncMode |
scroll |
scroll follows the editor's scroll position, cursor scrolls only when the matching line is off screen, off highlights without scrolling. |
Commands
- SelfIsThis: Copy Java preview — copies the current output to the clipboard.
- SelfIsThis: Refresh preview
- SelfIsThis: Toggle line wrapping
Known limits
The output is a reading aid, not compilable Java. Type inference is heuristic, so
anything it can't work out becomes Object or var. Constructs with no Java
equivalent — generators, *args, complex numbers, multiple inheritance — are
annotated with a comment explaining the difference instead of being translated.
Comments inside a restructured construct, such as a comprehension expanded into a
loop, land approximately.
License
MIT