Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Changelog

## [Unreleased]
## [0.87.0] - 2026-11-16

### Changed

- *Breaking*: [Update FSharp.Compiler.Service to `43.13.404`, FSharp.Core to `10.1.404`, FSharp.Analyzers.SDK to `0.43.0`, Ionide.Analyzers to `0.22.0`, and Ionide.ProjInfo to `0.76.0`](https://github.com/ionide/FsAutoComplete/pull/1569). FSAC loads only analyzers built against FSharp.Analyzers.SDK 0.43. FCS 43.13 supports only F# 8.0 and later, and adds record type and expression spreads (F# 11, `--langversion:11.0`). The record stub generator does not offer stubs for a record expression with a spread. Checkout the FSharp.Analyzers.SDK [0.43.0 release notes](https://github.com/ionide/FSharp.Analyzers.SDK/releases/tag/v0.43.0) for details. (thanks @TheAngryByrd!)
- Update FSharp.Analyzers.SDK to `0.42.0`. Analyzers that walk the typed tree with `TASTCollecting.walkTast` share one converted tree per file, so each analyzer no longer converts it again. FSAC loads only analyzers built against FSharp.Analyzers.SDK 0.42. Checkout the FSharp.Analyzers.SDK release notes of [0.41.1](https://github.com/ionide/FSharp.Analyzers.SDK/releases/tag/v0.41.1) and [0.42.0](https://github.com/ionide/FSharp.Analyzers.SDK/releases/tag/v0.42.0) for details.

## [0.86.1] - 2026-10-29
Expand Down
12 changes: 6 additions & 6 deletions paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ strategy: min

nuget BenchmarkDotNet
nuget Fantomas.Client >= 0.12.0-beta-004 prerelease
nuget FSharp.Compiler.Service 43.12.402
nuget Ionide.Analyzers 0.21.0
nuget FSharp.Compiler.Service 43.13.404
nuget Ionide.Analyzers 0.22.0
nuget FSharp.Analyzers.Build >= 0.5.0
nuget Ionide.ProjInfo >= 0.75.3
nuget Ionide.ProjInfo.FCS >= 0.75.3
nuget Ionide.ProjInfo.ProjectSystem >= 0.75.3
nuget Ionide.ProjInfo >= 0.76.0
nuget Ionide.ProjInfo.FCS >= 0.76.0
nuget Ionide.ProjInfo.ProjectSystem >= 0.76.0
nuget Microsoft.Build >= 17.2 copy_local:false
nuget Microsoft.Build.Framework >= 17.4 copy_local:false
nuget Microsoft.Build.Utilities.Core >= 17.4 copy_local:false
nuget Microsoft.Build.Tasks.Core >= 17.4 copy_local: false
nuget Nuget.Frameworks >= 6.3 copy_local: false
nuget Microsoft.CodeAnalysis
nuget FSharp.Analyzers.SDK 0.42.0
nuget FSharp.Analyzers.SDK 0.43.0
nuget ICSharpCode.Decompiler
nuget Mono.Cecil >= 0.11.4
nuget FSharpLint.Core
Expand Down
42 changes: 21 additions & 21 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,27 @@ NUGET
FParsec (1.1.1) - restriction: || (== net10.0) (&& (== netstandard2.0) (>= net5.0)) (&& (== netstandard2.1) (>= net5.0))
FSharp.Core (>= 4.3.4)
FSharp.Analyzers.Build (0.5)
FSharp.Analyzers.SDK (0.42)
FSharp.Compiler.Service (43.12.402) - restriction: || (== net10.0) (&& (== netstandard2.0) (>= net10.0)) (&& (== netstandard2.1) (>= net10.0))
FSharp.Core (10.1.402) - restriction: || (== net10.0) (&& (== netstandard2.0) (>= net10.0)) (&& (== netstandard2.1) (>= net10.0))
FSharp.Analyzers.SDK (0.43)
FSharp.Compiler.Service (43.13.404) - restriction: || (== net10.0) (&& (== netstandard2.0) (>= net10.0)) (&& (== netstandard2.1) (>= net10.0))
FSharp.Core (10.1.404) - restriction: || (== net10.0) (&& (== netstandard2.0) (>= net10.0)) (&& (== netstandard2.1) (>= net10.0))
McMaster.NETCore.Plugins (>= 2.0) - restriction: || (== net10.0) (&& (== netstandard2.0) (>= net10.0)) (&& (== netstandard2.1) (>= net10.0))
Microsoft.Extensions.Logging.Abstractions (>= 10.0.11) - restriction: || (== net10.0) (&& (== netstandard2.0) (>= net10.0)) (&& (== netstandard2.1) (>= net10.0))
FSharp.Compiler.Service (43.12.402)
FSharp.Core (10.1.402)
FSharp.Compiler.Service (43.13.404)
FSharp.Core (10.1.404)
System.Buffers (>= 4.6.1)
System.Collections.Immutable (>= 10.0.2)
System.Diagnostics.DiagnosticSource (>= 10.0.2)
System.Collections.Immutable (>= 10.0.14)
System.Diagnostics.DiagnosticSource (>= 10.0.14)
System.Memory (>= 4.6.3)
System.Reflection.Emit (>= 4.7)
System.Reflection.Metadata (>= 10.0.2)
System.Reflection.Metadata (>= 10.0.14)
System.Runtime.CompilerServices.Unsafe (>= 6.1.2)
FSharp.Control.AsyncSeq (3.2.1)
FSharp.Core (>= 4.7.2)
Microsoft.Bcl.AsyncInterfaces (>= 5.0)
Fsharp.Control.Reactive (5.0.5) - restriction: || (== net10.0) (&& (== netstandard2.0) (>= net8.0)) (&& (== netstandard2.1) (>= net8.0))
FSharp.Core (>= 4.7.2)
System.Reactive (>= 5.0 < 6.0)
FSharp.Core (10.1.402)
FSharp.Core (10.1.404)
FSharp.Data.Adaptive (1.2.18)
FSharp.Core (>= 4.7)
System.Reflection.Emit.Lightweight (>= 4.6)
Expand Down Expand Up @@ -133,23 +133,23 @@ NUGET
ICSharpCode.Decompiler (11.1.0.9782)
System.Collections.Immutable (>= 9.0)
System.Reflection.Metadata (>= 9.0)
Ionide.Analyzers (0.21)
Ionide.Analyzers (0.22)
Ionide.KeepAChangelog.Tasks (0.3.1) - copy_local: true
Ionide.LanguageServerProtocol (0.7)
FSharp.Core (>= 6.0)
Newtonsoft.Json (>= 13.0.1)
StreamJsonRpc (>= 2.16.36)
Ionide.ProjInfo (0.75.3)
Ionide.ProjInfo (0.76)
FSharp.Core (>= 6.0) - restriction: || (== net10.0) (&& (== netstandard2.0) (>= net8.0)) (&& (== netstandard2.1) (>= net8.0))
Microsoft.VisualStudio.SolutionPersistence (>= 1.0.28) - restriction: || (== net10.0) (&& (== netstandard2.0) (>= net8.0)) (&& (== netstandard2.1) (>= net8.0))
SemanticVersioning (>= 2.0.2) - restriction: || (== net10.0) (&& (== netstandard2.0) (>= net8.0)) (&& (== netstandard2.1) (>= net8.0))
Ionide.ProjInfo.FCS (0.75.3)
FSharp.Compiler.Service (>= 43.12.201) - restriction: || (== net10.0) (&& (== netstandard2.0) (>= net8.0)) (&& (== netstandard2.1) (>= net8.0))
FSharp.Core (>= 10.1.201) - restriction: || (== net10.0) (&& (== netstandard2.0) (>= net8.0)) (&& (== netstandard2.1) (>= net8.0))
Ionide.ProjInfo (>= 0.75.3) - restriction: || (== net10.0) (&& (== netstandard2.0) (>= net8.0)) (&& (== netstandard2.1) (>= net8.0))
Ionide.ProjInfo.ProjectSystem (0.75.3)
Ionide.ProjInfo.FCS (0.76)
FSharp.Compiler.Service (>= 43.13.404) - restriction: || (== net10.0) (&& (== netstandard2.0) (>= net8.0)) (&& (== netstandard2.1) (>= net8.0))
FSharp.Core (>= 10.1.404) - restriction: || (== net10.0) (&& (== netstandard2.0) (>= net8.0)) (&& (== netstandard2.1) (>= net8.0))
Ionide.ProjInfo (>= 0.76) - restriction: || (== net10.0) (&& (== netstandard2.0) (>= net8.0)) (&& (== netstandard2.1) (>= net8.0))
Ionide.ProjInfo.ProjectSystem (0.76)
Fsharp.Control.Reactive (>= 5.0.5) - restriction: || (== net10.0) (&& (== netstandard2.0) (>= net8.0)) (&& (== netstandard2.1) (>= net8.0))
Ionide.ProjInfo.FCS (>= 0.75.3) - restriction: || (== net10.0) (&& (== netstandard2.0) (>= net8.0)) (&& (== netstandard2.1) (>= net8.0))
Ionide.ProjInfo.FCS (>= 0.76) - restriction: || (== net10.0) (&& (== netstandard2.0) (>= net8.0)) (&& (== netstandard2.1) (>= net8.0))
Newtonsoft.Json (>= 13.0.3) - restriction: || (== net10.0) (&& (== netstandard2.0) (>= net8.0)) (&& (== netstandard2.1) (>= net8.0))
LinkDotNet.StringBuilder (1.18)
McMaster.NETCore.Plugins (2.0) - restriction: || (== net10.0) (&& (== netstandard2.0) (>= net10.0)) (&& (== netstandard2.1) (>= net10.0))
Expand Down Expand Up @@ -559,7 +559,7 @@ NUGET
System.Runtime.Extensions (>= 4.3)
System.Threading (>= 4.3)
System.Threading.Tasks (>= 4.3)
System.Collections.Immutable (10.0.12)
System.Collections.Immutable (10.0.14)
System.Memory (>= 4.6.3) - restriction: || (&& (== net10.0) (>= net462)) (&& (== net10.0) (< net8.0)) (== netstandard2.0) (== netstandard2.1)
System.Runtime.CompilerServices.Unsafe (>= 6.1.2) - restriction: || (&& (== net10.0) (>= net462)) (&& (== net10.0) (< net8.0)) (== netstandard2.0) (== netstandard2.1)
System.CommandLine (2.0)
Expand Down Expand Up @@ -588,7 +588,7 @@ NUGET
Microsoft.NETCore.Platforms (>= 1.1)
Microsoft.NETCore.Targets (>= 1.1)
System.Runtime (>= 4.3)
System.Diagnostics.DiagnosticSource (10.0.12)
System.Diagnostics.DiagnosticSource (10.0.14)
System.Memory (>= 4.6.3) - restriction: || (&& (== net10.0) (>= net462)) (&& (== net10.0) (< net8.0)) (== netstandard2.0) (== netstandard2.1)
System.Runtime.CompilerServices.Unsafe (>= 6.1.2) - restriction: || (&& (== net10.0) (>= net462)) (&& (== net10.0) (< net8.0)) (== netstandard2.0) (== netstandard2.1)
System.Diagnostics.EventLog (9.0.1) - copy_local: false, restriction: || (== net10.0) (&& (== netstandard2.0) (>= net472) (>= net8.0)) (&& (== netstandard2.0) (>= net9.0)) (&& (== netstandard2.1) (>= net472) (>= net8.0)) (&& (== netstandard2.1) (>= net9.0))
Expand Down Expand Up @@ -696,8 +696,8 @@ NUGET
System.Reflection.Emit.ILGeneration (4.7) - restriction: || (&& (== net10.0) (< netcoreapp2.0) (< netstandard2.1)) (&& (== net10.0) (< netstandard1.1)) (&& (== net10.0) (< netstandard2.0)) (&& (== net10.0) (>= uap10.1)) (== netstandard2.0) (&& (== netstandard2.1) (< netstandard1.1)) (&& (== netstandard2.1) (< netstandard2.0)) (&& (== netstandard2.1) (>= uap10.1))
System.Reflection.Emit.Lightweight (4.7)
System.Reflection.Emit.ILGeneration (>= 4.7) - restriction: || (&& (== net10.0) (< netcoreapp2.0) (< netstandard2.1)) (&& (== net10.0) (< netstandard2.0)) (&& (== net10.0) (< portable-net45+wp8)) (&& (== net10.0) (>= uap10.1)) (== netstandard2.0) (&& (== netstandard2.1) (< netstandard2.0)) (&& (== netstandard2.1) (< portable-net45+wp8)) (&& (== netstandard2.1) (>= uap10.1))
System.Reflection.Metadata (10.0.2)
System.Collections.Immutable (>= 10.0.2) - restriction: || (&& (== net10.0) (>= net462)) (&& (== net10.0) (< net8.0)) (&& (== net10.0) (< net9.0)) (== netstandard2.0) (== netstandard2.1)
System.Reflection.Metadata (10.0.14)
System.Collections.Immutable (>= 10.0.14) - restriction: || (&& (== net10.0) (>= net462)) (&& (== net10.0) (< net8.0)) (&& (== net10.0) (< net9.0)) (== netstandard2.0) (== netstandard2.1)
System.Reflection.MetadataLoadContext (9.0.1) - copy_local: false, restriction: || (== net10.0) (&& (== netstandard2.0) (>= net472)) (&& (== netstandard2.0) (>= net9.0)) (&& (== netstandard2.1) (>= net472)) (&& (== netstandard2.1) (>= net9.0))
System.Reflection.Primitives (4.3)
Microsoft.NETCore.Platforms (>= 1.1)
Expand Down
2 changes: 1 addition & 1 deletion src/FsAutoComplete.Core/Commands.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1459,7 +1459,7 @@ type Commands() =
member _.VisitRecordDefn(_, fields, _) =
let isInLine c =
match c with
| SynField(attributes = attributes; xmlDoc = xmlDoc; idOpt = Some ident) when
| SynFieldOrSpread.Field(SynField(attributes = attributes; xmlDoc = xmlDoc; idOpt = Some ident)) when
rangeContainsPos ident.idRange pos && xmlDoc.IsEmpty
->
Some(false, tryGetFirstAttributeLine attributes)
Expand Down
33 changes: 30 additions & 3 deletions src/FsAutoComplete.Core/FCSPatches.fs
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,22 @@ module SyntaxTreeOps =
(match copyInfo with
| Some(e, _) -> walkExpr e
| None -> false)
|| walkExprs (recordFields |> List.map (fun (_ident, _range, expr) -> expr))
|| walkExprs (
recordFields
|> List.map (function
| SynExprAnonRecordFieldOrSpread.Field(SynExprAnonRecordField(expr = expr), _)
| SynExprAnonRecordFieldOrSpread.Spread(SynExprSpread(expr = expr), _) -> expr)
)

| SynExpr.Record(copyInfo = copyInfo; recordFields = recordFields) ->
(match copyInfo with
| Some(e, _) -> walkExpr e
| None -> false)
|| let flds =
recordFields |> List.choose (fun (SynExprRecordField(expr = expr)) -> expr) in
recordFields
|> List.choose (function
| SynExprRecordFieldOrSpread.Field(SynExprRecordField(expr = expr), _) -> expr
| SynExprRecordFieldOrSpread.Spread(SynExprSpread(expr = expr), _) -> Some expr) in

walkExprs flds

Expand Down Expand Up @@ -271,7 +279,8 @@ type LanguageVersionShim(versionText: string) =

member x.SupportsFeature(featureId: LanguageFeatureShim) =
match featureId.Case with
| None -> false
// FCS removes the case of a feature when every language version that it supports has the feature.
| None -> true
| Some x -> supportsFeature.Value(realLanguageVersion, x)

member x.Real = realLanguageVersion
Expand Down Expand Up @@ -308,3 +317,21 @@ module LanguageVersionShim =
/// <param name="fpo">The FSharpProjectOptions to use</param>
/// <returns>A LanguageVersionShim from the parsed "--langversion:" or defaultLanguageVersion </returns>
let fromFSharpProjectSnapshot (fpo: FSharpProjectSnapshot) = fpo.OtherOptions |> fromOtherOptions

module RichTextShim =

// FCS 43.13 takes RichText in ToolTipElement.Single but keeps its constructor and RichText module internal.
let private create =
lazy
(let ctor =
typeof<FSharp.Compiler.Text.RichText>
.GetConstructor(
BindingFlags.Instance ||| BindingFlags.NonPublic,
null,
[| typeof<FSharp.Compiler.Text.TaggedText[]> |],
null
)

fun (parts: FSharp.Compiler.Text.TaggedText[]) -> ctor.Invoke([| box parts |]) :?> FSharp.Compiler.Text.RichText)

let ofTaggedTexts (parts: FSharp.Compiler.Text.TaggedText[]) = create.Value parts
4 changes: 4 additions & 0 deletions src/FsAutoComplete.Core/FCSPatches.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ module LanguageVersionShim =

module SyntaxTreeOps =
val synExprContainsError: SynExpr -> bool

module RichTextShim =
/// Creates a RichText from tagged parts, as FCS has no public way to create one.
val ofTaggedTexts: parts: FSharp.Compiler.Text.TaggedText[] -> FSharp.Compiler.Text.RichText
5 changes: 3 additions & 2 deletions src/FsAutoComplete.Core/KeywordList.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ open FSharp.Compiler.Text
open FSharp.Compiler.Tokenization
open FSharp.Compiler.EditorServices
open FSharp.Compiler.Symbols
open FsAutoComplete.FCSPatches

module KeywordList =

Expand All @@ -21,7 +22,7 @@ module KeywordList =
ToolTipText
[
ToolTipElement.Single(
[| TaggedText.tagText kv.Key |],
RichTextShim.ofTaggedTexts [| TaggedText.tagText kv.Key |],
FSharpXmlDoc.FromXmlText(FSharp.Compiler.Xml.XmlDoc(allLines, Range.Zero))
)
]
Expand Down Expand Up @@ -56,7 +57,7 @@ module KeywordList =
ToolTipText
[
ToolTipElement.Single(
[| TaggedText.tagText ("#" + kv.Key) |],
RichTextShim.ofTaggedTexts [| TaggedText.tagText ("#" + kv.Key) |],
FSharpXmlDoc.FromXmlText(FSharp.Compiler.Xml.XmlDoc(allLines, Range.Zero))
)
]
Expand Down
2 changes: 1 addition & 1 deletion src/FsAutoComplete.Core/Lexer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ module Lexer =
| _ -> defines, langVersion)

let sourceTokenizer =
FSharpSourceTokenizer(Seq.toList defines, Some "/tmp.fsx", langVersion, None)
FSharpSourceTokenizer(Seq.toList defines, Some "/tmp.fsx", langVersion)

let lineTokenizer = sourceTokenizer.CreateLineTokenizer lineStr

Expand Down
50 changes: 31 additions & 19 deletions src/FsAutoComplete.Core/RecordStubGenerator.fs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type RecordExpr =
Expr: SynExpr
CopyExprOption: option<SynExpr * BlockSeparator>
FieldExprList: SynExprRecordField list
LastFieldBlockSeparator: BlockSeparator option
LastKnownGoodPosForSymbolLookup: Position
}

