Skip to content

Activate F# expression compiler with initial lowering for Seq/List expressions#1

Open
majocha with Copilot wants to merge 7 commits into
masterfrom
copilot/expand-fsharp-evaluator-functionality
Open

Activate F# expression compiler with initial lowering for Seq/List expressions#1
majocha with Copilot wants to merge 7 commits into
masterfrom
copilot/expand-fsharp-evaluator-functionality

Conversation

Copilot AI commented Mar 6, 2026

Copy link
Copy Markdown

The F# expression compiler path existed only as an unregistered skeleton, so F# sessions had no compiler-specific handling for expressions. This change activates that path and adds a small, pure lowering layer so a first subset of F# syntax can be compiled through the existing C# EE.

  • Compiler activation

    • Registers Compiler.vsdconfigxml in the F# evaluator project
    • Scopes the compiler component to F# language sessions only
    • Keeps unsupported paths on safe fallback behavior by continuing to throw NotImplementedException
  • Pure lowering layer

    • Adds ExpressionLowering.fs as a VS-independent preprocessing module
    • Lowers a narrow F# subset into C#-EE-friendly expressions:
      • identifiers and member access
      • tuple recursion
      • F# indexer syntax (expr.[i])
      • initial Seq.* / List.* module calls
  • Compiler delegation

    • Updates ExpressionCompiler.fs to:
      • lower supported expressions before compilation
      • create a C# DkmLanguageExpression
      • delegate CompileExpression / CompileAssignment to the built-in C# EE
    • Leaves GetClrLocalVariableQuery and unsupported expressions on the fallback path
  • Coverage and docs

    • Adds focused tests for lowering behavior, including nested module calls and unsupported syntax
    • Updates README to reflect the active compiler path and the current supported lowering scope

Example of the new lowering behavior:

Seq.length (List.map mapping values)

becomes:

Microsoft.FSharp.Collections.SeqModule.Length(
    (Microsoft.FSharp.Collections.ListModule.Map(mapping, values))
)
Original prompt

Expand the existing expression evaluator extension in the majocha/FSharpExpressionEvaluator repository so it becomes a more substantive F#-aware evaluator implementation. The repository currently installs correctly and replaces the evaluator F# uses, but it is only a starting point.

Use Roslyn's Expression Evaluator implementation in dotnet/roslyn (especially under src/ExpressionEvaluator at commit 441caf3eada0c5e6fc26c5b73dee20db7add3afd) as architectural reference material, but do not copy mindlessly. Prefer idiomatic F# where practical, and preserve the extension's existing integration points.

Goals:

  • Inspect the current implementation in majocha/FSharpExpressionEvaluator and determine the highest-value next step that meaningfully expands evaluator functionality.
  • Use Roslyn's C# and Visual Basic Expression Evaluator structure as reference for architecture, debugger integration points, evaluation contexts, formatting, and result-provider behavior.
  • Implement practical improvements in the target repo that move it toward a real F# expression evaluator, while keeping scope realistic for the current codebase.
  • Prefer idiomatic F# for new logic and abstractions whenever possible instead of mechanically porting Roslyn C#/VB code.
  • Add or update tests/documentation as appropriate so the design and behavior are understandable.

Suggested areas to investigate:

  • How the current extension registers and replaces the default F# evaluator.
  • Whether the next useful milestone is expression preprocessing/parsing, F#-specific formatting, a minimal evaluation pipeline, better result handling, or debugger-context plumbing.
  • Opportunities to factor shared concerns cleanly between any existing C# host/integration layer and F# implementation code.
  • Constraints of Visual Studio debugger APIs and where a lightweight but valuable F#-specific behavior can be added now.

Deliverables:

  • Code changes in majocha/FSharpExpressionEvaluator implementing the chosen expansion.
  • Tests if the repo supports them, otherwise a concise explanation in docs/comments of limitations and next steps.
  • A pull request with a clear summary of what was implemented, what Roslyn concepts were borrowed, and what remains out of scope.

Please keep the implementation incremental and practical: improve the project materially without attempting a complete production-grade F# EE in one step.

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…eton and tests

Co-authored-by: majocha <1760221+majocha@users.noreply.github.com>
Copilot AI changed the title [WIP] Expand F# evaluator implementation in majocha/FSharpExpressionEvaluator F# expression evaluator: real type-name formatting, ExpressionCompiler skeleton, and unit tests Mar 6, 2026
…wing CreateVsdbgConfigFile target

Co-authored-by: majocha <1760221+majocha@users.noreply.github.com>
Copilot AI changed the title F# expression evaluator: real type-name formatting, ExpressionCompiler skeleton, and unit tests Fix VSSDK1025: .vsdconfig not generated on Windows, breaking VSIX build and debugger extension Mar 6, 2026
Co-authored-by: majocha <1760221+majocha@users.noreply.github.com>
Copilot AI changed the title Fix VSSDK1025: .vsdconfig not generated on Windows, breaking VSIX build and debugger extension Add F#-specific value formatting; fix VSSDK1025 .vsdconfig missing on Windows Mar 6, 2026
…int; Name: string |})

Co-authored-by: majocha <1760221+majocha@users.noreply.github.com>
Copilot AI changed the title Add F#-specific value formatting; fix VSSDK1025 .vsdconfig missing on Windows Add sample debug project + F#-specific type formatting (tuples, anonymous records, named types) Mar 6, 2026
…tion

Co-authored-by: majocha <1760221+majocha@users.noreply.github.com>
Copilot AI changed the title Add sample debug project + F#-specific type formatting (tuples, anonymous records, named types) Add debug sample project + F#-idiomatic type formatting for tuples, anonymous records, and named types Mar 6, 2026
Copilot AI requested a review from majocha May 30, 2026 12:30
Copilot AI changed the title Add debug sample project + F#-idiomatic type formatting for tuples, anonymous records, and named types Activate F# expression compiler with initial lowering for Seq/List expressions May 30, 2026
@majocha majocha marked this pull request as ready for review May 30, 2026 13:07
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