-
Notifications
You must be signed in to change notification settings - Fork 6k
Document relative path limitation and add cross-platform examples for F# Interactive #i directive #49118
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: BillWagner <[email protected]>
Co-authored-by: BillWagner <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is read for final review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses a documentation gap in the F# Interactive reference regarding the #i
directive for specifying package sources. The main purpose is to clarify that relative paths are not supported and to provide comprehensive cross-platform examples for absolute paths.
Key changes:
- Added explicit statement that relative paths aren't supported with the
#i
directive - Included cross-platform absolute path examples for macOS and Linux
- Added workaround guidance using
__SOURCE_DIRECTORY__
andSystem.IO.Path.Combine()
ms.date: 10/13/2025 | ||
f1_keywords: | ||
- VS.ToolsOptionsPages.F#_Tools.F#_Interactive | ||
ai-usage: ai-assisted |
Copilot
AI
Oct 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good addition of the required ai-usage
frontmatter for AI-assisted content.
Copilot generated this review using guidance from repository custom instructions.
### Specifying a package source | ||
|
||
You can also specify a package source with the `#i` command. The following example specifies a remote and a local source: | ||
You can also specify a package source with the `#i` command. The following examples specify a remote source and local sources on different operating systems: |
Copilot
AI
Oct 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The phrase 'on different operating systems' is somewhat redundant since the examples themselves make this clear. Consider simplifying to 'The following examples specify remote and local sources:'
You can also specify a package source with the `#i` command. The following examples specify a remote source and local sources on different operating systems: | |
You can also specify a package source with the `#i` command. The following examples specify remote and local sources: |
Copilot uses AI. Check for mistakes.
> Relative paths aren't currently supported with the `#i` directive. You must use absolute paths for local package sources. This limitation is tracked in [dotnet/fsharp#12969](https://github.com/dotnet/fsharp/issues/12969). As a workaround, construct absolute paths programmatically using `__SOURCE_DIRECTORY__` combined with `System.IO.Path.Combine()`, and then manually specify the full absolute path in your script. | ||
Copilot
AI
Oct 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workaround explanation could be clearer. The phrase 'and then manually specify the full absolute path in your script' is confusing since it suggests manual work after programmatic construction. Consider clarifying how users would actually implement this workaround with a brief code example.
> Relative paths aren't currently supported with the `#i` directive. You must use absolute paths for local package sources. This limitation is tracked in [dotnet/fsharp#12969](https://github.com/dotnet/fsharp/issues/12969). As a workaround, construct absolute paths programmatically using `__SOURCE_DIRECTORY__` combined with `System.IO.Path.Combine()`, and then manually specify the full absolute path in your script. | |
> Relative paths aren't currently supported with the `#i` directive. You must use absolute paths for local package sources. This limitation is tracked in [dotnet/fsharp#12969](https://github.com/dotnet/fsharp/issues/12969). | |
> | |
> **Workaround:** You can programmatically construct an absolute path using `__SOURCE_DIRECTORY__` and `System.IO.Path.Combine()`, then use string interpolation to pass it to the `#i` directive. For example: | |
> | |
> ```fsharp | |
> let localSource = System.IO.Path.Combine(__SOURCE_DIRECTORY__, "relative/path/to/my/local/source") | |
> #i $"""nuget: {localSource}""" | |
> ``` | |
> |
Copilot uses AI. Check for mistakes.
Fixes #44256
Summary
This PR addresses a documentation gap in the F# Interactive reference regarding the
#i
directive for specifying package sources. The documentation now clearly states that relative paths are not supported and provides comprehensive cross-platform examples.Problem
Users were unclear whether relative paths work with the
#i
directive when specifying local package sources in F# Interactive. The documentation only showed a Windows absolute path example, leaving macOS and Linux users without guidance. For example, a user attempting to use:#i "./my/local/packages"
would encounter an error with no explanation in the documentation about why this doesn't work or what the alternative is.
Changes
Added cross-platform absolute path examples
/Users/username/path/to/my/local/source
/home/username/path/to/my/local/source
Added IMPORTANT callout clarifying that:
#i
directive__SOURCE_DIRECTORY__
combined withSystem.IO.Path.Combine()
Improved documentation quality
ai-usage: ai-assisted
frontmatter metadatams.date
to reflect current changesTesting
Validated the behavior by testing F# Interactive:
Impact
This change directly answers the user's question and prevents confusion for developers trying to use local package sources in F# Interactive scripts on macOS and Linux. The documentation now provides clear guidance on what works, what doesn't, and why.
Original prompt
Fixes #28973
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
Internal previews