Expand Down Expand Up @@ -98,14 +99,13 @@ type RecordStubsInsertionParams =
return!
match lastFieldInfo with
| SynExprRecordField(expr = None) -> None
| SynExprRecordField(
fieldName = (SynLongIdent(id = _ :: _), true); expr = Some expr; blockSeparator = semiColonOpt) ->
match semiColonOpt with
| SynExprRecordField(fieldName = (SynLongIdent(id = _ :: _), true); expr = Some fieldExpr) ->
match expr.LastFieldBlockSeparator with
| None ->
{
Kind = PositionKind.AfterLastField
IndentColumn = indentColumn
InsertionPos = expr.Range.End
InsertionPos = fieldExpr.Range.End
}
|> Some
| Some(_range, Some semiColonEndPos) ->
Expand Down Expand Up @@ -208,17 +208,29 @@ let tryFindRecordExprInBufferAtPos (codeGenService: ICodeGenerationService) (pos
||> ParsedInput.tryPick (fun _path node ->
match node with
| SyntaxNode.SynExpr(SynExpr.Record(recordFields = recordFields; copyInfo = copyInfo) as synExpr) ->
Some
{
Expr = synExpr
CopyExprOption = copyInfo
FieldExprList = recordFields
LastKnownGoodPosForSymbolLookup =
recordFields
|> List.tryLast
|> Option.map (fun (SynExprRecordField(fieldName = (id, _))) -> id.Range.Start)
|> Option.defaultValue synExpr.Range.Start
}
let fieldsAndSeparators =
recordFields
|> List.choose (function
| SynExprRecordFieldOrSpread.Field(field, blockSeparator) -> Some(field, blockSeparator)
| SynExprRecordFieldOrSpread.Spread _ -> None)

if fieldsAndSeparators.Length <> recordFields.Length then
None
else
let fields = List.map fst fieldsAndSeparators

Some
{
Expr = synExpr
CopyExprOption = copyInfo
FieldExprList = fields
LastFieldBlockSeparator = fieldsAndSeparators |> List.tryLast |> Option.bind snd
LastKnownGoodPosForSymbolLookup =
fields
|> List.tryLast
|> Option.map (fun (SynExprRecordField(fieldName = (id, _))) -> id.Range.Start)
|> Option.defaultValue synExpr.Range.Start
}
| _ -> None)

return found
Expand All @@ -233,19 +245,19 @@ let checkThatRecordExprEndsWithRBrace (codeGenService: ICodeGenerationService) (
| _ ->
let lastField = Seq.last expr.FieldExprList

match lastField with
| SynExprRecordField(blockSeparator = Some(semiColonRange, Some _semiColonEndPos)) ->
match lastField, expr.LastFieldBlockSeparator with
| _, Some(semiColonRange, Some _semiColonEndPos) ->
// The last field ends with a ';'
// Look here: { field = expr;<start> ... }<end>
Some(Range.unionRanges semiColonRange.EndRange expr.Expr.Range.EndRange)


| SynExprRecordField(expr = Some fieldExpr) ->
| SynExprRecordField(expr = Some fieldExpr), _ ->
// The last field doesn't end with a ';'
// Look here: { field = expr<start> ... }<end>
Some(Range.unionRanges fieldExpr.Range.EndRange expr.Expr.Range.EndRange)

| SynExprRecordField(expr = None) ->
| SynExprRecordField(expr = None), _ ->
// We don't allow generation when the last field isn't assigned an expression
None

Expand Down
4 changes: 3 additions & 1 deletion src/FsAutoComplete.Core/TestAdapter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ let getExpectoTests (ast: ParsedInput) : TestAdapterEntry<range> list =
visitExpr parent letOrUse.Body
| SynExpr.Record(_, _, fields, _) ->
fields
|> List.choose (fun (SynExprRecordField(expr = expr)) -> expr)
|> List.choose (function
| SynExprRecordFieldOrSpread.Field(SynExprRecordField(expr = expr), _) -> expr
| SynExprRecordFieldOrSpread.Spread(SynExprSpread(expr = expr), _) -> Some expr)
|> List.iter (visitExpr parent)
| SynExpr.MatchLambda(_, _, clauses, _, _) -> visitMatches parent clauses
| SynExpr.ObjExpr(bindings = bindings) -> visitBindings parent bindings
Expand Down
Loading
Loading