-
Notifications
You must be signed in to change notification settings - Fork 763
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
port fsih to fsi as a hash directive #17140
base: main
Are you sure you want to change the base?
Conversation
❗ Release notes required
|
Nice, I'm fine with having it shipped by default, it will need tests though (simple baseline which verifies couple of outputs). And an approval from @KevinRansom |
From a usability perspective, is there any auto complete support for hash directive contents? If so, users could dot-into the expression they want docs for. |
Hey Dawe, I think this would be a great addition to FSI, worth spreading a word about it once it's in. A note on errh clean code, would you want to move the new module to a separate file or something like this? |
src/Compiler/Interactive/fsi.fs
Outdated
let xmlPath = Path.ChangeExtension(declaringType.Assembly.Location, ".xml") | ||
let assembly = Path.GetFileName(declaringType.Assembly.Location) | ||
|
||
if File.Exists(xmlPath) then |
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.
Should probably use shims here for the filesystem.
Considerations:
Disregarding this, it already sound like nice feature that will speak to users of python REPL and other similar environments 🙂. |
It's not a dependency manager related functionality, so probably not(?). There's no such thing as "FSI extension",
In this case, we will need additional testing for it for different
Also would require much more testing with both non-terminal environments as well as all popular emulators and shells. |
There is autocomplete in VS for filepaths inside the But I think I'm a bit thrown off by the What is the primary motivation for using a hash directive?
(1) doesn't feel super-compelling to me, since all the other FSI directives, including If (2), then I think we could just add the help for If (3), then what about just adding an fsi.h List.map;; |
Thanks :) |
My motivation was an uniform distribution among all three points. You're making a strong argument for a new |
I concede it might sound unatural, but #r stands for "reference" (looking for "reference documentation"), and #r extensions can/do print to the output. It would need 0 parser changes. @brianrourkeboll suggestion of I also prefer it to hash directive and quoting the expression. Are there special events that FSI session will trigger? Can such events be done from a type extension over This could help extending IDEs in terms of how the output is parsed / displayed (with the idea of markdown or pretty printing strategies that could be implemented on top, rather than raw parsing of stdout). |
Unfortunately, we lose access to the shimed filesystem by being in the FSharp.Compiler.Interactive.Settings project.
Co-authored-by: Brian Rourke Boll <brianrourkeboll@users.noreply.github.com>
Co-authored-by: Brian Rourke Boll <brianrourkeboll@users.noreply.github.com>
I think this is in an okay state now but I don't know how to add tests for it. |
Maybe just test the implementation directly with various |
@vzarytovskii @KevinRansom Can we please have a review here ? |
Description
This is a port of fsih to fsi itself as a hash directive.
I think using a hash directive for this makes the most sense but as we use the normal parser for them it also means we have to wrap the expression in parentheses. I hope that's an acceptable tradeoff.
If you want to give this a try, you have to copy the
FSharp.Core.xml
manually to the fsi artifacts folder. The build process doesn't do it. Later, in the SDK distribution, the xml file will be there as far as I can see.Checklist
Test cases added
Performance benchmarks added in case of performance changes
Release notes entry updated: