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
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, orLREALshows 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:
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,WCHARImplementation
vscode-extension/server/src/hover-provider.tswith the type hover map and agetHoverForWordfunctionhoverProvider: trueinto server capabilities inserver.tsconnection.onHoverhandler inserver.tsthat extracts the word at cursor and delegates to the hover providervscode-extension/tests/Acceptance
.stfile shows a markdown tooltip with type info