Skip to content

Semantic linting/human readable error parsing #204

Open
@thegoodhen

Description

@thegoodhen

Describe the request

There are some common beginner mistakes that are semantic (runtime state dependant) than syntactic, such as:

  • not using pinMode before calling digitalWrite
  • not initializing Serial before using it
  • using delays inside ISRs

and many others, mostly related to third party libraries, such as

  • setting a buffer of LEDs on a Neopixel strip, but never actually sending the data to the LEDs
  • setting a display buffer, but never actually applying it...
  • not initializing sensors before attempting to read values from them

It might be useful to build a mechanism that allows library authors to write custom semantic rules, with warnings being sent back into the language server, so that these common mistakes are highlighted.

On a related note, it would be great to introduce a system that would provide beginner friendly documentation on the most common bugs, returned by the linter.

Are there any plans to implement this? I think it would be a gamechanger for education.

Describe the current behavior

Currently, the linter output is more useful for highly experienced users and the language server mostly cares about syntax, but isn't context/semantic aware.

Arduino Language Server version

N/A

Arduino CLI version

N/A

Operating system

Windows

Operating system version

N/A

Additional context

No response

Issue checklist

  • I searched for previous requests in the issue tracker
  • I verified the feature was still missing when using the latest version
  • My request contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions