Skip to content

Commit

Permalink
Merge branch 'main' into testnamecleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dawedawe committed Nov 20, 2023
2 parents 1b76b7d + 12d5e4f commit 3d825ea
Show file tree
Hide file tree
Showing 92 changed files with 7,020 additions and 6,356 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
BuildNet8: ${{ matrix.build_net8 }}

- name: Run and report tests
run: dotnet test -c Release -f ${{ matrix.test_tfm }} --no-restore --no-build --no-build --logger GitHubActions /p:AltCover=true /p:AltCoverAssemblyExcludeFilter="System.Reactive|FSharp.Compiler.Service|Ionide.ProjInfo|FSharp.Analyzers|Analyzer|Humanizer|FSharp.Core|FSharp.DependencyManager" -- Expecto.fail-on-focused-tests=true
run: dotnet test -c Release -f ${{ matrix.test_tfm }} --no-restore --no-build --no-build --logger GitHubActions /p:AltCover=true /p:AltCoverAssemblyExcludeFilter="System.Reactive|FSharp.Compiler.Service|Ionide.ProjInfo|FSharp.Analyzers|Analyzer|Humanizer|FSharp.Core|FSharp.DependencyManager" -- Expecto.fail-on-focused-tests=true --blame-hang --blame-hang-timeout 1m
working-directory: test/FsAutoComplete.Tests.Lsp
env:
BuildNet7: ${{ matrix.build_net7 }}
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Changelog


## [0.68.0] - 2023-11-17

### Added

