Skip to content

Adds macro expansion preview handling - #485

Open
ZeWaka wants to merge 4 commits into
SpaceManiac:masterfrom
ZeWaka:expansion
Open

ZeWaka wants to merge 4 commits into
SpaceManiac:masterfrom
ZeWaka:expansion

Conversation

@ZeWaka

@ZeWaka ZeWaka commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

fixes #457 by adding a macro expansion preview command to the langserver and langclient

This has a companion PR in the langclient: SpaceManiac/vscode-dm-langclient#65

We basically re-run the preprocessor over our open file buffer and stitch it together so it lines up with the original, while ignoring comments and all directives.

Comment thread crates/dreammaker/src/parser.rs Outdated
Token![..] => {
// Handles unscoped `..()` in some old codebases.
DMError::new(start, format!("got `..`, expected identifier")).register(self.context);
DMError::new(start, "got `..`, expected identifier".to_string()).register(self.context);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clippy

}

#[test]
fn collapses_multi_line_invocation() {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

found this important to make sure expansion results in only a single line

Comment on lines +84 to +85
} else {
continue;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tldr this line had code but it was already grabbed, part of a multi-line macro or a #if 0

@ZeWaka
ZeWaka marked this pull request as ready for review October 1, 2026 07:16
# Conflicts:
#	crates/dm-langserver/src/main.rs
#	crates/dreammaker/src/parser.rs
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: Unpack macros.

1 participant