Skip to content

feat(glua_doc_cli): add --gmod-annotations flag for parity with glua_check - #87

Merged
Pollux12 merged 2 commits into
Pollux12:mainfrom
AmyJeanes:feat/doc-cli-gmod-annotations
Aug 23, 2026
Merged

feat(glua_doc_cli): add --gmod-annotations flag for parity with glua_check#87
Pollux12 merged 2 commits into
Pollux12:mainfrom
AmyJeanes:feat/doc-cli-gmod-annotations

Conversation

@AmyJeanes

@AmyJeanes AmyJeanes commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Motivation

glua_check already accepts --gmod-annotations <dir> to load the GMod annotation set as a library workspace, independent of workspace.library. glua_doc_cli had no equivalent, so the only way to feed it the annotations was to list them on workspace.library — which double-loads them (the LSP reads gmod.annotationsPath too) and orders them against a project's own .luatypes overrides.

Without the annotations loaded this way, a return inherited from a GMod global (e.g. a method returning Vector) resolves to unknown in the generated type model.

Change

Add --gmod-annotations <path> to glua_doc_cli, mirroring glua_check:

  • New gmod_annotations: Option<PathBuf> field on CmdArgs.
  • load_workspace gains the same parameter and the same load block — add_library_workspace(path) + WorkspaceFolder::new(path, true) — registering the directory as a library workspace exactly as glua_check does. The block is copied verbatim from glua_check's init.rs.
  • run_doc_cli threads cmd_args.gmod_annotations through.

When the flag is absent it is a complete no-op, so existing callers are unaffected.

Testing

Verified against a real GMod addon workspace: with the flag, glua_doc_cli's JSON type model resolves the same returns glua_check does (previously unknown), and the output is byte-identical to loading the annotations via workspace.library. cargo fmt / clippy -p glua_doc_cli clean.

🤖 Generated with Claude Code

Greptile Summary

The PR adds a --gmod-annotations option and prioritizes the selected directory through the shared Emmy configuration helper.

  • Adds the annotation-directory CLI argument.
  • Threads it into workspace initialization.
  • Validates that the supplied path is a directory and prioritizes it among configured libraries.

Confidence Score: 4/5

The PR should not merge until equivalent annotation-directory paths preserve the existing library configuration and its ignore rules.

The new prioritization path can insert an unrestricted duplicate ahead of a configured annotation library when the same directory has different textual path spellings, causing ignored files to enter the generated documentation model.

Files Needing Attention: crates/glua_doc_cli/src/init.rs

Important Files Changed

Filename Overview
crates/glua_doc_cli/src/cmd_args.rs Adds the optional path-valued --gmod-annotations argument.
crates/glua_doc_cli/src/init.rs Validates and prioritizes the annotation directory, but alternate spellings of an already configured directory can discard its ignore configuration through load priority.
crates/glua_doc_cli/src/lib.rs Passes the parsed annotation path into workspace initialization.

Fix all with Greploop Fix All in Codex Fix All in Claude Code

Reviews (2): Last reviewed commit: "refactor(glua_doc_cli): mirror glua_chec..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

Comment thread crates/glua_doc_cli/src/init.rs Outdated
AmyJeanes added a commit to AmyJeanes/gmod-addon-tools that referenced this pull request Aug 19, 2026
…ck and glua_doc_cli

Bumps glua_ls/glua_check to 1.2.0 and the annotations scrape to aae7341, and moves
the GMod stubs off workspace.library onto gmod.annotationsPath fleet-wide. The stubs
now reach both glua_check and glua_doc_cli through --gmod-annotations rather than as a
library entry, which double-loaded them (the LSP reads gmod.annotationsPath too) and
ordered them against a repo's own .luatypes overrides.

- New Get-GmodAnnotationsArgs helper reads gmod.annotationsPath and resolves it; used by
  Invoke-GluaCheck, Test-GmodTyping, Invoke-WikiGen and Test-GmodAnnotation's
  Measure-GluaCheck (which previously measured glua_check without the stubs loaded).
- Test-GmodLibraryPaths now enforces the new convention (glua-api off workspace.library,
  gmod.annotationsPath set) instead of the old ordering check.
- glua_doc_cli gains the --gmod-annotations flag, so it resolves stub-inherited returns
  the same way glua_check does; sourced temporarily from our fork build until the flag
  ships upstream (Pollux12/gmod-glua-ls#87).
- Refresh the library-overlap noise filter for glua_check 1.2.0's reworded warning.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018CzM9mxWHmgA5b5d926jBH
Comment thread crates/glua_doc_cli/src/init.rs
AmyJeanes and others added 2 commits August 23, 2026 22:37
…check

glua_doc_cli could previously only load the GMod annotations by listing
them on workspace.library. That double-loads them (the LSP reads
gmod.annotationsPath too) and orders them against a project's own
.luatypes overrides. glua_check already sidesteps this with a
--gmod-annotations flag that registers the directory as a library
workspace directly, bypassing config.

Mirror that flag here. Without it, a return inherited from a GMod global
(e.g. a method returning Vector) resolves to `unknown` in the generated
type model. The flag calls the same add_library_workspace +
WorkspaceFolder(is_library=true) path the existing library loop uses, so
output is identical for callers that still list the annotations as a
library.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018CzM9mxWHmgA5b5d926jBH
…ns_library

Address review: guard with is_dir() (rejecting a file path) and use the
same prioritize_gmod_annotations_library helper glua_check uses, instead
of registering the directory as a separate library workspace. That inserts
the annotations at the front of workspace.library so the existing library
loop picks them up, matching glua_check's mechanism exactly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018CzM9mxWHmgA5b5d926jBH
@AmyJeanes
AmyJeanes force-pushed the feat/doc-cli-gmod-annotations branch from 12e746b to 4d4ccf2 Compare August 23, 2026 21:37
@Pollux12
Pollux12 merged commit 1fc1f01 into Pollux12:main Aug 23, 2026
14 checks passed
@Pollux12

Copy link
Copy Markdown
Owner

Thanks for the PR!

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