Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3567144
Initial skeleton + dependencies updates
cartermp Oct 16, 2020
8b4b8cb
Initial proof of concept
cartermp Oct 21, 2020
6b36be5
Cleanup, tag interfaces correctly, surface area
cartermp Oct 21, 2020
b67ebdb
Basic, buggy support for parameter names
cartermp Oct 22, 2020
7f09a76
Preliminary support for not adding hints to already-annotated values
cartermp Oct 23, 2020
e129f58
don't show for typed value decls
cartermp Oct 23, 2020
fcc4be6
No sig files, handle more typed cases
cartermp Oct 23, 2020
626f7ff
Be precise about type annotations when looking for them in the syntax…
cartermp Oct 23, 2020
1c9afe6
More annotations fixity
cartermp Oct 23, 2020
57f8246
Hints show only the return type for functions
cartermp Oct 24, 2020
7dfc1b8
Cleanup and surface tests
cartermp Oct 24, 2020
47ed27a
Match names
cartermp Oct 24, 2020
51dcd6f
Basic tests for arg names
cartermp Oct 24, 2020
d2502db
Fix issues with nested functions + more tests
cartermp Oct 26, 2020
a964414
More testing and fix a bug with annotating return types for methods
cartermp Oct 27, 2020
3169656
Add failing test for infix exprs
cartermp Oct 27, 2020
b565539
Tests and fixes for exprs in infix operators
cartermp Oct 27, 2020
a8e289b
QuickInfo is scoped out + surface area
cartermp Oct 27, 2020
16c0b93
Add IsMethod and change parameter name hints to be more like names pa…
cartermp Oct 28, 2020
7e9eded
Only show type hints for lambdas + tests + surface
cartermp Oct 28, 2020
0ce8403
Preliminary support for labels for methods
cartermp Oct 29, 2020
50e7d9d
Cleanup, handle method params properly, constructors
cartermp Oct 30, 2020
258aa23
Feedback
cartermp Nov 2, 2020
86c25b9
Param names
cartermp Nov 4, 2020
2fef548
Update with latest
cartermp Nov 6, 2020
feaacf7
Update src/fsharp/symbols/Symbols.fsi
cartermp Nov 16, 2020
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
Next Next commit
Initial skeleton + dependencies updates
  • Loading branch information
