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 16, 2023
2 parents e9f83ce + ee65267 commit 1b76b7d
Show file tree
Hide file tree
Showing 16 changed files with 185 additions and 120 deletions.
3 changes: 1 addition & 2 deletions benchmarks/paket.references
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
FSharp.Core
BenchmarkDotNet
Microsoft.CodeAnalysis
FSharp.Data.Adaptive
FSharp.Data.Adaptive
27 changes: 10 additions & 17 deletions build/paket.references
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
group Build
Fake.Core.Target
Fake.Core.Process
Fake.DotNet.Cli
Fake.Core.ReleaseNotes
Fake.DotNet.AssemblyInfoFile
Fake.DotNet.Paket
Fake.Tools.Git
Fake.Core.Environment
Fake.Core.UserInput
Fake.IO.FileSystem
Fake.IO.Zip
Fake.DotNet.MsBuild
Fake.Api.GitHub
Microsoft.Build
MSBuild.StructuredLogger
Octokit
Fantomas.Core
Fake.Core.Target
Fake.Core.ReleaseNotes
Fake.DotNet.AssemblyInfoFile
Fake.DotNet.Paket
Fake.Tools.Git
Fake.Core.UserInput
Fake.IO.Zip
Fake.Api.GitHub
Microsoft.Build
Fantomas.Core
10 changes: 0 additions & 10 deletions paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ nuget Microsoft.CodeAnalysis 4.5.0
nuget FSharp.Analyzers.SDK
nuget ICSharpCode.Decompiler
nuget Mono.Cecil >= 0.11.4
nuget Newtonsoft.Json
nuget FSharpLint.Core
nuget System.Configuration.ConfigurationManager
nuget Serilog >= 2.10.0
nuget Serilog.Sinks.File >= 5.0.0
nuget Serilog.Sinks.Console >= 4.0.0
Expand All @@ -48,7 +46,6 @@ nuget Dotnet.ReproducibleBuilds copy_local:true

nuget Microsoft.NETFramework.ReferenceAssemblies
nuget Ionide.KeepAChangelog.Tasks copy_local: true
nuget Expecto
nuget Expecto.Diff
nuget YoloDev.Expecto.TestSdk
nuget AltCover
Expand All @@ -69,24 +66,17 @@ group Build
framework: net6.0, net7.0

nuget Fake.Core.Target
nuget Fake.Core.Process
nuget Fake.DotNet.Cli
nuget Fake.Core.ReleaseNotes
nuget Fake.DotNet.AssemblyInfoFile
nuget Fake.DotNet.Paket
nuget Fake.Tools.Git
nuget Fake.Core.Environment
nuget Fake.Core.UserInput
nuget Fake.IO.FileSystem
nuget Fake.IO.Zip
nuget Fake.DotNet.MsBuild
nuget Fake.Api.GitHub
nuget Microsoft.Build
nuget MSBuild.StructuredLogger
nuget Octokit 0.48 // there's an API break in 0.50, so we need to pin this to prevent errors
nuget Fantomas.Core 6.2.0

nuget NuGet.Versioning 6.7.0
nuget NuGet.Common 6.7.0
nuget NuGet.Protocol 6.7.0

8 changes: 3 additions & 5 deletions src/FsAutoComplete.Core/Commands.fs
Original file line number Diff line number Diff line change
Expand Up @@ -534,9 +534,7 @@ module Commands =
| Error e -> return CoreResponse.ErrorRes e
}

let typesig (tyRes: ParseAndCheckResults) (pos: Position) lineStr =
tyRes.TryGetToolTip pos lineStr
|> Result.bimap CoreResponse.Res CoreResponse.ErrorRes
let typesig (tyRes: ParseAndCheckResults) (pos: Position) lineStr = tyRes.TryGetToolTip pos lineStr

// Calculates pipeline hints for now as in fSharp/pipelineHint with a bit of formatting on the hints
let inlineValues (contents: IFSACSourceText) (tyRes: ParseAndCheckResults) : Async<(pos * String)[]> =
Expand All @@ -546,7 +544,7 @@ module Commands =
option {
let! lineStr = contents.GetLine pos

let! tip = tyRes.TryGetToolTip pos lineStr |> Option.ofResult
let! tip = tyRes.TryGetToolTip pos lineStr

return TipFormatter.extractGenericParameters tip
}
Expand Down Expand Up @@ -618,7 +616,7 @@ module Commands =
option {
let! lineStr = contents.GetLine pos

let! tip = tyRes.TryGetToolTip pos lineStr |> Option.ofResult
let! tip = tyRes.TryGetToolTip pos lineStr

return TipFormatter.extractGenericParameters tip
}
Expand Down
53 changes: 35 additions & 18 deletions src/FsAutoComplete.Core/ParseAndCheckResults.fs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,9 @@ type ParseAndCheckResults

member __.TryGetToolTip (pos: Position) (lineStr: LineStr) =
match Lexer.findLongIdents (pos.Column, lineStr) with
| None -> ResultOrString.Error "Cannot find ident for tooltip"
| None ->
logger.info (Log.setMessageI $"Cannot find ident for tooltip: {pos.Column:column} in {lineStr:lineString}")
None
| Some(col, identIsland) ->
let identIsland = Array.toList identIsland
// TODO: Display other tooltip types, for example for strings or comments where appropriate
Expand All @@ -332,27 +334,30 @@ type ParseAndCheckResults
match identIsland with
| [ ident ] ->
match KeywordList.keywordTooltips.TryGetValue ident with
| true, tip -> Ok tip
| _ -> ResultOrString.Error "No tooltip information"
| _ -> ResultOrString.Error "No tooltip information"
| _ -> Ok(tip)

