Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.

Commit bf469e2

Browse files
author
Don Syme
committed
fix tests
1 parent e2cd441 commit bf469e2

File tree

11 files changed

+36
-33
lines changed

11 files changed

+36
-33
lines changed

CodeFix/AddOpenCodeFixProvider.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ type internal FSharpAddOpenCodeFixProvider
106106
let! symbol =
107107
asyncMaybe {
108108
let! lexerSymbol = Tokenizer.getSymbolAtPosition(document.Id, sourceText, context.Span.End, document.FilePath, defines, SymbolLookupKind.Greedy, false, false)
109-
return! checkResults.GetSymbolUseAtLocation(Line.fromZ linePos.Line, lexerSymbol.Ident.idRange.EndColumn, line.ToString(), lexerSymbol.FullIsland, userOpName=userOpName)
109+
return checkResults.GetSymbolUseAtLocation(Line.fromZ linePos.Line, lexerSymbol.Ident.idRange.EndColumn, line.ToString(), lexerSymbol.FullIsland)
110110
} |> liftAsync
111111

112112
do! Option.guard symbol.IsNone

CodeFix/ImplementInterfaceCodeFixProvider.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ type internal FSharpImplementInterfaceCodeFixProvider
120120
let! sourceText = context.Document.GetTextAsync(cancellationToken) |> Async.AwaitTask
121121
let getMemberByLocation(name, range: range) =
122122
let lineStr = sourceText.Lines.[range.EndLine-1].ToString()
123-
results.GetSymbolUseAtLocation(range.EndLine, range.EndColumn, lineStr, [name], userOpName=userOpName)
123+
results.GetSymbolUseAtLocation(range.EndLine, range.EndColumn, lineStr, [name])
124124
let! implementedMemberSignatures =
125125
InterfaceStubGenerator.getImplementedMemberSignatures getMemberByLocation displayContext state.InterfaceData
126126
let newSourceText = applyImplementInterface sourceText state displayContext implementedMemberSignatures entity indentSize verboseMode
@@ -174,7 +174,7 @@ type internal FSharpImplementInterfaceCodeFixProvider
174174
let lineContents = textLine.ToString()
175175
let! options = context.Document.GetOptionsAsync(cancellationToken)
176176
let tabSize = options.GetOption(FormattingOptions.TabSize, FSharpConstants.FSharpLanguageName)
177-
let! symbolUse = checkFileResults.GetSymbolUseAtLocation(fcsTextLineNumber, symbol.Ident.idRange.EndColumn, lineContents, symbol.FullIsland, userOpName=userOpName)
177+
let! symbolUse = checkFileResults.GetSymbolUseAtLocation(fcsTextLineNumber, symbol.Ident.idRange.EndColumn, lineContents, symbol.FullIsland)
178178
let! entity, displayContext =
179179
match symbolUse.Symbol with
180180
| :? FSharpEntity as entity ->

CodeFix/RenameUnusedValue.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ type internal FSharpRenameUnusedValueCodeFixProvider
6363
let defines = CompilerEnvironment.GetCompilationDefinesForEditing parsingOptions
6464
let! lexerSymbol = Tokenizer.getSymbolAtPosition (document.Id, sourceText, context.Span.Start, document.FilePath, defines, SymbolLookupKind.Greedy, false, false)
6565
let lineText = (sourceText.Lines.GetLineFromPosition context.Span.Start).ToString()
66-
let! symbolUse = checkResults.GetSymbolUseAtLocation(m.StartLine, m.EndColumn, lineText, lexerSymbol.FullIsland, userOpName=userOpName)
66+
let! symbolUse = checkResults.GetSymbolUseAtLocation(m.StartLine, m.EndColumn, lineText, lexerSymbol.FullIsland)
6767
let symbolName = symbolUse.Symbol.DisplayName
6868

6969
match symbolUse.Symbol with

CodeLens/FSharpCodeLensService.fs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ type internal FSharpCodeLensService
160160
#if DEBUG
161161
logInfof "Getting uses of all symbols!"
162162
#endif
163-
let! symbolUses = checkFileResults.GetAllUsesOfAllSymbolsInFile() |> liftAsync
163+
let! ct = Async.CancellationToken |> liftAsync
164+
let symbolUses = checkFileResults.GetAllUsesOfAllSymbolsInFile(ct)
164165
let textSnapshot = buffer.CurrentSnapshot
165166
#if DEBUG
166167
logInfof "Updating due to buffer edit!"
@@ -184,7 +185,7 @@ type internal FSharpCodeLensService
184185
if (lineNumber >= 0 || lineNumber < textSnapshot.LineCount) then
185186
match func.FullTypeSafe with
186187
| Some _ ->
187-
let! maybeContext = checkFileResults.GetDisplayContextForPos(func.DeclarationLocation.Start)
188+
let maybeContext = checkFileResults.GetDisplayContextForPos(func.DeclarationLocation.Start)
188189

