Skip to content
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

Merged
merged 45 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
b52972e
port fsih to fsi as a hash directive
dawedawe May 12, 2024
6a14c98
add PR number
dawedawe May 12, 2024
01d8ded
update xlf files
dawedawe May 12, 2024
a8b39e9
update core printing baselines
dawedawe May 12, 2024
42f479d
rename module to FsiHelp
dawedawe May 14, 2024
909913c
rewrite Help.Print() to return a string to be independent of FsiConso…
dawedawe May 14, 2024
d3c4daf
move fsihelp module to dedicated file
dawedawe May 14, 2024
cea11e9
use shims for the filesystem
dawedawe May 14, 2024
6c38121
- Use fsi.h as an user interface.
dawedawe May 15, 2024
fdbedae
use a fsi printer for nicer output
dawedawe May 15, 2024
a7a2d4a
update baselines
dawedawe May 15, 2024
c0e6bcd
remove suppressItPrint parameter
dawedawe May 15, 2024
c063b89
Update src/FSharp.Compiler.Interactive.Settings/fsihelp.fs
dawedawe May 15, 2024
db6a446
Update src/FSharp.Compiler.Interactive.Settings/fsihelp.fs
dawedawe May 15, 2024
c8994eb
use voption to let the printer work in the (v)none case
dawedawe May 15, 2024
9f7203f
format
dawedawe May 15, 2024
d605fd8
remove doubled assembly attributes
dawedawe May 16, 2024
eacde80
refactor
dawedawe May 16, 2024
37506de
Merge branch 'main' into port_fsih_to_fsi
dawedawe May 16, 2024
cbc2d99
add some tests
dawedawe May 16, 2024
46f8844
- let xpath queries work with single quotes in names like "shouldn't"
dawedawe May 16, 2024
6a5aa1b
Merge branch 'main' into port_fsih_to_fsi
dawedawe May 17, 2024
65bb24c
Merge branch 'main' into port_fsih_to_fsi
dawedawe May 17, 2024
af88e74
Trigger Build
dawedawe May 17, 2024
dcfe6b7
Merge branch 'main' into port_fsih_to_fsi
dawedawe May 18, 2024
0689e5c
adjust changelog entry
dawedawe May 18, 2024
1bded2a
Merge branch 'main' into port_fsih_to_fsi
dawedawe May 20, 2024
a48ca3d
Merge branch 'main' into port_fsih_to_fsi
dawedawe May 22, 2024
dbc32e4
Merge branch 'main' into port_fsih_to_fsi
dawedawe May 22, 2024
3b330d6
Merge branch 'main' into port_fsih_to_fsi
dawedawe May 23, 2024
ddf9b0e
Merge branch 'main' into port_fsih_to_fsi
dawedawe Jun 6, 2024
4631ac2
move back to #h interface
dawedawe Jun 6, 2024
c6a511f
rename tryGetDocumentation to tryGetHelp
dawedawe Jun 6, 2024
e8db338
use #help "expr";;
dawedawe Jun 6, 2024
9f7fa7a
append a newline if we don't find docs to position cursor correctly
dawedawe Jun 6, 2024
ef5d1a3
format
dawedawe Jun 6, 2024
72071c9
adjust release notes again
dawedawe Jun 6, 2024
35392f4
update surfacearea baselines
dawedawe Jun 6, 2024
11b00f2
Merge branch 'main' into port_fsih_to_fsi
dawedawe Jun 8, 2024
e12ae7f
adjust help text to use "identifier" instead of "expression"
dawedawe Jun 10, 2024
6894681
add unit test for non-identifier to show unhappy path
dawedawe Jun 11, 2024
c13ca67
add bsl entries for help output inside of fsi
dawedawe Jun 11, 2024
29b3ad6
update line numbers in bsl files
dawedawe Jun 12, 2024
1c238b5
Merge branch 'main' into port_fsih_to_fsi
KevinRansom Jun 12, 2024
01fbdf2
update line numbers in err bsl files
dawedawe Jun 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/release-notes/.FSharp.Compiler.Service/8.0.400.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### Fixed

