Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance/hints viewer openocd #1476

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

Conversation

radurentea
Copy link
Collaborator

Description

This enhancement:

  • adds hints for openOCD errors (manual searching using esp-idf hints viewer, search error command)
  • improves matching for building errors based on automatic/manual searches
  • adds notification system that will show the user 2 actions when it comes to hints related to building the project
    - Focus on the ESP-IDF hints bottom panel
    - Mutes "Found Hint" notification for this VS Code session (until VS Code is closed)
  • adds real-time hints display for openocd errors (when running OpenOCD session, if an error appears and a hint is found for that error, Hints Viewer bottom panel will be focused)
  • improves hover over errors in text editor (building errors) by increasing the display of the hints when hovering over the entire line where error was found. In the old version, the squiggly line had the length of 1 character. If there were other errors in the same line, for example from C/C++ Extension, it would require luck to find the portion for the ESP-IDF hint to be shown.
  • Adds extra child for hints in the tree structured data which is clickable (will open the link address in default browser), in case the hint has a link property

Type of change

  • New feature (non-breaking change which adds functionality)

Steps to test this pull request

  1. Manual searching for errors related to OpenOCD (OpenOCD version needs to be >= v0.12.0-esp32-20250226). List of error-hints pair is taken from:
    <ESP_TOOLS_INSTALLATION_PATH>/tools/openocd-esp32/<OPEN_OCD_VERSION>/openocd-esp32/share/openocd/espressif/tools/esp_problems_hints.yml
  2. Manual searching for errors that come from esp-idf's hints yml file, located at <ESP_IDF_INSTALLATION_PATH>/<ESP_IDF_VERSION>/esp-idf/tools/idf_py_actions/hints.yml
  3. Try to reproduce errors from inside both yaml files (esp-idf, openocd) and see if the hints are triggered automatically. The errors from esp-idf should display a notification with 2 actions, while the openocd hints should automatically trigger focus on hints viewer bottom panel
  4. When having errors inside the text editor, post build (for example: adding #include "spiram.h" inside the main.c file of an esp-idf example project), make sure hint is displayed when hovering over the line that has the squiggly lined text

How has this been tested?

As described above

Test Configuration:

  • ESP-IDF Version: master
  • OS (Windows,Linux and macOS): macOS

Checklist

  • PR Self Reviewed
  • Applied Code formatting
  • Added Documentation
  • Added Unit Test
  • Verified on all platforms - Windows,Linux and macOS

Copy link

github-actions bot commented Mar 14, 2025

Download the artifacts for this pull request:
You can test these changes by installing this VSIX by click menu View -> Command Palette..., type Install from VSIX and then select downloaded esp-idf-extension.vsix file to install the extension.

@radurentea radurentea self-assigned this Mar 14, 2025
Copy link
Collaborator

@brianignacio5 brianignacio5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some code suggestions to simplify functionality.

"iis.configDir": "",
"idf.pythonInstallPath": "/opt/homebrew/bin/python3",
"idf.espIdfPath": "/Users/radurentea/esp/v5.4/esp-idf",
"idf.toolsPath": "/Users/radurentea/esp/esptools"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove local settings set here.

const openOCDManager = OpenOCDManager.init();
const version = await openOCDManager.version();

if (!version) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think running openOCD just to see if the openOCD hints file exists is not necessary. A simply pathExists should be faster and easier no ?

return null;
}

const hintsPath = path.join(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also getting the openOCD Hints YAML path is duplicated both here and in the openocdHInt.ts.

We could export the function and reuse it here ?

public async initialize(): Promise<void> {
try {
// Check OpenOCD version first
const openOCDManager = OpenOCDManager.init();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can check the yaml file exists first and then check openOCD version. Actually if openOCD has the file, we could argue that openOCD does support the feature.

We could think about this, it could simplify load time here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants