Skip to content

VSCode extension: add hover documentation for IEC data types #55

@michaeldistel

Description

@michaeldistel

Context

The VS Code extension (introduced in #41) provides diagnostics but has no hover support. Hovering over a built-in IEC type like INT, TIME, or LREAL shows nothing. This is the smallest useful hover feature and has zero dependency on the compiler pipeline or symbol tables.

Details

Add a hover provider to the language server that responds when the cursor is on a built-in IEC 61131-3 data type name. The response should show:

  • Full type name and category (e.g. Double Integer)
  • Value range or valid values
  • Size in bits
  • Literal syntax where applicable (TIME, DATE, etc.)

Types to cover: BOOL, BYTE, WORD, DWORD, LWORD, SINT, INT, DINT, LINT, USINT, UINT, UDINT, ULINT, REAL, LREAL, TIME, LTIME, DATE, TIME_OF_DAY, TOD, DATE_AND_TIME, DT, STRING, WSTRING, CHAR, WCHAR

Implementation

  • Add vscode-extension/server/src/hover-provider.ts with the type hover map and a getHoverForWord function
  • Wire hoverProvider: true into server capabilities in server.ts
  • Add connection.onHover handler in server.ts that extracts the word at cursor and delegates to the hover provider
  • Unit test in vscode-extension/tests/

Acceptance

  • Hovering any IEC data type in a .st file shows a markdown tooltip with type info
  • Hovering a non-type word returns null (no tooltip)
  • Unit tests cover all 27 types and the null case
  • Compiler test suite still passes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions