Global searching in nRF Connect 1.9 VS

The global search function does not find search terms that must be in the project. Under SES I could simply do a global search and instantly find the definition of an object. I have tried setting "files to include" to *.*, nothing in files to exclude, etc. Specific case at hand is that I need to find the definition of BT_UUID_NUS_VAL in the Multi-NUS-Master example project, but I need to /learn how to "drive" the search function for future use.

  • I have and use nRF Connect but I have no idea where to find the screen you show. My immediate issue (but I want to learn to fish, not just get a fish) is finding the definition of BT_UUID_NUS_SERVICE. Hovering the mouse over it shows the definition as BT_UUID_DECLARE_128(BT_UUID_NUS_VAL), but neither of those items are searchable with the usual ctrlF search.

  • You can use the "go to definition" feature to find the definition of any C, devicetree or Kconfig symbol. You can also search for all symbols by pressing Ctrl+T (works for any language), or Ctrl+Shift+O for the current file.

    If you open the entire NCS folder in VS code then you should be able to use the "go to definition" function(hotkey F12)

    Here I have opened the entire NCS folder and using the F12 works as expected. 

    It is also possible to add the SDK to a workspace, its called multi root workspaces.: https://code.visualstudio.com/docs/editor/multi-root-workspaces 

    Using a NCS project you can also use the command  "nRF Connect: Add nRF Connect SDK to workspace" to make it pull in the right one as a workspace folder.

    Some documentation here:https://nrfconnect.github.io/vscode-nrf-connect/connect/create_app.html 


    CRTL + F only searches in the current file you are in, use CTRL + SHIFT + F to search everything in your workspace. 


    Regards,
    Jonathan

  • I think we're getting close to my disconnect. What the heck is an NCS Folder:

    "Here I have opened the entire NCS folder and using the F12 works as expected. "

    Neither F12 nor ctrl-shift-F find the definitions I'm seeking.

  • So I think I found out where the confusion is from. The project you are referring to is the Multi-NUS-Master example project, this is not part of the official nRF Connect SDK(NCS). 

    Just to clear up what i meant in the previus comment: 
    I was thinking that you where using one of our sample in the SDK, so when you are using our nRF connect for desktop and the toolchain manager you select the tag you are on, I just used the latest. 


    Clicking on the Open in VS code will open the entire SDK directory in VS code, this is what I call the NCS folder since the path is often called C:\nsc\vX.X.X , sorry for the confusion there. 

    With VS code now open you can click on the search button or ctrl + shift +F and look for BT_UUID_VAL

    This is for tag v1.9.1






    Looks like the sample is built of rom the NCS v1.4.1
    As for the project you are working with, we would need to add it to the workspace if we want to search. Should be possible to unzip the project in the NCS v1.4.1 directory, could try nrf>samples>, and we can add it with the nRF connect for VS code plugin. 



    Seems to work, 


    I dont see a BT_UUID_NUS_VAL in the Multi-NUS-Master example project. 

    Sorry for the misunderstanding hope this clears things up. 


Related