-
-
Notifications
You must be signed in to change notification settings - Fork 278
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
Extract shared line lens and pipeline hint code #1895
Conversation
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.
Thanks! Looks good.
We have some CI issues we need to get dealt with before we merge.
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.
I can't get this to build locally
.\src\Components\LineLens\LineLens.fs(145,9): (145,56) error FSHARP: Type mismatch. Expecting a
'Fable.Import.VSCode.Vscode.TextDocument -> Ionide.VSCode.FSharp.DTO.Result<Ionide.VSCode.FSharp.DTO.Symbols Microsoft.FSharp.Core.array> -> Fable.Import.VSCode.Vscode.Uri -> Fable.Core.JS.Promise<(Fable.Import.VSCode.Vscode.Range * Microsoft.FSharp.Core.string) Microsoft.FSharp.Core.array>'
but given a
'Fable.Import.VSCode.Vscode.TextDocument -> Ionide.VSCode.FSharp.DTO.Result<Ionide.VSCode.FSharp.DTO.Symbols Microsoft.FSharp.Core.array> -> Fable.Import.VSCode.Vscode.Uri -> Fable.Core.JS.Promise<(Ionide.VSCode.FSharp.DTO.Range * Microsoft.FSharp.Core.string) Microsoft.FSharp.Core.array>'
The type 'Fable.Import.VSCode.Vscode.Range' does not match the type 'Ionide.VSCode.FSharp.DTO.Range' (code 1)
Compilation failed
@TheAngryByrd This should be fixed now, not sure what happened there, I must have not pushed something 🤦♂️ |
👋 I'm pretty busy until next week, I'll do another pass 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.
Nice - this really illustrates the shared workflow between the features. It'll also make it easier to add new kinds of lenses!
Thank you for this! |
WHAT
🤖 Generated by Copilot at eed7bb7
This pull request refactors the code for the LineLens and PipelineHints features, which show the signatures and types of F# expressions at the end of the lines. The code is moved from a single file
Components/LineLens.fs
to three separate filesComponents/LineLens/LineLensShared.fs
,Components/LineLens/LineLens.fs
, andComponents/LineLens/PipelineHints.fs
, to improve the organization and readability of the code. The code also uses a newLineLens
type andInstance
values to expose the features as singletons, and updates the references to the features in other modules and the project file.🤖 Generated by Copilot at eed7bb7
📁🔧🚀
WHY
The line lens and Pipeline hint code has significant duplication. I have attempted to share as much code as possible. This was initially motivated by investigating how difficult it would be to port this feature to the ocaml vscode extension
HOW
🤖 Generated by Copilot at eed7bb7
LineLensShared.fs
that contains common types and functions for managing the decorations that show the signatures and types at the end of the lines (link)LineLens.fs
that contains the code for the LineLens feature, which shows the signature of functions and values at the end of the line, and uses theLineLensShared.fs
module (link)PipelineHints.fs
that contains the code for the PipelineHints feature, which shows the type of expressions in pipelines at the end of the line, and uses theLineLensShared.fs
module (link)Components/LineLens.fs
that contained the code for both features (link)Instance
values that expose theLineLens
type as a singleton for each feature, and use them to access the features from other modules (link, link)Components/LineLens/LineLensShared.fs
,Components/LineLens/LineLens.fs
, andComponents/LineLens/PipelineHints.fs
to the list of compiled files (link)Components/LineLens.fs
from the list of compiled files (link)activate
insrc/fsharp.fs
to use theInstance
values ofLineLens
andPipelineHints
instead of the old module names (link, link)LineLens.activate
andLineLens.deactivate
withLineLens.Instance.activate
andLineLens.Instance.deactivate
(link)PipelineHints.activate
andPipelineHints.deactivate
withPipelineHints.Instance.activate
andPipelineHints.Instance.deactivate
(link)private
insrc/Components/SolutionExplorer.fs
to use theInstance
values ofLineLens
andPipelineHints
instead of the old module names (link)LineLens.removeDecorations
andPipelineHints.removeDecorations
withLineLens.Instance.removeDecorations
andPipelineHints.Instance.removeDecorations
(link)