189190
let displayContext = Option.defaultValue displayContext maybeContext
190191
let typeLayout = func.FormatLayout displayContext

Completion/SignatureHelp.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ type internal FSharpSignatureHelpProvider
7575
let lidEnd = nwpl.LongIdEndLocation
7676

7777
// Get the methods
78-
let! methodGroup = checkFileResults.GetMethods(lidEnd.Line, lidEnd.Column, "", Some names)
78+
let methodGroup = checkFileResults.GetMethods(lidEnd.Line, lidEnd.Column, "", Some names)
7979

8080
let methods = methodGroup.Methods
8181

DocumentHighlights/DocumentHighlightsService.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ type internal FSharpDocumentHighlightsService [<ImportingConstructor>] (checkerP
6060
let fcsTextLineNumber = Line.fromZ textLinePos.Line
6161
let! symbol = Tokenizer.getSymbolAtPosition(documentKey, sourceText, position, filePath, defines, SymbolLookupKind.Greedy, false, false)
6262
let! _, _, checkFileResults = checker.ParseAndCheckDocument(filePath, textVersionHash, sourceText, options, languageServicePerformanceOptions, userOpName = userOpName)
63-
let! symbolUse = checkFileResults.GetSymbolUseAtLocation(fcsTextLineNumber, symbol.Ident.idRange.EndColumn, textLine.ToString(), symbol.FullIsland, userOpName=userOpName)
64-
let! symbolUses = checkFileResults.GetUsesOfSymbolInFile(symbolUse.Symbol) |> liftAsync
63+
let! symbolUse = checkFileResults.GetSymbolUseAtLocation(fcsTextLineNumber, symbol.Ident.idRange.EndColumn, textLine.ToString(), symbol.FullIsland)
64+
let symbolUses = checkFileResults.GetUsesOfSymbolInFile(symbolUse.Symbol)
6565
return
6666
[| for symbolUse in symbolUses do
6767
match RoslynHelpers.TryFSharpRangeToTextSpan(sourceText, symbolUse.RangeAlternate) with

InlineRename/InlineRenameService.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ type internal InlineRenameService
157157
let fcsTextLineNumber = Line.fromZ textLinePos.Line
158158
let! symbol = Tokenizer.getSymbolAtPosition(document.Id, sourceText, position, document.FilePath, defines, SymbolLookupKind.Greedy, false, false)
159159
let! _, _, checkFileResults = checker.ParseAndCheckDocument(document, options, userOpName = userOpName)
160-
let! symbolUse = checkFileResults.GetSymbolUseAtLocation(fcsTextLineNumber, symbol.Ident.idRange.EndColumn, textLine.Text.ToString(), symbol.FullIsland, userOpName=userOpName)
160+
let! symbolUse = checkFileResults.GetSymbolUseAtLocation(fcsTextLineNumber, symbol.Ident.idRange.EndColumn, textLine.Text.ToString(), symbol.FullIsland)
161161
let! declLoc = symbolUse.GetDeclarationLocation(document)
162162

163163
let! span = RoslynHelpers.TryFSharpRangeToTextSpan(sourceText, symbolUse.RangeAlternate)

LanguageService/SymbolHelpers.fs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ module internal SymbolHelpers =
3030
let! symbol = Tokenizer.getSymbolAtPosition(document.Id, sourceText, position, document.FilePath, defines, SymbolLookupKind.Greedy, false, false)
3131
let settings = document.FSharpOptions
3232
let! _, _, checkFileResults = checker.ParseAndCheckDocument(document.FilePath, textVersionHash, sourceText, projectOptions, settings.LanguageServicePerformance, userOpName = userOpName)
33-
let! symbolUse = checkFileResults.GetSymbolUseAtLocation(fcsTextLineNumber, symbol.Ident.idRange.EndColumn, textLine.ToString(), symbol.FullIsland, userOpName=userOpName)
34-
let! symbolUses = checkFileResults.GetUsesOfSymbolInFile(symbolUse.Symbol) |> liftAsync
33+
let! symbolUse = checkFileResults.GetSymbolUseAtLocation(fcsTextLineNumber, symbol.Ident.idRange.EndColumn, textLine.ToString(), symbol.FullIsland)
34+
let! ct = Async.CancellationToken |> liftAsync
35+
let symbolUses = checkFileResults.GetUsesOfSymbolInFile(symbolUse.Symbol, cancellationToken=ct)
3536
return symbolUses
3637
}
3738

@@ -75,7 +76,8 @@ module internal SymbolHelpers =
7576

7677
match declLoc with
7778
| SymbolDeclarationLocation.CurrentDocument ->
78-
let! symbolUses = checkFileResults.GetUsesOfSymbolInFile(symbol)
79+
let! ct = Async.CancellationToken
80+
let symbolUses = checkFileResults.GetUsesOfSymbolInFile(symbol, ct)
7981
return toDict (symbolUses |> Seq.map (fun symbolUse -> symbolUse.RangeAlternate))
8082
| SymbolDeclarationLocation.Projects (projects, isInternalToProject) ->
8183
let symbolUseRanges = ImmutableArray.CreateBuilder()
@@ -125,7 +127,7 @@ module internal SymbolHelpers =
125127
let textLine = sourceText.Lines.GetLineFromPosition(symbolSpan.Start)
126128
let textLinePos = sourceText.Lines.GetLinePosition(symbolSpan.Start)
127129
let fcsTextLineNumber = Line.fromZ textLinePos.Line
128-
let! symbolUse = checkFileResults.GetSymbolUseAtLocation(fcsTextLineNumber, symbol.Ident.idRange.EndColumn, textLine.Text.ToString(), symbol.FullIsland, userOpName=userOpName)
130+
let! symbolUse = checkFileResults.GetSymbolUseAtLocation(fcsTextLineNumber, symbol.Ident.idRange.EndColumn, textLine.Text.ToString(), symbol.FullIsland)
129131
let! declLoc = symbolUse.GetDeclarationLocation(document)
130132
let newText = textChanger originalText
131133
// defer finding all symbol uses throughout the solution

Navigation/FindUsagesService.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ type internal FSharpFindUsagesService
5858
let defines = CompilerEnvironment.GetCompilationDefinesForEditing parsingOptions
5959

6060
let! symbol = Tokenizer.getSymbolAtPosition(document.Id, sourceText, position, document.FilePath, defines, SymbolLookupKind.Greedy, false, false)
61-
let! symbolUse = checkFileResults.GetSymbolUseAtLocation(lineNumber, symbol.Ident.idRange.EndColumn, textLine, symbol.FullIsland, userOpName=userOpName)
62-
let! declaration = checkFileResults.GetDeclarationLocation (lineNumber, symbol.Ident.idRange.EndColumn, textLine, symbol.FullIsland, false, userOpName=userOpName) |> liftAsync
61+
let! symbolUse = checkFileResults.GetSymbolUseAtLocation(lineNumber, symbol.Ident.idRange.EndColumn, textLine, symbol.FullIsland)
62+
let declaration = checkFileResults.GetDeclarationLocation (lineNumber, symbol.Ident.idRange.EndColumn, textLine, symbol.FullIsland, false)
6363
let tags = FSharpGlyphTags.GetTags(Tokenizer.GetGlyphForSymbol (symbolUse.Symbol, symbol.Kind))
6464

6565
let declarationRange =
@@ -108,7 +108,7 @@ type internal FSharpFindUsagesService
108108

109109
match symbolUse.GetDeclarationLocation document with
110110
| Some SymbolDeclarationLocation.CurrentDocument ->
111-
let! symbolUses = checkFileResults.GetUsesOfSymbolInFile(symbolUse.Symbol) |> liftAsync
111+
let symbolUses = checkFileResults.GetUsesOfSymbolInFile(symbolUse.Symbol)
112112
for symbolUse in symbolUses do
113113
match RoslynHelpers.TryFSharpRangeToTextSpan(sourceText, symbolUse.RangeAlternate) with
114114
| Some textSpan ->

Navigation/GoToDefinition.fs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ type internal GoToDefinition(checker: FSharpChecker, projectInfoManager: FSharpP
180180

181181
let! _, _, checkFileResults = checker.ParseAndCheckDocument (originDocument, projectOptions, sourceText=sourceText, userOpName=userOpName)
182182
let idRange = lexerSymbol.Ident.idRange
183-
let! fsSymbolUse = checkFileResults.GetSymbolUseAtLocation (fcsTextLineNumber, idRange.EndColumn, lineText, lexerSymbol.FullIsland, userOpName=userOpName)
183+
let! fsSymbolUse = checkFileResults.GetSymbolUseAtLocation (fcsTextLineNumber, idRange.EndColumn, lineText, lexerSymbol.FullIsland)
184184
let symbol = fsSymbolUse.Symbol
185185
// if the tooltip was spawned in an implementation file and we have a range targeting
186186
// a signature file, try to find the corresponding implementation file and target the
@@ -192,7 +192,7 @@ type internal GoToDefinition(checker: FSharpChecker, projectInfoManager: FSharpP
192192
let! implSourceText = implDoc.GetTextAsync ()
193193
let! _parsingOptions, projectOptions = projectInfoManager.TryGetOptionsForEditingDocumentOrProject(implDoc, CancellationToken.None, userOpName)
194194
let! _, _, checkFileResults = checker.ParseAndCheckDocument (implDoc, projectOptions, sourceText=implSourceText, userOpName=userOpName)
195-
let! symbolUses = checkFileResults.GetUsesOfSymbolInFile symbol |> liftAsync
195+
let symbolUses = checkFileResults.GetUsesOfSymbolInFile symbol
196196
let! implSymbol = symbolUses |> Array.tryHead
197197
let! implTextSpan = RoslynHelpers.TryFSharpRangeToTextSpan (implSourceText, implSymbol.RangeAlternate)
198198
return FSharpGoToDefinitionNavigableItem (implDoc, implTextSpan)
@@ -213,7 +213,7 @@ type internal GoToDefinition(checker: FSharpChecker, projectInfoManager: FSharpP
213213
match checkFileAnswer with
214214
| FSharpCheckFileAnswer.Aborted -> return! None
215215
| FSharpCheckFileAnswer.Succeeded checkFileResults ->
216-
let! symbolUses = checkFileResults.GetUsesOfSymbolInFile targetSymbolUse.Symbol |> liftAsync
216+
let symbolUses = checkFileResults.GetUsesOfSymbolInFile targetSymbolUse.Symbol
217217
let! implSymbol = symbolUses |> Array.tryHead
218218
return implSymbol.RangeAlternate
219219
}
@@ -235,8 +235,8 @@ type internal GoToDefinition(checker: FSharpChecker, projectInfoManager: FSharpP
235235
let! lexerSymbol = Tokenizer.getSymbolAtPosition (originDocument.Id, sourceText, position,originDocument.FilePath, defines, SymbolLookupKind.Greedy, false, false)
236236
let idRange = lexerSymbol.Ident.idRange
237237

238-
let! declarations = checkFileResults.GetDeclarationLocation (fcsTextLineNumber, lexerSymbol.Ident.idRange.EndColumn, textLine.ToString(), lexerSymbol.FullIsland, preferSignature, userOpName=userOpName) |> liftAsync
239-
let! targetSymbolUse = checkFileResults.GetSymbolUseAtLocation (fcsTextLineNumber, idRange.EndColumn, lineText, lexerSymbol.FullIsland, userOpName=userOpName)
238+
let declarations = checkFileResults.GetDeclarationLocation (fcsTextLineNumber, lexerSymbol.Ident.idRange.EndColumn, textLine.ToString(), lexerSymbol.FullIsland, preferSignature)
239+
let! targetSymbolUse = checkFileResults.GetSymbolUseAtLocation (fcsTextLineNumber, idRange.EndColumn, lineText, lexerSymbol.FullIsland)
240240

241241
match declarations with
242242
| FSharpFindDeclResult.ExternalDecl (assembly, targetExternalSym) ->
@@ -276,7 +276,7 @@ type internal GoToDefinition(checker: FSharpChecker, projectInfoManager: FSharpP
276276
let navItem = FSharpGoToDefinitionNavigableItem (implDocument, implTextSpan)
277277
return (navItem, idRange)
278278
else // jump from implementation to the corresponding signature
279-
let! declarations = checkFileResults.GetDeclarationLocation (fcsTextLineNumber, lexerSymbol.Ident.idRange.EndColumn, textLine.ToString(), lexerSymbol.FullIsland, true, userOpName=userOpName) |> liftAsync
279+
let declarations = checkFileResults.GetDeclarationLocation (fcsTextLineNumber, lexerSymbol.Ident.idRange.EndColumn, textLine.ToString(), lexerSymbol.FullIsland, true)
280280
match declarations with
281281
| FSharpFindDeclResult.DeclFound targetRange ->
282282
let! sigDocument = originDocument.Project.Solution.TryGetDocumentFromPath targetRange.FileName

0 commit comments

Comments
 (0)