nrf-connect app with west workspace vscode configuration.

Hi.

We have an application (nrf connect 2.7.0). the applications is based on sys build and is encapsulated in a west workspace.

so the app folder includes west.yml, app folder with the app CmakeList.txt and driver directory etc...

Much like the example for the very same structure in here : https://github.com/nrfconnect/ncs-example-application there is no .vscode/settings.json file in the repo, also i have added it to .gitignore.

I was sure west init will take care of it, though it doesn't.

So after west init && west update and

cd my-app-in_west_ws
code .

the vscode identifies the workspace and nrf-connect sdk version, but not the app, i can't add build configuration, even though it's a standalone app.

The only thing i can do is manually add a workspace config file.

I was sure the nrf-connect plugin will have some automatic way to do it, am i missing something ?

Parents
  • Hi Eyal_Gal,

    From which folder are you opening VS Code? If you want the app detected automatically, you need to open the app folder.

    Otherwise, you need to add the application manually by using the "Open an existing application" action.

    Please also go over the nRF Connect for VS Code Extension guides: Guide overview (nordicsemi.com).

    Hieu

  • 1. i have opened the app from the my-app-in_west_ws as i wrote above, the parallel from the nrf-connect example is the ncs-example-application. indeed it's not the app folder. it's one folder up the chain, the one that contains the sysbuild file.

    2. i did try to "open an existing application" action, i get "this folder does not contain nrf-connect application" error. As i said the only thing i could do is edit the workspace settings json manually and edit it.

    3. if non of the above work (i'll check it with the app folder, if that works, ok, it's a start) then except manual action there is no automatic handling for that ?

  • just tried opening the 'app' folder, still .vscode/settings.json was not created.

  • Eyal_Gal said:

    1. i have opened the app from the my-app-in_west_ws as i wrote above, the parallel from the nrf-connect example is the ncs-example-application. indeed it's not the app folder. it's one folder up the chain, the one that contains the sysbuild file.

    2. i did try to "open an existing application" action, i get "this folder does not contain nrf-connect application" error. As i said the only thing i could do is edit the workspace settings json manually and edit it.

    I have actually attempted to reproduce your issue before my last answer. However, things work correctly for me. I also verified both opening the app folder and adding an application via the "Open an existing application" action.

    Thus, I understand that you said it is similar to the ncs-example-application, but I would still like to check.

    Eyal_Gal said:
    still .vscode/settings.json was not created.

    This folder isn't necessarily created at all times. Only when something about the editing session should be saved that it is created.

    You could try to change the toolchain version, and it should be created just fine.

  • it's unfortunate that it doesn't reproduce for you, however it does on my pc ( i tried several times).

    Since i'm workig with ncs 2.7.0 and it was recommended to work pre-release vs code extension ncs-for-vscode extension. If you work on the release version then it might explain the diff. I understand the current vscode release version does not play ball with ncs 2.7.0. 

  • I am using NCS v2.7.0, and the pre-release version of the nRF Connect VS Code extension, yes.

    For reference, this is my workspace structure:

    Do you see any major differences compared to yours?

  • thanks Heiu, it looks very much like my setup and in addition the fact that we are using the same version of the extension and the SDK makes it even stranger, i'll try today again with a fresh workspace from the example. If it wont work i'll try inside a vritual machine with a fresh install of VScode, you say it i open the app folder then the .vscode/settings.json should be created automatically, correct ?
    And if not but i use "open existing application" and open for instance the folder ncs-example-application and it should generate it as well, correct ?

Reply
  • thanks Heiu, it looks very much like my setup and in addition the fact that we are using the same version of the extension and the SDK makes it even stranger, i'll try today again with a fresh workspace from the example. If it wont work i'll try inside a vritual machine with a fresh install of VScode, you say it i open the app folder then the .vscode/settings.json should be created automatically, correct ?
    And if not but i use "open existing application" and open for instance the folder ncs-example-application and it should generate it as well, correct ?

Children
  • Eyal_Gal said:
    you say it i open the app folder then the .vscode/settings.json should be created automatically, correct ?

    No, only when you take an action that changes settings would that file be created.

    See visual studio code - How to create and init ".vscode" in VSCode? - Stack Overflow

  • ah. that explains it, so yeah like i said eventually i created an "action" that caused it to create, i use the command to edit it...
    but for adding: "nrf-connect.applications": ["${workspaceFolder}/app"] i had to look in an automatically created app imported from examples.

    I think there should be for the very least an automated action that will add folder X (app in this case) as an application and will add it to the settings, especially for west workspaces.

  • Eyal_Gal said:

    ah. that explains it, so yeah like i said eventually i created an "action" that caused it to create, i use the command to edit it...
    but for adding: "nrf-connect.applications": ["${workspaceFolder}/app"] i had to look in an automatically created app imported from examples.

    I think there should be for the very least an automated action that will add folder X (app in this case) as an application and will add it to the settings, especially for west workspaces.

    Hm, I am not clear what kind of feature you require here.

    If you open a directory that has the files necessary for a Zephyr application, the extension should be able to automatically detect the directory as containing an application and put it under the Application panel.

    The setting "nrf-connect.applications": ["${workspaceFolder}/app"] is only relevant when you add more applications.

    If you expect the extension to parse recursively into the folder and detect all applications, I am not sure that would work well with the nature of Zephyr. Within Zephyr are tens if not hundreds of samples, demo applications, and test applications.

  • my bad, seems like if i take the ncs-application-example tag 2.7.0 and then west update + cd ncs_application-example/app && code . 
    It Does recognizes the app. For some reason it does not for my workspace and i'm pretty sure it did not for 'main' on the ncs-application-example so the only question is what's the difference...

    Thanks anyway.

  • So after retesting in a competently new ws all the steps described above did work, so i conclude there is an issue with the current workspace i'm in (or one of the updates to VScode solved it and i'm unaware).

    In any case the answer will be accepted and case closed,

    Thanks Hieu.

Related