Date 1 - 4 of 4
setting up VS Code for Add-on development
I'm looking into setting VS Code up for add-on development, making sure to have the NVDA source, flake file etc. in the right places in order to make code completion, peek definition etc work properly.
While I see that vs code config was added for this a month or so back, the documentation is rather brief. I aim to resolve that by making a PR against the current readme of the addon template, but for that to work I first need to understand how it's actually meant to work.
From what I understand:
- We have an outer folder for the project.
- Within the outer folder, we clone both the addon template repo as well as the NVDA source repo.
- The .vscode folder within the addon template repo assumes the nvda repo folder is on the same level as the addon repo folder, and should stay within the addontemplate folder.
- the various files should be copied out of the template folder and into the outer folder, so they are now on the same level as the two repo folders. think buildVars.py and friends.
- Now we make a new folder , addon, which holds the actual addon code, within the project folder.
- Finally, we open the project in VS Code.
A few questions:
- Is this indeed the correct procedure?
- Is one to open the outermost project folder in vs code, or the inner empty addon folder?
- Should the actual addon template folder be within the project folder, or just the folders/files that the addon template readme tells you to copy? In the latter case, where does .vscode go? I'm having a bit of trouble figuring out if ../nvda within .vscode/settings.json refers to the folder outside of .vscode, or the folder outside the folder .vscode is in.
If all this information is already out there, feel free to refer me to relevant documentation, but I am going purely by the addon template readme and not really getting anywhere. Either I get no code completion at all, or I get thousands of problems in my problems view depending on where I open VS Code. Some guidance very welcome.
Hello:toggle quoted message Show quoted text
Really I'm not good writing documentation and I prefer to read brief
explanations unless things are very complex, so please feel free to
send a PR to improve it.
You can proceed as follows:
1. Create a folder where you want to store various repos.
2. Clone the NVDA's project in this folder:
git clone --recursive https://github.com/nvaccess/nvda.git
3. Create a folder for your add-on, inside the variousReposFolder.
Store the files contained in the add-on template: an addon subfolder
where you will include the folders and files of your add-on, for
example, globalPlugins, appModules etc.
4. In the root folder of your add-on, copy the .vscode folder included
in the add-n template, and flake8.ini file.
5. Go to your desktop (windows+n, and open Visual Studio code. I have
it in the taskbar, position 9 in my case, and I open it pressing
6. When you run Visual Studio Code, press control+k and then
control+o, to select the folder you want to open. Search for the
folder of your add-on, the root folder, and then don't press Enter.
Instead press the button Select folder of this dialog.
7. Once opened this workspace, you can search for individual Python
files, or GitHub .yaml etc, to be opened. Use f6 and other commands of
Visual Studio Code. Use control+shift+m to detect possible problems.
Please let us know if you have any questions or if this doesn't work for you.
2023-03-20 2:25 GMT+01:00, Florian Beijers <florianbeijers@...>:
toggle quoted message Show quoted text
After some more monkeying around I figured it out. I am still running into an issue with scons source on the NVDA side where the MIDL.exe step is failing because midl.exe can't find objidl.idl, but that is likely due to my using a preview version of vs 2022.
I actually did submit a PR to the readme of the addon template so feel free to look that over :)
Op ma 20 mrt 2023 om 20:10 schreef Noelia Ruiz <nrm1977@...>:
Thanks. I'll see it, though the template is maintained by Joseph.toggle quoted message Show quoted text
Cheers and hope you can fix your current issues
2023-03-20 20:38 GMT+01:00, Florian Beijers <florianbeijers@...>:
|1 - 4 of 4|