* Added #h directive to fsi to show documentation in the REPL. ([PR #17140](https://github.com/dotnet/fsharp/pull/17140))
* Optimize simple mappings with preludes in computed collections. ([PR #17067](https://github.com/dotnet/fsharp/pull/17067))
* Improve error reporting for abstract members when used in classes. ([PR #17063](https://github.com/dotnet/fsharp/pull/17063))
* Improve error reporting when property has same name as DU case. ([Issue #16646](https://github.com/dotnet/fsharp/issues/16646), [PR #17088](https://github.com/dotnet/fsharp/pull/17088))
Expand Down
1 change: 1 addition & 0 deletions src/Compiler/Interactive/FSIstrings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ fsiIntroPackageSourceUriInfo,"Include package source uri when searching for pack
fsiIntroTextHashloadInfo,"Load the given file(s) as if compiled and referenced"
fsiIntroTextHashtimeInfo,"Toggle timing on/off"
fsiIntroTextHashhelpInfo,"Display help"
fsiIntroTextfsihelpInfo,"Display documentation for an expression, e.g. fsi.h List.map;;"
fsiIntroTextHashquitInfo,"Exit"
fsiIntroTextHashclearInfo,"Clear screen"
fsiIntroTextHeader2commandLine," F# Interactive command line options:"
Expand Down
1 change: 1 addition & 0 deletions src/Compiler/Interactive/fsi.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1251,6 +1251,7 @@ type internal FsiCommandLineOptions(fsi: FsiEvaluationSessionHostConfig, argv: s

fsiConsoleOutput.uprintfn """ #clear;; // %s""" (FSIstrings.SR.fsiIntroTextHashclearInfo ())
fsiConsoleOutput.uprintfn """ #quit;; // %s""" (FSIstrings.SR.fsiIntroTextHashquitInfo ())
fsiConsoleOutput.uprintfn """ fsi.h expr;; // %s""" (FSIstrings.SR.fsiIntroTextfsihelpInfo ())
fsiConsoleOutput.uprintfn ""
fsiConsoleOutput.uprintfnn "%s" (FSIstrings.SR.fsiIntroTextHeader2commandLine ())
fsiConsoleOutput.uprintfn "%s" (FSIstrings.SR.fsiIntroTextHeader3 (helpLine))
Expand Down
5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.cs.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.de.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.es.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.fr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.it.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.ja.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.ko.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.pl.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.pt-BR.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.ru.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.tr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.zh-Hans.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/Interactive/xlf/FSIstrings.txt.zh-Hant.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

<ItemGroup>
<EmbeddedText Include="FSInteractiveSettings.txt" />
<Compile Include="fsihelp.fsi" />
<Compile Include="fsihelp.fs" />
<Compile Include="fsiattrs.fs" />
<Compile Include="fsiaux.fsi" />
<Compile Include="fsiaux.fs" />
Expand Down
8 changes: 8 additions & 0 deletions src/FSharp.Compiler.Interactive.Settings/fsiaux.fs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ type InteractiveSession() =
member _.AddPrintTransformer(printer: 'T -> obj) =
addedPrinters <- Choice2Of2(typeof<'T>, (fun (x: obj) -> printer (unbox x))) :: addedPrinters

member _.h([<ReflectedDefinition>] expr: Quotations.Expr<_>) =
FsiHelp.Logic.Quoted.tryGetDocumentation expr

member internal self.SetEventLoop(run: (unit -> bool), invoke: ((unit -> obj) -> obj), restart: (unit -> unit)) =
evLoop.ScheduleRestart()

Expand All @@ -178,6 +181,11 @@ type InteractiveSession() =
module Settings =
let fsi = new InteractiveSession()

fsi.AddPrinter<FsiHelp.Parser.Help option>(fun help ->
match help with
| None -> "No help available"
| Some help -> help.ToDisplayString())

[<assembly: AutoOpen("FSharp.Compiler.Interactive.Settings")>]
do ()

Expand Down
3 changes: 3 additions & 0 deletions src/FSharp.Compiler.Interactive.Settings/fsiaux.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ type InteractiveSession =
/// <summary>Gets or sets a the current event loop being used to process interactions.</summary>
member EventLoop: IEventLoop with get, set

/// <summary>Get the documentation for an expression.</summary>
member h: [<ReflectedDefinition>] expr: Quotations.Expr<_> -> FsiHelp.Parser.Help option

/// <summary>Sets the current event loop being used to process interactions.</summary>
member internal SetEventLoop: (unit -> bool) * ((unit -> obj) -> obj) * (unit -> unit) -> unit

Expand Down
Loading
Loading