* [Dotnet 8 support](https://github.com/fsharp/FsAutoComplete/pull/1175) (Thanks @baronfel & @TheAngryByrd)
* [F# 8 Support](https://github.com/fsharp/FsAutoComplete/pull/1180) (Thanks @baronfel & @nojaf & @dawedawe)

### Changed

* [Updates Ionide.LanguageServerProtocol to 0.4.20](https://github.com/fsharp/FsAutoComplete/pull/1190) (Thanks @TheAngryByrd)
* [Update IcedTasks 0.9.2](https://github.com/fsharp/FsAutoComplete/pull/1197) (Thanks @TheAngryByrd)
* [Paket Simplify](https://github.com/fsharp/FsAutoComplete/pull/1204) (Thanks @1eyewonder)

### Fixed

- [Do ordinal string comparisons](https://github.com/fsharp/FsAutoComplete/pull/1193) (Thanks @dawedawe)
- [fix typo in FullNameExternalAutocomplete default value](https://github.com/fsharp/FsAutoComplete/pull/1196) (Thanks @MrLuje)
* [Fix tooltip errorhandling]()(https://github.com/fsharp/FsAutoComplete/pull/1195) (Thanks @pblasucci & @TheAngryByrd)

## [0.67.0] - 2023-10-28

### Changed
Expand Down
2 changes: 2 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<PackageLicenseExpression Condition=" '$(PackAsTool)' != 'true' ">Apache-2.0</PackageLicenseExpression>
<NoWarn>$(NoWarn);3186,0042</NoWarn><!-- circumvent an error with the fake dependencymanager for paket: https://github.com/dotnet/fsharp/issues/8678 -->
<NoWarn>$(NoWarn);NU1902</NoWarn><!-- NU1902 - package vulnerability detected -->
<WarnOn>$(WarnOn);1182</WarnOn> <!-- Unused variables,https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/compiler-options#opt-in-warnings -->
<WarnOn>$(WarnOn);3390</WarnOn><!-- Malformed XML doc comments -->
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<ChangelogFile>$(MSBuildThisFileDirectory)CHANGELOG.md</ChangelogFile>
</PropertyGroup>
Expand Down
5 changes: 3 additions & 2 deletions benchmarks/Program.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
namespace Benchmarks

open System
open BenchmarkDotNet
open BenchmarkDotNet.Attributes
Expand All @@ -11,6 +12,6 @@ open System.Security.Cryptography
module EntryPoint =

[<EntryPoint>]
let main argv =
let summary = BenchmarkRunner.Run<SourceText_LineChanges_Benchmarks>();
let main _argv =
let _summary = BenchmarkRunner.Run<SourceText_LineChanges_Benchmarks>()
0
2 changes: 0 additions & 2 deletions build/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ let init args =
Context.setExecutionContext (Context.RuntimeContext.Fake execContext)
Target.initEnvironment ()

let fsacAssemblies = "FsAutoComplete|FsAutoComplete.Core|LanguageServerProtocol"

let packAsToolProp = "PackAsTool", "true"

Target.create "LspTest" (fun _ ->
Expand Down
4 changes: 2 additions & 2 deletions paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ framework: netstandard2.0, netstandard2.1, net6.0, net7.0, net8.0

source https://api.nuget.org/v3/index.json
# this is the FCS nightly feed, re-enable at your own risk!
#source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json
# source: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json
#source: ./libs
storage: none
strategy: min
Expand All @@ -13,7 +13,7 @@ lowest_matching: true

nuget BenchmarkDotNet 0.13.5
nuget Fantomas.Client >= 0.9
nuget FSharp.Compiler.Service >= 43.7.400
nuget FSharp.Compiler.Service >= 43.8.100
nuget Ionide.ProjInfo >= 0.62.0
nuget Ionide.ProjInfo.FCS >= 0.62.0
nuget Ionide.ProjInfo.ProjectSystem >= 0.62.0
Expand Down
6 changes: 3 additions & 3 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ NUGET
FSharp.Compiler.Service (>= 41.0.1) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= net5.0)) (&& (== netstandard2.1) (>= net5.0))
FSharp.Core (>= 6.0.1) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= net5.0)) (&& (== netstandard2.1) (>= net5.0))
McMaster.NETCore.Plugins (>= 1.4) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= net5.0)) (&& (== netstandard2.1) (>= net5.0))
FSharp.Compiler.Service (43.7.400)
FSharp.Core (7.0.400)
FSharp.Compiler.Service (43.8.100)
FSharp.Core (8.0.100)
System.Buffers (>= 4.5.1)
System.Collections.Immutable (>= 7.0)
System.Diagnostics.DiagnosticSource (>= 7.0.2)
Expand All @@ -74,7 +74,7 @@ NUGET
FSharp.Control.Reactive (5.0.5) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= net6.0)) (&& (== netstandard2.1) (>= net6.0))
FSharp.Core (>= 4.7.2)
System.Reactive (>= 5.0 < 6.0)
FSharp.Core (7.0.400)
FSharp.Core (8.0.100)
FSharp.Data.Adaptive (1.2.13)
FSharp.Core (>= 4.7)
System.Reflection.Emit.Lightweight (>= 4.6)
Expand Down
28 changes: 15 additions & 13 deletions src/FsAutoComplete.Core/AbstractClassStubGenerator.fs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ type AbstractClassData =

let private (|ExplicitCtor|_|) =
function
| SynMemberDefn.Member(SynBinding(valData = SynValData(Some({ MemberKind = SynMemberKind.Constructor }), _, _)), _) ->
| SynMemberDefn.Member(
memberDefn = SynBinding(valData = SynValData(memberFlags = Some({ MemberKind = SynMemberKind.Constructor })))) ->
Some()
| _ -> None

/// checks to see if a type definition inherits an abstract class, and if so collects the members defined at that
let private walkTypeDefn (SynTypeDefn(info, repr, members, implicitCtor, range, trivia)) =
let private walkTypeDefn (SynTypeDefn(_, repr, members, implicitCtor, _, _)) =
option {
let reprMembers =
match repr with
Expand All @@ -46,7 +47,7 @@ let private walkTypeDefn (SynTypeDefn(info, repr, members, implicitCtor, range,
let! inheritType, inheritMemberRange = // this must exist for abstract types
allMembers
|> List.tryPick (function
| SynMemberDefn.ImplicitInherit(inheritType, inheritArgs, alias, range) -> Some(inheritType, range)
| SynMemberDefn.ImplicitInherit(inheritType, _, _, range) -> Some(inheritType, range)
| _ -> None)

let furthestMemberToSkip, otherMembers =
Expand Down Expand Up @@ -81,13 +82,14 @@ let private tryFindAbstractClassExprInParsedInput
{ new SyntaxVisitorBase<_>() with
member _.VisitExpr(path, traverseExpr, defaultTraverse, expr) =
match expr with
| SynExpr.ObjExpr(baseTy, constructorArgs, withKeyword, bindings, members, extraImpls, newExprRange, range) ->
| SynExpr.ObjExpr(
objType = baseTy; withKeyword = withKeyword; bindings = bindings; newExprRange = newExprRange) ->
Some(AbstractClassData.ObjExpr(baseTy, bindings, newExprRange, withKeyword))
| _ -> defaultTraverse expr

override _.VisitModuleDecl(_, defaultTraverse, decl) =
match decl with
| SynModuleDecl.Types(types, m) -> List.tryPick walkTypeDefn types
| SynModuleDecl.Types(types, _) -> List.tryPick walkTypeDefn types
| _ -> defaultTraverse decl }
)

Expand All @@ -103,12 +105,12 @@ let tryFindAbstractClassExprInBufferAtPos
return! tryFindAbstractClassExprInParsedInput pos parseResults.ParseTree
}

let getMemberNameAndRanges (abstractClassData) =
let getMemberNameAndRanges abstractClassData =
match abstractClassData with
| AbstractClassData.ExplicitImpl(members = members) ->
members
|> Seq.choose (function
| (SynMemberDefn.Member(binding, _)) -> Some binding
| SynMemberDefn.Member(binding, _) -> Some binding
| _ -> None)
|> Seq.choose (|MemberNamePlusRangeAndKeywordRange|_|)
|> Seq.toList
Expand All @@ -129,7 +131,7 @@ let inferStartColumn
| AbstractClassData.ExplicitImpl(inheritExpressionRange = inheritRange) ->
// 'interface ISomething with' is often in a new line, we use the indentation of that line
inheritRange.StartColumn
| AbstractClassData.ObjExpr(newExpression = newExpr; withKeyword = withKeyword; bindings = bindings) ->
| AbstractClassData.ObjExpr(newExpression = newExpr; withKeyword = withKeyword; bindings = _) ->
// two cases here to consider:
// * has a with keyword on same line as newExpr
match withKeyword with
Expand All @@ -152,19 +154,19 @@ let writeAbstractClassStub
(codeGenServer: ICodeGenerationService)
(checkResultForFile: ParseAndCheckResults)
(doc: IFSACSourceText)
(lineStr: string)
(_: string)
(abstractClassData: AbstractClassData)
=
asyncOption {
let pos =
Position.mkPos
abstractClassData.AbstractTypeIdentRange.Start.Line
(abstractClassData.AbstractTypeIdentRange.End.Column)
abstractClassData.AbstractTypeIdentRange.End.Column

let! (_lexerSym, usages) = codeGenServer.GetSymbolAndUseAtPositionOfKind(doc.FileName, pos, SymbolKind.Ident)
let! _lexerSym, usages = codeGenServer.GetSymbolAndUseAtPositionOfKind(doc.FileName, pos, SymbolKind.Ident)
let! usage = usages

let! (displayContext, entity) =
let! displayContext, entity =
asyncOption {
// need the enclosing entity because we're always looking at a ctor, which isn't an Entity, but a MemberOrFunctionOrValue
match usage.Symbol with
Expand All @@ -177,7 +179,7 @@ let writeAbstractClassStub
| _ -> return! None
}

let getMemberByLocation (name: string, range: Range, keywordRange: Range) =
let getMemberByLocation (_: string, range: Range, _: Range) =
match doc.GetLine range.Start with
| Some lineText ->
match Lexer.getSymbol range.Start.Line range.Start.Column lineText SymbolLookupKind.ByLongIdent [||] with
Expand Down
8 changes: 4 additions & 4 deletions src/FsAutoComplete.Core/AdaptiveExtensions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ type MapDisposableTupleVal<'T1, 'T2, 'Disposable when 'Disposable :> IDisposable

match cache with
| ValueSome(struct (a, b, _)) when Utils.cheapEqual a i -> b
| ValueSome(struct (a, b, c)) ->
| ValueSome(struct (_, _, c)) ->
(c :> IDisposable).Dispose()
let (b, c) = mapping i
cache <- ValueSome(struct (i, b, c))
Expand Down Expand Up @@ -209,7 +209,7 @@ module AMap =
dirty <- HashMap.empty
d)

override x.InputChangedObject(t, o) =
override x.InputChangedObject(_, o) =
#if FABLE_COMPILER
if isNull o.Tag then
let o = unbox<aval<'b>> o
Expand Down Expand Up @@ -316,7 +316,7 @@ module AMap =
=
let mapping =
mapping
>> HashMap.map (fun _ v -> AVal.constant v |> AVal.mapWithAdditionalDependencies (id))
>> HashMap.map (fun _ v -> AVal.constant v |> AVal.mapWithAdditionalDependencies id)

batchRecalcDirty mapping map

Expand Down Expand Up @@ -416,7 +416,7 @@ module Async =
return! ct.Task |> Async.AwaitTask
}

[<AutoOpenAttribute>]
[<AutoOpen>]
module Extensions =

type IcedTasks.CancellableTaskBase.CancellableTaskBuilderBase with
Expand Down
14 changes: 8 additions & 6 deletions src/FsAutoComplete.Core/CodeGeneration.fs
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ module CodeGenerationUtils =

let getAbstractNonVirtualMembers (e: FSharpEntity) =
seq {
let genericParams = e.GenericParameters :> seq<_>
let _genericParams = e.GenericParameters :> seq<_>
// todo: generic param instantiations?
yield!
e.MembersFunctionsAndValues
Expand All @@ -578,14 +578,14 @@ module CodeGenerationUtils =
/// We also get the range of the leading keyword to establish indent position
let (|MemberNamePlusRangeAndKeywordRange|_|) =
function
| SynBinding(valData = SynValData(Some mf, _, _); headPat = LongIdentPattern(name, range); trivia = trivia) when
| SynBinding(valData = SynValData(memberFlags = Some mf); headPat = LongIdentPattern(name, range); trivia = trivia) when
mf.MemberKind = SynMemberKind.PropertyGet
->
if name.StartsWith("get_", StringComparison.Ordinal) then
Some(name, range, trivia.LeadingKeyword.Range)
else
Some("get_" + name, range, trivia.LeadingKeyword.Range)
| SynBinding(valData = SynValData(Some mf, _, _); headPat = LongIdentPattern(name, range); trivia = trivia) when
| SynBinding(valData = SynValData(memberFlags = Some mf); headPat = LongIdentPattern(name, range); trivia = trivia) when
mf.MemberKind = SynMemberKind.PropertySet
->
if name.StartsWith("set_", StringComparison.Ordinal) then
Expand Down Expand Up @@ -801,9 +801,11 @@ module CodeGenerationUtils =

let rec (|RationalConst|) =
function
| SynRationalConst.Integer i -> string i
| SynRationalConst.Rational(numerator, denominator, _) -> sprintf "(%i/%i)" numerator denominator
| SynRationalConst.Negate(RationalConst s) -> sprintf "- %s" s
| SynRationalConst.Integer(value = i) -> string i
| SynRationalConst.Rational(numerator = numerator; denominator = denominator) ->
sprintf "(%i/%i)" numerator denominator
| SynRationalConst.Negate(rationalConst = RationalConst s) -> sprintf "- %s" s
| SynRationalConst.Paren(rationalConst = inner) -> (|RationalConst|) inner

let rec (|TypeIdent|_|) =
function
Expand Down
17 changes: 7 additions & 10 deletions src/FsAutoComplete.Core/Commands.fs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ module Commands =
(tyRes: ParseAndCheckResults)
(pos: Position)
(lines: IFSACSourceText)
(line: LineStr)
=
async {
let doc = docForText lines tyRes
Expand Down Expand Up @@ -363,7 +362,6 @@ module Commands =
(tyRes: ParseAndCheckResults)
(pos: Position)
(lines: ISourceText)
(line: LineStr)
=
async {

Expand Down Expand Up @@ -560,8 +558,8 @@ module Commands =

let getStartingPipe =
function
| y :: xs when y.TokenName.ToUpper() = "INFIX_BAR_OP" -> Some y
| x :: y :: xs when x.TokenName.ToUpper() = "WHITESPACE" && y.TokenName.ToUpper() = "INFIX_BAR_OP" -> Some y
| y :: _ when y.TokenName.ToUpper() = "INFIX_BAR_OP" -> Some y
| x :: y :: _ when x.TokenName.ToUpper() = "WHITESPACE" && y.TokenName.ToUpper() = "INFIX_BAR_OP" -> Some y
| _ -> None

let folder (lastExpressionLine, lastExpressionLineWasPipe, acc) (currentIndex, currentTokens) =
Expand Down Expand Up @@ -632,8 +630,8 @@ module Commands =

let getStartingPipe =
function
| y :: xs when y.TokenName.ToUpper() = "INFIX_BAR_OP" -> Some y
| x :: y :: xs when x.TokenName.ToUpper() = "WHITESPACE" && y.TokenName.ToUpper() = "INFIX_BAR_OP" -> Some y
| y :: _ when y.TokenName.ToUpper() = "INFIX_BAR_OP" -> Some y
| x :: y :: _ when x.TokenName.ToUpper() = "WHITESPACE" && y.TokenName.ToUpper() = "INFIX_BAR_OP" -> Some y
| _ -> None

let folder (lastExpressionLine, lastExpressionLineWasPipe, acc) (currentIndex, currentTokens) =
Expand Down Expand Up @@ -714,7 +712,7 @@ module Commands =
// adjust column
let pos =
match pos with
| Pos(1, c) -> pos
| Pos(1, _) -> pos
| Pos(l, 0) ->
let prev = getLine (pos.DecLine())
let indentation = detectIndentation prev
Expand All @@ -724,7 +722,7 @@ module Commands =
Position.mkPos l indentation
else
pos
| Pos(_, c) -> pos
| Pos(_, _) -> pos

{ Namespace = n
Position = pos
Expand Down Expand Up @@ -793,7 +791,6 @@ module Commands =
match scope with
| Some(SymbolDeclarationLocation.Projects(projects (*isLocalForProject=*) , true)) -> return projects
| Some(SymbolDeclarationLocation.Projects(projects (*isLocalForProject=*) , false)) ->
let output = ResizeArray<_>()

let! resolvedProjects =
[ for project in projects do
Expand Down Expand Up @@ -977,7 +974,7 @@ module Commands =
///
/// Also does very basic validation of `newName`:
/// * Must be valid operator name when operator
let adjustRenameSymbolNewName pos lineStr (text: IFSACSourceText) (tyRes: ParseAndCheckResults) (newName: string) =
let adjustRenameSymbolNewName pos lineStr (tyRes: ParseAndCheckResults) (newName: string) =
asyncResult {
let! symbolUse =
tyRes.TryGetSymbolUse pos lineStr
Expand Down
18 changes: 2 additions & 16 deletions src/FsAutoComplete.Core/CompilerServiceInterface.fs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ type FSharpCompilerServiceChecker(hasAnalyzers, typecheckCacheSize, parallelRefe
| None, _
| _, None -> p
| Some fsc, Some fsi ->
let toReplace, otherOpts =
let _toReplace, otherOpts =
p.OtherOptions
|> Array.partition (fun opt ->
opt.EndsWith("FSharp.Core.dll", StringComparison.Ordinal)
Expand Down Expand Up @@ -94,20 +94,6 @@ type FSharpCompilerServiceChecker(hasAnalyzers, typecheckCacheSize, parallelRefe
else
opts

let filterBadRuntimeRefs =
let badRefs =
[ "System.Private"
"System.Runtime.WindowsRuntime"
"System.Runtime.WindowsRuntime.UI.Xaml"
"mscorlib" ]
|> List.map (fun p -> p + ".dll")

let containsBadRef (s: string) = badRefs |> List.exists (fun r -> s.EndsWith(r, StringComparison.Ordinal))

fun (projOptions: FSharpProjectOptions) ->
{ projOptions with
OtherOptions = projOptions.OtherOptions |> Array.where (containsBadRef >> not) }

/// ensures that any user-configured include/load files are added to the typechecking context
let addLoadedFiles (projectOptions: FSharpProjectOptions) =
let files = Array.append fsiAdditionalFiles projectOptions.SourceFiles
Expand Down Expand Up @@ -436,7 +422,7 @@ type FSharpCompilerServiceChecker(hasAnalyzers, typecheckCacheSize, parallelRefe
)
}

member __.GetDeclarations(fileName: string<LocalPath>, source, options, version) =
member __.GetDeclarations(fileName: string<LocalPath>, source, options, _) =
async {
checkerLogger.info (
Log.setMessage "GetDeclarations - {file}"
Expand Down
Loading

0 comments on commit 3d825ea

Please sign in to comment.