8000 feat: compiler: add source filename to the IFileHandler by bemisguided · Pull Request #1116 · y-lohse/inkjs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: compiler: add source filename to the IFileHandler #1116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

bemisguided
Copy link
Contributor
@bemisguided bemisguided commented Jun 22, 2025

Checklist

  • The new code additions passed the tests (npm test).
  • The linter ran and found no issues (npm run-script lint).

Description

Add a sourceFilename parameter to the ResolveInkFilename and LoadInkFileContents methods of the IFileHandler. These will provide context to the IFileHandler to be able to resolve the actual Include Filename, relative to the Source Ink Filename that included it. This is particularly useful when an Ink Story has Include Files that, in themselves, also Include Files.

For example, /main.ink includes /common/functions.ink, which includes /common/library/my_function.ink, this would open the door to define as follows:

INCLUDE common/functions.ink
INCLUDE library/my_functions.ink

This PR is being proposed in support of a VSCode Extension for Ink under-development.

On Discord, we discussed concerns about breaking compatibility with Inky, which this most certainly open the door for. It was agreed that the VSCode Extension should offer an "Inky compatibility" setting (default to enabled), to avoid confusion, when using this new feature.

@bemisguided
Copy link
Contributor Author

I did not see any obvious places to update tests for this. I'd be happy to add tests, if I missed the places, or it was felt we should add some.

Further, I suspect the README should be updated with this change. I'd also be happy to update this PR with this as well.

@smwhr smwhr merged commit 7f63dd3 into y-lohse:master Jul 8, 2025
1 check passed
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
0