Bring your karma
Join the waitlist today
HUMBLECAT.ORG

Blind and Visually Impaired Community

Full History - 2022 - 02 - 09 - ID#sod019
9
How to read Visual Studio Code terminal with NVDA? (self.Blind)
submitted by tace8
Hey, I've been learning to code with NVDA, Visual Studio Code, and Python. I can navigate the 'main' page reasonably well. However, I'm having trouble navigating the terminal and interacting with the 'output' of my code so to speak. In particular right now I'm learning how to use 'help()' to read the descriptions of built-in functions within Python.

The problem is that once I print the help function, for example 'print(help(pow))' and press 'ctrl + f5' to run it, I don't know how to efficiently navigate the terminal using NVDA. After I press 'ctrl + f5', NVDA starts reading the terminal. However, there's a lot of information not related to my code output before it gets to it. Furthermore, when I try to use the numberpad to skip to the code output itself, NVDA defaults to the 'main' page aka where my code is instead of the terminal where my code output is. I've gone into the Visual Studio Code hotkeys to try and find a solution, but wasn't able to find one with those hotkeys. Would appreciate some help, thanks.
AndAdapt 3 points 1y ago
Hi, I have a few tips for this.

1. Download the latest insiders build of VSCODE, there are some great improvements. Nice little audio notifications now. Full support for code folding too.

2. Using the terminal - type out your code then press ctrl-f5. This will run your code. Then press f6, this will move your cursor to the terminal. Then holding ctrl+up arrow to move up the terminal and ctrl+down arrow to move down.

3. If you write some code that needs user input run the code then press f6 followed by return, you can now input on the terminal.

4. Want a cleaner terminal with less information to navigate through. Place the following python code in your file at the top:
Print(“\033c”)

5. If you are on the insiders build, breakpoints can be super handy. They now have a audio notification. Press f9 in your code to add or remove a breakpoint. Run the code with f5 and navigate the terminal like above. Very handy.

Any other questions just let me know. I use VSCODE daily with NVDA.

As others have said depending on what i am doing i will run code through power shell or even Ubuntu on WSL.
LID919 2 points 1y ago
I agree with u/DariusA92. I recommend using an external terminal instead of the integrated one.

PowerShell if you're on Windows. Terminal on Linux or Mac.

You'll have far more control over what that terminal input and output looks like.
tace8 [OP] 2 points 1y ago
Makes sense, NVDA seems to interact with it pretty well, besides the '>>>' spam since I'm using Python lol, though I'm sure there's a way to deal with that too. Also do you copy/paste your code into PowerShell to test it, or is there a better method to transfer code for testing? Thanks.
LID919 3 points 1y ago
No need to copy paste code.

Just save your code to a file, named something like `myfile.py`. Then run the command:

python myfile.py

That will run your code.

I program professionally, and use VS code to do so.

There are advantages and disadvantages to VS Code's integrated terminal. Sometimes I use it, sometimes I don't. When I am not using it, my workflow looks like this:

> Open up Terminal / Powershell
>
> Change to the folder where I am working on my code:
>
> cd MyCode
>
> Open up VS Code in that folder:
>
> code .
>
> Now, I write my code using VS code.
>
> I save the file with a name like `mycode.py`.
>
> Now, switch back to the terminal. Then run the code manually:
>
> python mycode.py

If you need any help or clarification, I'm happy to help.
tace8 [OP] 2 points 1y ago
Thanks, that's better than copy paste
retrolental_morose 2 points 1y ago
you can just rerun by pressing up and enter in the terminal too, of course.
vzjiofdanefnlk 1 points 1y ago
I know this is very late reply.
But how do you scroll up to read the output with power shell?
I can scroll up with control + up and down with vscode, but how do you do that on power shell?
LID919 1 points 1y ago
Control+PgUp scrolls up in PowerShell. The mouse wheel works too.
DariusA92 2 points 1y ago
The last time I used it, the terminal wasn't really useable. I used Command Prompt instead.
tace8 [OP] 2 points 1y ago
Also briefly, is there a reason you would use Command Prompt instead of PowerShell? I've been testing the two of them and how they interact with NVDA and PowerShell seems to make NVDA close every time I open it, so I was wondering if this is why you used Command Prompt
DariusA92 2 points 1y ago
I didn't have this problem. I use it just out of habit. And it sounds a bit smoother than Window PowerShell. You could use Windows PowerShell as well, if the problem with NVDA closing is solved.
LID919 2 points 1y ago
I default to PowerShell on Windows because it's a more fully featured shell with a lot of extra tools and modern syntax.

If it has issues with your reader though, you can use command prompt for this task.
tace8 [OP] 2 points 1y ago
Fair enough, do you use NVDA within the Command Prompt then? In Visual Studio Code and Powershell, both mention PSReadLine was disabled in favor of the active screen reader (NVDA), so I was curious if PSReadLine was potentially better or if it's better to stick with NVDA? Also do you just copy and paste your code into the Command Prompt to test it, or is there a better method? Thanks.
DariusA92 2 points 1y ago
Sorry, not sure what PSReadLine is. I only do some Python programming as an amateur. And yeah, I use NVDA in Command Prompt. While Object Review is active, you can use num pad 7 and 9 to move between lines of output. Works for me pretty well.

And, no you don't have to copy the code. Just open the file you are working on in VS Code. Whenever you make a change in the file and want to test it just save the file in VS Code and then switch to Command Prompt and run the file there. For example, say you are working on a file in the path: D:\MyProject\sample.py. Open Command Prompt and write:

D:

cd MyProject

python sample.py

Your file will run. Now you only have to keep Command Prompt window open and when you want to run the code switch to it, press up arrow once to move on the last command, meaning "python sample.py" and press enter. Don't forget to save beforehand.
tace8 [OP] 2 points 1y ago
Thanks, that works better
This nonprofit website is run by volunteers.
Please contribute if you can. Thank you!
Our mission is to provide everyone with access to large-
scale community websites for the good of humanity.
Without ads, without tracking, without greed.
©2023 HumbleCat Inc   •   HumbleCat is a 501(c)3 nonprofit based in Michigan, USA.