member x.TryGetToolTipEnhanced
(pos: Position)
(lineStr: LineStr)
: Result<option<TryGetToolTipEnhancedResult>, string> =
| true, tip -> Some tip
| _ ->
logger.info (Log.setMessageI $"Cannot find ident for tooltip: {pos.Column:column} in {lineStr:lineString}")
None
| _ ->
logger.info (Log.setMessageI $"Cannot find ident for tooltip: {pos.Column:column} in {lineStr:lineString}")
None
| _ -> Some tip

member x.TryGetToolTipEnhanced (pos: Position) (lineStr: LineStr) : option<TryGetToolTipEnhancedResult> =
let (|EmptyTooltip|_|) (ToolTipText elems) =
match elems with
| [] -> Some()
| elems when elems |> List.forall ((=) ToolTipElement.None) -> Some()
| _ -> None

match Completion.atPos (pos, x.GetParseResults.ParseTree) with
| Completion.Context.StringLiteral -> Ok None
| Completion.Context.StringLiteral -> None
| Completion.Context.SynType
| Completion.Context.Unknown ->
match Lexer.findLongIdents (pos.Column, lineStr) with
| None -> Error "Cannot find ident for tooltip"
| None ->
logger.info (Log.setMessageI $"Cannot find ident for tooltip: {pos.Column:column} in {lineStr:lineString}")
None
| Some(col, identIsland) ->
let identIsland = Array.toList identIsland
// TODO: Display other tooltip types, for example for strings or comments where appropriate
Expand All @@ -373,12 +378,20 @@ type ParseAndCheckResults
Footer = ""
SymbolInfo = TryGetToolTipEnhancedResult.Keyword ident }
|> Some
|> Ok
| _ -> Error "No tooltip information"
| _ -> Error "No tooltip information"
| _ ->
logger.info (
Log.setMessageI $"Cannot find ident for tooltip: {pos.Column:column} in {lineStr:lineString}"
)

None
| _ ->
logger.info (Log.setMessageI $"Cannot find ident for tooltip: {pos.Column:column} in {lineStr:lineString}")
None
| _ ->
match symbol with
| None -> Error "No tooltip information"
| None ->
logger.info (Log.setMessageI $"Cannot find ident for tooltip: {pos.Column:column} in {lineStr:lineString}")
None
| Some symbol ->

// Retrieve the FSharpSymbol instance so we can find the XmlDocSig
Expand All @@ -388,7 +401,12 @@ type ParseAndCheckResults
let resolvedType = symbol.Symbol.GetAbbreviatedParent()

match SignatureFormatter.getTooltipDetailsFromSymbolUse symbol with
| None -> Error "No tooltip information"
| None ->
logger.info (
Log.setMessageI $"Cannot find tooltip for {symbol:symbol} ({pos.Column:column} in {lineStr:lineString})"
)

None
| Some(signature, footer) ->
{ ToolTipText = tip
Signature = signature
Expand All @@ -398,7 +416,6 @@ type ParseAndCheckResults
{| XmlDocSig = resolvedType.XmlDocSig
Assembly = symbol.Symbol.Assembly.SimpleName |} }
|> Some
|> Ok

member __.TryGetFormattedDocumentation (pos: Position) (lineStr: LineStr) =
match Lexer.findLongIdents (pos.Column, lineStr) with
Expand Down
4 changes: 2 additions & 2 deletions src/FsAutoComplete.Core/ParseAndCheckResults.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ type ParseAndCheckResults =
member TryFindIdentifierDeclaration: pos: Position -> lineStr: LineStr -> Async<Result<FindDeclarationResult, string>>

member TryFindTypeDeclaration: pos: Position -> lineStr: LineStr -> Async<Result<FindDeclarationResult, string>>
member TryGetToolTip: pos: Position -> lineStr: LineStr -> Result<ToolTipText, string>
member TryGetToolTip: pos: Position -> lineStr: LineStr -> ToolTipText option

member TryGetToolTipEnhanced: pos: Position -> lineStr: LineStr -> Result<TryGetToolTipEnhancedResult option, string>
member TryGetToolTipEnhanced: pos: Position -> lineStr: LineStr -> TryGetToolTipEnhancedResult option

member TryGetFormattedDocumentation:
pos: Position ->
Expand Down
7 changes: 1 addition & 6 deletions src/FsAutoComplete.Core/paket.references
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
FSharp.Compiler.Service
FSharp.Analyzers.SDK
Newtonsoft.Json
ICSharpCode.Decompiler
Microsoft.SourceLink.GitHub
System.Configuration.ConfigurationManager
FSharp.UMX
FsToolkit.ErrorHandling.TaskResult
Fantomas.Client
FSharp.Data.Adaptive
IcedTasks

Ionide.ProjInfo.ProjectSystem
System.Reflection.Metadata
Microsoft.Build.Utilities.Core
Ionide.LanguageServerProtocol
Ionide.KeepAChangelog.Tasks
Microsoft.Extensions.Caching.Memory
Microsoft.CodeAnalysis
LinkDotNet.StringBuilder
CommunityToolkit.HighPerformance
CommunityToolkit.HighPerformance
Loading

0 comments on commit 1b76b7d

Please sign in to comment.