Re: NVDA addon creation development environment #addon

James Scholes

I don't think this is going to work the way you want. When you say:

cloned nvda-vscode into the root of that folder under .vscode
... I assume you're referring to this:

But AFAIK, that is only for development of NVDA itself, rather than add-ons.

I've been out of the loop for a while, so someone can correct me if I'm wrong. But my understanding is that to date, nobody has created a method of accessing and testing NVDA-specific Python modules without a running copy of the screen reader. Even if they had, several parts of NVDA depend on others which cannot yet be instantiated outside of the context of a running copy. That may change in the future, or someone may come up with mocked objects for testing purposes.

In terms of your test module not appearing to be present, it's because code is no longer loaded from %appdata%\roaming\nvda\appModules. You'll need to enable the developer scratchpad in Settings -> Advanced, and then use %appdata%\roaming\nvda\scratchpad\appModules instead.

In many ways, NVDA add-on development is still in its infancy. Nobody does TDD, for example, because there isn't yet a way to facilitate it. The same extends to support within an IDE. Contributions in this arena are very much welcome though!


James Scholes

On 10/02/2020 at 3:46 pm, Florian Beijers wrote:
So first, if this isn't the place to ask this question, please let me know. It seemed the most suitable, but I might have missed a resource :)
I am trying to create a development environment for creating addons based on Visual Studio Code. I am running into a bit of a snag though, hoping someone here might know what I am missing. My steps:
- recursively cloned nvaccess/nvda
- cloned nvda-vscode into the root of that folder under .vscode
- Opened the folder using file -> open folder... in Visual Studio Code Insiders.
- As a test, I wanted to build the example in the developer guide to see if intellisense and such would come up. So I added %appdata%\roaming\nvda\appModules to the workspace.
- Selected my python interpreter as being python 3.8.1 32-bit within the global scope for both folders in the workspace, this setting invoked through a gesture appears to be folder-specific rather than workspace-wide.
- Created a new file within appModules called with the following content:
import appModuleHandler
class AppModule(appModuleHandler.AppModule):
After doing all this, these are my observations:
- The visual studio code problems view reports appModuleHandler could not be imported.
- Similarly, autocomplete does not come up for NVDA-specific options.
- My appModule is not loaded according to nvda+ctrl+f1. However, that could have to do with the pass statement, does that unload the module?
A few questions:
- Does anyone see something obvious I might have missed?
- When I run scons source to prepare the source tree, scons tells me it can't find python 3.7-32. This is true, I don't have that specific version of Python installed. Is that why this is happening?
- Am I on completely the wrong track and can I get NVDA's python context into VS Code some other way?
Thanks a bunch for any help :)

Join to automatically receive all group messages.