Force rebuild of function and variable index

I routinely copy code from the forum into a sketch that I already have open in the IDE having first deleted the text of the existing sketch

However, this does not cause the function and variable index to be rebuilt which means that the definitions cannot be opened. Moreover, the original definitions seem to be referenced. See screenshots below

image

Even funnier is this which pops up when I put the cursor over the println() function
image

Is there a keyboard shortcut to force a rebuild of the function and variable indices for the current sketch ?

there are functions without keybindings - the name seems to indicate it has something to do with indexes

may be the first entry is what you are looking for?

Thanks for the suggestion, but having tried all 3 they are not what I am looking for

It's a manual process but you can always delete the cache if no other solution is provided :wink:

With "verbose output during compilation" enabled, you can find where the cache is located.

Hi @UKHeliBob. You can try this:

  1. Press the Ctrl+Shift+P keyboard shortcut (Command+Shift+P for macOS users) to open the "Command Palette".
    A menu will appear on the editor toolbar:
    image
  2. Select the "Arduino: Restart Language Server" command from the menu.
    You can scroll down through the list of commands to find it or type the name in the field.
    A "Preferences" tab will open in the Arduino IDE main panel.

Unfortunately it looks like there isn't a way to assign a keyboard shortcut to this action. The IDE does remember which commands you selected previously from the command palette, so the "Arduino: Restart Language Server" command will be at the top of the menu after the first time you use it.

Thanks Per. That looks hopeful and it does result in the "indexing" message bottom left of the IDE. However, the definitions are still not available afterwards

That is unfortunate. I tried to reproduce the fault, but it is working as expected for me, even without needing to trigger the "Arduino: Restart Language Server" command. When I paste a new sketch into the Arduino IDE editor, it triggers the "Building sketch" operation.

Please provide instructions I can follow to reproduce it.

Make sure to include the following information:

  • The previous sketch code to be replaced
  • The replacement sketch code
  • Which board you have selected from the Tools > Board menu in Arduino IDE

OK Per, I will try to document the problem the next time that it occurs

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.