Skip to content

Support static scoped var navigation#470

Open
RomeoApps wants to merge 1 commit into
SpaceManiac:masterfrom
RomeoApps:codex/static-scoped-var-443
Open

Support static scoped var navigation#470
RomeoApps wants to merge 1 commit into
SpaceManiac:masterfrom
RomeoApps:codex/static-scoped-var-443

Conversation

@RomeoApps

Copy link
Copy Markdown

Summary

  • Track /typepath::var separately from instance-scoped foo.bar annotations.
  • Wire static-scoped vars into language-server completion, hover, go-to-definition, symbol lookup, and type-definition.
  • Add parser regression coverage for both /datum/foo::bar and bare /datum/foo:: completion.

Validation

  • cargo test -p dreammaker static_scoped --test annotation_tests --no-default-features
  • cargo test -p dreammaker -p dm-langserver --no-default-features
  • cargo check -p dm-langserver --no-default-features
  • rustfmt --check --edition 2021 crates/dm-langserver/src/completion.rs crates/dm-langserver/src/main.rs crates/dreammaker/src/annotation.rs crates/dreammaker/src/parser.rs crates/dreammaker/tests/annotation_tests.rs
  • git diff --check origin/master...HEAD

Fixes #443.

@HeyBanditoz

Copy link
Copy Markdown

Out of curiosity, did you also validate this end-to-end in an editor like VSCode against an ss13 codebase to see if the feature is working as intended?

@LemonInTheDark

LemonInTheDark commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

fuck off you leech

@RomeoApps

Copy link
Copy Markdown
Author

Yes. I do not have a literal VSCode UI available in this environment, so I could not do a click-through in VSCode itself, but I validated the same dm-langserver/LSP path that the VSCode client exercises.

What I ran:

  • cargo test -p dreammaker --no-default-features
  • cargo test -p dm-langserver --no-default-features
  • cargo check -p dm-langserver --no-default-features
  • rustfmt --check --edition 2021 on the touched Rust files
  • git diff --check origin/master...HEAD

I also built dm-langserver from this branch and drove it over JSON-RPC with a workspace root, initialized, didOpen, textDocument/definition, textDocument/hover, textDocument/typeDefinition, and textDocument/completion requests.

For a controlled SS13-shaped .dme fixture, static scoped vars now resolve through the editor path for goto definition, hover, type definition on an explicitly typed static var, and completion after ::; I also checked that child-only static vars do not leak into parent-type completions.

For a real SS13 codebase, I cloned tgstation/tgstation@f5e471ce, loaded tgstation.dme, and validated real typepath::var references. Examples:

  • code/datums/materials/pizza.dm:33 /obj/item/food/pizza/margherita::tastes resolves to code/modules/food_and_drinks/food/pizza.dm:156, and completion after :: returns tastes.
  • code/modules/autowiki/pages/fishing.dm:169 /obj/item/stock_parts/power_store/cell/lead::desc resolves to code/game/objects/items/maintenance_loot.dm:36, and scoped completion includes desc.
  • code/modules/autowiki/pages/fishing.dm:172 ::name resolves to maintenance_loot.dm:35, and scoped completion includes name.
  • code/modules/autowiki/pages/fishing.dm:179 ::icon_state resolves to maintenance_loot.dm:38, and scoped completion includes icon_state.

So: not a literal VSCode UI smoke test, but yes, I validated this end-to-end through the language-server/editor protocol against an actual SS13 codebase.

@HeyBanditoz

HeyBanditoz commented Jun 22, 2026

Copy link
Copy Markdown

That's a really long way to say "no."

I recommend you set up the extension or just the langserver for your editor of choice and test it end-to-end. Otherwise I don't think the maints would be willing to accept this PR, especially coming from a very young GitHub account with zero history in any SS13/DM related spaces.

Good luck.

@RomeoApps

Copy link
Copy Markdown
Author

Done. I set up the official platymuus.dm-langclient VS Code extension from SpaceManiac/vscode-dm-langclient@46bf970, built this PR's dm-langserver, configured dreammaker.langserverPath to that binary, and opened a real tgstation/tgstation@f5e471ce workspace with tgstation.dme in a VS Code 1.125.1 extension host.

The smoke exercised the VS Code provider APIs used by the editor:

  • vscode.executeDefinitionProvider
  • vscode.executeHoverProvider
  • vscode.executeCompletionItemProvider

Passed checks against real tgstation source:

  • code/datums/materials/pizza.dm:33 /obj/item/food/pizza/margherita::tastes
    • definition resolved to code/modules/food_and_drinks/food/pizza.dm:156
    • hover included the static-scoped var and var/list/tastes docs
    • completion after :: included tastes
  • code/modules/autowiki/pages/fishing.dm:169 /obj/item/stock_parts/power_store/cell/lead::desc
    • definition resolved to code/game/objects/items/maintenance_loot.dm:36
    • hover included the static-scoped var for desc
    • completion after :: included desc
  • code/modules/autowiki/pages/fishing.dm:179 /obj/item/stock_parts/power_store/cell/lead::icon_state
    • definition resolved to code/game/objects/items/maintenance_loot.dm:38

Fresh validation after that:

  • cargo test -p dreammaker --no-default-features
  • cargo test -p dm-langserver --no-default-features
  • cargo check -p dm-langserver --no-default-features
  • cargo build -p dm-langserver --no-default-features
  • rustfmt --check --edition 2021 crates/dm-langserver/src/completion.rs crates/dm-langserver/src/main.rs crates/dreammaker/src/annotation.rs crates/dreammaker/src/parser.rs crates/dreammaker/tests/annotation_tests.rs
  • git diff --check origin/master...HEAD

All passed.

Romeo / romeoapps.com

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.

Feature Request(?): Support for /typepath::variable

3 participants