Skip to content

Commit a35257a

Browse files
committed
Create dedicated API for new behavior, to maintain API compat
1 parent 315a04e commit a35257a

File tree

5 files changed

+19
-14
lines changed

5 files changed

+19
-14
lines changed

src/fsharp/NameResolution.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1312,7 +1312,7 @@ type TcSymbolUses(g, capturedNameResolutions : ResizeArray<CapturedNameResolutio
13121312
[| for cnr in capturedNameResolutions do
13131313
yield (cnr.Item, cnr.ItemOccurence, cnr.DisplayEnv, cnr.Range) |]
13141314

1315-
member this.GetFormatSpecifierLocations() = formatSpecifierLocations
1315+
member this.GetFormatSpecifierLocationsAndArity() = formatSpecifierLocations
13161316

13171317

13181318
/// An accumulator for the results being emitted into the tcSink.

src/fsharp/NameResolution.fsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ type internal TcSymbolUses =
233233

234234
member GetAllUsesOfSymbols : unit -> (Item * ItemOccurence * DisplayEnv * range)[]
235235

236-
member GetFormatSpecifierLocations : unit -> (range * int)[]
236+
member GetFormatSpecifierLocationsAndArity : unit -> (range * int)[]
237237

238238

239239
/// An abstract type for reporting the results of name resolution and type checking

src/fsharp/vs/service.fs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,11 +1472,11 @@ type TypeCheckInfo
14721472
[ for x in tcImports.GetImportedAssemblies() do
14731473
yield FSharpAssembly(g, tcImports, x.FSharpViewOfMetadata) ]
14741474

1475-
// Not, this does not have to be a SyncOp, it can be called from any thread
1476-
member scope.GetFormatSpecifierLocations() =
1477-
sSymbolUses.GetFormatSpecifierLocations()
1475+
// Note, this does not have to be a SyncOp, it can be called from any thread
1476+
member scope.GetFormatSpecifierLocationsAndArity() =
1477+
sSymbolUses.GetFormatSpecifierLocationsAndArity()
14781478

1479-
// Not, this does not have to be a SyncOp, it can be called from any thread
1479+
// Note, this does not have to be a SyncOp, it can be called from any thread
14801480
member scope.GetExtraColorizations() =
14811481
[| for cnr in sResolutions.CapturedNameResolutions do
14821482
match cnr with
@@ -2053,13 +2053,15 @@ type FSharpCheckFileResults(errors: FSharpErrorInfo[], scopeOptX: TypeCheckInfo
20532053
scope.GetSymbolUseAtLocation (line, lineStr, colAtEndOfNames, names)
20542054
|> Option.map (fun (sym,_,_) -> sym))
20552055

2056-
20572056
member info.GetFormatSpecifierLocations() =
2057+
info.GetFormatSpecifierLocationsAndArity() |> Array.map fst
2058+
2059+
member info.GetFormatSpecifierLocationsAndArity() =
20582060
threadSafeOp
20592061
(fun () -> [| |])
20602062
(fun (scope, _builder, _reactor) ->
2061-
// This operation is not asynchronous - GetFormatSpecifierLocations can be run on the calling thread
2062-
scope.GetFormatSpecifierLocations())
2063+
// This operation is not asynchronous - GetFormatSpecifierLocationsAndArity can be run on the calling thread
2064+
scope.GetFormatSpecifierLocationsAndArity())
20632065

20642066
member info.GetExtraColorizationsAlternate() =
20652067
threadSafeOp

src/fsharp/vs/service.fsi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,11 @@ type FSharpCheckFileResults =
259259
/// <summary>Get any extra colorization info that is available after the typecheck</summary>
260260
member GetExtraColorizationsAlternate : unit -> (range * FSharpTokenColorKind)[]
261261

262+
/// <summary>Get the locations of format specifiers</summary>
263+
member GetFormatSpecifierLocations : unit -> range[]
264+
262265
/// <summary>Get the locations of and number of arguments associated with format specifiers</summary>
263-
member GetFormatSpecifierLocations : unit -> (range*int)[]
266+
member GetFormatSpecifierLocationsAndArity : unit -> (range*int)[]
264267

265268
/// Get all textual usages of all symbols throughout the file
266269
member GetAllUsesOfAllSymbolsInFile : unit -> Async<FSharpSymbolUse[]>

tests/service/EditorTests.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ let _ = sprintf " %6.*%" 3
403403
let untyped, typeCheckResults = parseAndTypeCheckFileInProject(file, input)
404404

405405
typeCheckResults.Errors |> shouldEqual [||]
406-
typeCheckResults.GetFormatSpecifierLocations()
406+
typeCheckResults.GetFormatSpecifierLocationsAndArity()
407407
|> Array.map (fun (range,numArgs) -> range.StartLine, range.StartColumn, range.EndLine, range.EndColumn, numArgs)
408408
|> shouldEqual [|(2, 45, 2, 46, 1);
409409
(3, 23, 3, 24, 1);
@@ -450,7 +450,7 @@ let _ = List.iter(printfn \"\"\"%-A
450450
let untyped, typeCheckResults = parseAndTypeCheckFileInProject(file, input)
451451

452452
typeCheckResults.Errors |> shouldEqual [||]
453-
typeCheckResults.GetFormatSpecifierLocations()
453+
typeCheckResults.GetFormatSpecifierLocationsAndArity()
454454
|> Array.map (fun (range, numArgs) -> range.StartLine, range.StartColumn, range.EndLine, range.EndColumn, numArgs)
455455
|> shouldEqual [|(2, 19, 2, 21, 1);
456456
(4, 12, 4, 14, 1);
@@ -471,7 +471,7 @@ let _ = debug "[LanguageService] Type checking fails for '%s' with content=%A an
471471
let untyped, typeCheckResults = parseAndTypeCheckFileInProject(file, input)
472472

473473
typeCheckResults.Errors |> shouldEqual [||]
474-
typeCheckResults.GetFormatSpecifierLocations()
474+
typeCheckResults.GetFormatSpecifierLocationsAndArity()
475475
|> Array.map (fun (range, numArgs) -> range.StartLine, range.StartColumn, range.EndLine, range.EndColumn, numArgs)
476476
|> shouldEqual [|(3, 24, 3, 25, 1);
477477
(3, 29, 3, 30, 1);
@@ -490,7 +490,7 @@ let _ = sprintf "ABCDE"
490490

491491
let file = "/home/user/Test.fsx"
492492
let untyped, typeCheckResults = parseAndTypeCheckFileInProject(file, input)
493-
typeCheckResults.GetFormatSpecifierLocations()
493+
typeCheckResults.GetFormatSpecifierLocationsAndArity()
494494
|> Array.map (fun (range, numArgs) -> range.StartLine, range.StartColumn, range.EndLine, range.EndColumn, numArgs)
495495
|> shouldEqual [||]
496496

0 commit comments

Comments
 (0)