Add CMD_HELP UDTF for fast CL command hover documentation#71
Open
bobcozzi wants to merge 1 commit into
Open
Conversation
e263b1c to
63c4deb
Compare
Contributor
Author
|
I saw PR70 after I created this, so I applied the same async pattern to CmdHelpChecker. |
Introduces a new IBMiComponent (CmdHelpChecker) that installs a SQL Table Function (CMD_HELP) backed by a C++ service program wrapping the IBM i QUHRHLPT API. The UDTF is automatically compiled and installed into the connection's tempLibrary on first connect. The hover provider now tries CMD_HELP first (sub-second, no JVM required), falls back to GENCMDDOC if the UDTF is unavailable or returns no data. Changes: - client/src/components/cmdHelp/cmdHelpChecker.ts (new IBMiComponent) - client/src/components/cmdHelp/cmdHelpCppSource.ts (embedded C++ source) - client/src/components/cmdHelp/cmdHelpSqlSource.ts (UDTF DDL) - client/src/gencmddoc.ts: add getCLDocParam() using CMD_HELP UDTF - client/src/extension.ts: register CmdHelpChecker + getCLDocParam handler - server/src/instance.ts: add getCLDocParam() LSP request helper - server/src/providers/hover.ts: CMD_HELP fast path with GENCMDDOC fallback - client/src/components/syntaxChecker/checker.ts: DBGVIEW(*NONE) cleanup Signed-off-by: Bob Cozzi <cozzi@rpgiv.com>
63c4deb to
b79eac4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a fast primary path for CL command hover documentation using a SQL Table Function (
CMD_HELP) that wraps the IBM iQUHRHLPTAPI. The existingGENCMDDOC-based path is preserved as a fallback.Problem
Hovering over a CL command or parameter currently calls
GENCMDDOC, which:ileQueue, serializing behind any active compileEven with a warm JVM,
GENCMDDOCtypically takes 5–15 seconds, making the hover feature impractical for everyday use. Many users disable it entirely viageneral.displayCommandDocumentation.Solution
A new
CmdHelpCheckerIBMiComponent installs a C++ service program (CMDHELP) and SQL Table Function (CMD_HELP) into the connection'stempLibraryon first connect. The UDTF wrapsQUHRHLPTdirectly and returns HTML help text for a specific parameter keyword or the entire command — all via a single SQL call.Signature:
Pass the command name as
helpidfor command-level help, or a parameter keyword (e.g.MSGID) for parameter-level help. Despite the column name, the returned content is HTML.The hover provider now:
CMD_HELPfirst — returns in under a second, no JVM requiredNodeHtmlMarkdownGENCMDDOCpath ifCMD_HELPis unavailable or returns no dataFiles Changed
client/src/components/cmdHelp/cmdHelpChecker.tsIBMiComponent— auto-installs/updates the UDTF on connectclient/src/components/cmdHelp/cmdHelpCppSource.tsCMDHELPservice programclient/src/components/cmdHelp/cmdHelpSqlSource.tsCMD_HELPUDTFclient/src/gencmddoc.tsgetCLDocParam()method — queries CMD_HELP and returns Markdownclient/src/extension.tsCmdHelpChecker; addsgetCLDocParamLSP request handlerserver/src/instance.tsgetCLDocParam()LSP request helperserver/src/providers/hover.tsclient/src/components/syntaxChecker/checker.tsDBGVIEW(*LIST)→DBGVIEW(*NONE)Behaviour
CMD_HELPis installed and returns data → hover shows immediately with a "View Full Documentation" link that triggers GENCMDDOC on demandCMD_HELPis not yet installed, or SQL runner unavailable → silently falls back to existing GENCMDDOC path (no regression)CmdHelpCheckeruses the standard IBMiComponent version mechanism — if the UDTF source changes in a future release,getRemoteState()will detect the stale version andupdate()will recompile automaticallyTesting
Tested with Code for IBM i on IBM i 7.5. Hover response time dropped from 8–12 seconds (GENCMDDOC cold) to under 1 second (CMD_HELP).
Contributed by @BobCozzi