cartermp committed Nov 6, 2020
commit 3567144f9aaee57b0a8f1e79e5a9c720c43fa1e3
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
<SystemThreadingThreadPoolVersion>4.3.0</SystemThreadingThreadPoolVersion>
<SystemValueTupleVersion>4.5.0</SystemValueTupleVersion>
<!-- Roslyn packages -->
<RoslynVersion>3.9.0-1.20512.2</RoslynVersion>
<RoslynVersion>3.9.0-2.20516.5</RoslynVersion>
<MicrosoftCodeAnalysisEditorFeaturesVersion>$(RoslynVersion)</MicrosoftCodeAnalysisEditorFeaturesVersion>
<MicrosoftCodeAnalysisEditorFeaturesTextVersion>$(RoslynVersion)</MicrosoftCodeAnalysisEditorFeaturesTextVersion>
<MicrosoftCodeAnalysisEditorFeaturesWpfVersion>$(RoslynVersion)</MicrosoftCodeAnalysisEditorFeaturesWpfVersion>
Expand Down
5 changes: 2 additions & 3 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"sdk": {
"version": "3.1.302",
"rollForward": "minor"
"version": "3.1.403"
},
"tools": {
"dotnet": "3.1.302",
"dotnet": "3.1.403",
"vs": {
"version": "16.4",
"components": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ open System.Threading.Tasks
open System.Linq

open Microsoft.CodeAnalysis
open Microsoft.CodeAnalysis.Editor.Implementation.Debugging
open Microsoft.CodeAnalysis.Host.Mef
open Microsoft.CodeAnalysis.Text
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor.Implementation.Debugging

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@

namespace Microsoft.VisualStudio.FSharp.Editor

open System
open System.Composition
open System.Collections.Generic
open System.Threading
open System.Threading.Tasks

open Microsoft.CodeAnalysis
open Microsoft.CodeAnalysis.Classification
open Microsoft.CodeAnalysis.Editor.Implementation.Debugging
open Microsoft.CodeAnalysis.Host.Mef
open Microsoft.CodeAnalysis.Text
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor.Implementation.Debugging

Expand Down
1 change: 1 addition & 0 deletions vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
<Compile Include="LanguageService\LanguageService.fs" />
<Compile Include="LanguageService\AssemblyContentProvider.fs" />
<Compile Include="LanguageService\SymbolHelpers.fs" />
<Compile Include="InlineHints\InlineHints.fs" />
<Compile Include="Classification\ClassificationDefinitions.fs" />
<Compile Include="Classification\ClassificationService.fs" />
<Compile Include="Formatting\BraceMatchingService.fs" />
Expand Down
47 changes: 47 additions & 0 deletions vsintegration/src/FSharp.Editor/InlineHints/InlineHints.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace Microsoft.VisualStudio.FSharp.Editor

open System.Composition
open System.Collections.Immutable
open System.Threading

open Microsoft.CodeAnalysis
open Microsoft.CodeAnalysis.Text
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.InlineHints

open FSharp.Compiler
open FSharp.Compiler.Range
open FSharp.Compiler.SourceCodeServices
open FSharp.Compiler.SyntaxTree

[<Export(typeof<IFSharpInlineHintsService>)>]
type internal FSharpInlineHintsService [<ImportingConstructor>] (checkerProvider: FSharpCheckerProvider, projectInfoManager: FSharpProjectOptionsManager) =

static let userOpName = "FSharpInlineHints"

interface IFSharpInlineHintsService with
member _.GetInlineHintsAsync(document: Document, _textSpan: TextSpan, cancellationToken: CancellationToken) =
asyncMaybe {
let! _parsingOptions, projectOptions = projectInfoManager.TryGetOptionsForEditingDocumentOrProject(document, cancellationToken, userOpName)
let! sourceText = document.GetTextAsync(cancellationToken)
//let defines = CompilerEnvironment.GetCompilationDefinesForEditing parsingOptions
//let _textLine = sourceText.Lines.GetLineFromPosition(textSpan.Start)
//let _textLinePos = sourceText.Lines.GetLinePosition(textSpan.Start)
//let _fcsTextLineNumber = Line.fromZ textLinePos.Line
//let! _symbol = Tokenizer.getSymbolAtPosition(document.Id, sourceText, textSpan.Start, document.FilePath, defines, SymbolLookupKind.Greedy, false, false)
let! _parseFileResults, _, checkFileResults = checkerProvider.Checker.ParseAndCheckDocument(document, projectOptions, userOpName)
let! symbols = checkFileResults.GetAllUsesOfAllSymbolsInFile() |> liftAsync
//let! symbolUse = checkFileResults.GetSymbolUseAtLocation(fcsTextLineNumber, symbol.Ident.idRange.EndColumn, textLine.Text.ToString(), symbol.FullIsland, userOpName=userOpName)

let hints =
[|
for symbol in symbols do
// let givenRange = RoslynHelpers.TextSpanToFSharpRange
let symbolSpan = RoslynHelpers.FSharpRangeToTextSpan(sourceText, symbol.RangeAlternate)
FSharpInlineHint(TextSpan(symbolSpan.Start, 0), ImmutableArray.Create(TaggedText(TextTags.Text, symbol.Symbol.DisplayName + ":")))
|]

return hints.ToImmutableArray()
}
|> Async.map (Option.defaultValue ImmutableArray<_>.Empty)
|> RoslynHelpers.StartAsyncAsTask(cancellationToken)