Skip to content

"goto" features don't work for files in sketch src folder #722

Open
@per1234

Description

@per1234

Describe the problem

Arduino sketches may contain additional code files under the src subfolder. This folder is included in the build and source files it contains are recursively compiled.

The Arduino IDE's language server-based features include "Go to definition" and "Peek", which reveal the definition of a code component. This works even for definitions in files not currently open in the IDE, such as libraries.

🐛 The "goto" features do not work for code components from files under the src subfolder of the sketch.

To reproduce

  1. Download and open this sketch in Arduino IDE:
    HasSrc.zip
  2. Select Tools > Board > Arduino AVR Boards > Arduino Uno from the Arduino IDE menus.
  3. Right click on foo.h in this line:
    #include "src/foo.h"
  4. Select "Go to Definition" from the context menu.
    🐛 The src/foo.h file does not open in an editor tab.
  5. Right click on foo.h again.
  6. Select "Peek" from the context menu.
  7. Select "Peek Definition" from the submenu.
    🐛 The src/foo.h file does not open in an editor peek.

Expected behavior

The same behavior from the "goto" features when used on code components from the src subfolder of the sketch as from files from any other location.

Arduino IDE version

Original report

2.0.0-rc3

Last verified with

9a6a457

Operating system

Windows

Operating system version

11

Additional context

Language server logs: HasSrc-logs.zip

I notice that the "goto" attempts trigger the creation of a new Arduino Language Server temporary folder, which breaks the URIs I see for src/foo.h in the language server logs (e.g., file:///C:/Users/per/AppData/Local/Temp/arduino-language-server410042786/sketch/src/foo.h).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions