Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc068581

Browse files
Vasily KirichenkoVasily Kirichenko
Vasily Kirichenko
authored and
Vasily Kirichenko
committed
remove reactor ops from FSharpFileCheckResults
1 parentd867864 commitc068581

22 files changed

+158
-225
lines changed

‎src/fsharp/vs/ServiceInterfaceStubGenerator.fs‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ module internal InterfaceStubGenerator =
540540
/// (1) Crack ASTs to get member names and their associated ranges
541541
/// (2) Check symbols of those members based on ranges
542542
/// (3) If any symbol found, capture its member signature
543-
letgetImplementedMemberSignatures(getMemberByLocation:string* range->Async<FSharpSymbolUse option>)displayContext interfaceData=
543+
letgetImplementedMemberSignatures(getMemberByLocation:string* range-> FSharpSymbolUse option)displayContext interfaceData=
544544
letformatMemberSignature(symbolUse:FSharpSymbolUse)=
545545
match symbolUse.Symbolwith
546546
|:? FSharpMemberOrFunctionOrValueas m->
@@ -557,14 +557,12 @@ module internal InterfaceStubGenerator =
557557
|_->
558558
//fail "Should only accept symbol uses of members."
559559
None
560-
async{
561-
let!symbolUses=
562-
getMemberNameAndRanges interfaceData
563-
|> List.toArray
564-
|> Array.mapAsync getMemberByLocation
565-
return symbolUses|> Array.choose(Option.bind formatMemberSignature>> Option.map String.Concat)
566-
|> Set.ofArray
567-
}
560+
letsymbolUses=
561+
getMemberNameAndRanges interfaceData
562+
|> List.toArray
563+
|> Array.map getMemberByLocation
564+
symbolUses|> Array.choose(Option.bind formatMemberSignature>> Option.map String.Concat)
565+
|> Set.ofArray
568566

569567
/// Check whether an entity is an interface or type abbreviation of an interface
570568
let recisInterface(e:FSharpEntity)=

‎src/fsharp/vs/service.fs‎

Lines changed: 30 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1918,22 +1918,6 @@ type FSharpCheckFileResults(errors: FSharpErrorInfo[], scopeOptX: TypeCheckInfo
19181918
reactor.EnqueueOp("Dispose",fun()-> decrementer.Dispose())
19191919
|_->()
19201920

1921-
// Run an operation that needs to be run in the reactor thread
1922-
letreactorOp desc dflt f=
1923-
async{
1924-
match detailswith
1925-
| None->
1926-
return dflt
1927-
| Some(_, Some builder,_)whennot builder.IsAlive->
1928-
System.Diagnostics.Debug.Assert(false,"unexpected dead builder")
1929-
return dflt
1930-
| Some(scope, builderOpt, reactor)->
1931-
// Ensure the builder doesn't get released while running operations asynchronously.
1932-
use _unwind=match builderOptwith Some builder-> builder.IncrementUsageCount()| None->{new System.IDisposablewithmember__.Dispose()=()}
1933-
let!res= reactor.EnqueueAndAwaitOpAsync(desc,fun _ct-> f scope)
1934-
return res
1935-
}
1936-
19371921
// Run an operation that can be called from any thread
19381922
letthreadSafeOp dflt f=
19391923
match detailswith
@@ -1942,8 +1926,8 @@ type FSharpCheckFileResults(errors: FSharpErrorInfo[], scopeOptX: TypeCheckInfo
19421926
| Some(_, Some builder,_)whennot builder.IsAlive->
19431927
System.Diagnostics.Debug.Assert(false,"unexpected dead builder")
19441928
dflt()
1945-
| Some(scope,builderOpt, ops)->
1946-
f(scope, builderOpt, ops)
1929+
| Some(scope,_,_)->
1930+
f scope
19471931

19481932
// At the moment we only dispose on finalize - we never explicitly dispose these objects. Explicitly disposing is not
19491933
// really worth much since the underlying project builds are likely to still be in the incrementalBuilder cache.
@@ -1954,122 +1938,97 @@ type FSharpCheckFileResults(errors: FSharpErrorInfo[], scopeOptX: TypeCheckInfo
19541938
memberinfo.HasFullTypeCheckInfo= details.IsSome
19551939

19561940
/// Intellisense autocompletions
1957-
//member info.GetDeclarationListInfo(parseResultsOpt, line, colAtEndOfNamesAndResidue, lineStr, qualifyingNames, partialName, ?hasTextChangedSinceLastTypecheck) =
1958-
// let hasTextChangedSinceLastTypecheck = defaultArg hasTextChangedSinceLastTypecheck (fun _ -> false)
1959-
// reactorOp "GetDeclarations" FSharpDeclarationListInfo.Empty (fun scope ->
1960-
// let sw = System.Diagnostics.Stopwatch.StartNew()
1961-
// let r = scope.GetDeclarations(parseResultsOpt, line, lineStr, colAtEndOfNamesAndResidue, qualifyingNames, partialName, hasTextChangedSinceLastTypecheck)
1962-
// System.IO.File.WriteAllText(@"e:\___3.txt", sprintf "scope.GetDeclarations: %O" sw.Elapsed)
1963-
// r
1964-
// )
1965-
19661941
memberinfo.GetDeclarationListInfo(parseResultsOpt,line,colAtEndOfNamesAndResidue,lineStr,qualifyingNames,partialName,?hasTextChangedSinceLastTypecheck)=
1967-
async{
1968-
lethasTextChangedSinceLastTypecheck= defaultArg hasTextChangedSinceLastTypecheck(fun _->false)
1969-
return
1970-
threadSafeOp
1971-
(fun()-> failwith"not available")
1972-
(fun(scope,_builder,_reactor)->
1973-
scope.GetDeclarations(parseResultsOpt, line, lineStr, colAtEndOfNamesAndResidue, qualifyingNames, partialName, hasTextChangedSinceLastTypecheck))
1974-
}
1942+
lethasTextChangedSinceLastTypecheck= defaultArg hasTextChangedSinceLastTypecheck(fun _->false)
1943+
threadSafeOp
1944+
(fun()-> failwith"not available")
1945+
(fun scope->
1946+
scope.GetDeclarations(parseResultsOpt, line, lineStr, colAtEndOfNamesAndResidue, qualifyingNames, partialName, hasTextChangedSinceLastTypecheck))
19751947

19761948
memberinfo.GetDeclarationListSymbols(parseResultsOpt,line,colAtEndOfNamesAndResidue,lineStr,qualifyingNames,partialName,?hasTextChangedSinceLastTypecheck)=
19771949
lethasTextChangedSinceLastTypecheck= defaultArg hasTextChangedSinceLastTypecheck(fun _->false)
1978-
reactorOp"GetDeclarationListSymbols" List.empty(fun scope-> scope.GetDeclarationListSymbols(parseResultsOpt, line, lineStr, colAtEndOfNamesAndResidue, qualifyingNames, partialName, hasTextChangedSinceLastTypecheck))
1950+
threadSafeOp
1951+
(fun()->[])
1952+
(fun scope-> scope.GetDeclarationListSymbols(parseResultsOpt, line, lineStr, colAtEndOfNamesAndResidue, qualifyingNames, partialName, hasTextChangedSinceLastTypecheck))
19791953

19801954
/// Resolve the names at the given location to give a data tip
19811955
memberinfo.GetStructuredToolTipTextAlternate(line,colAtEndOfNames,lineStr,names,tokenTag)=
19821956
letdflt= FSharpToolTipText[]
19831957
match tokenTagToTokenId tokenTagwith
19841958
| TOKEN_IDENT->
1985-
reactorOp"GetToolTipText"dflt(fun scope-> scope.GetStructuredToolTipText line lineStr colAtEndOfNames names)
1959+
threadSafeOp(fun()->dflt)(fun scope-> scope.GetStructuredToolTipText line lineStr colAtEndOfNames names)
19861960
| TOKEN_STRING| TOKEN_STRING_TEXT->
1987-
reactorOp"GetReferenceResolutionToolTipText"dflt(fun scope-> scope.GetReferenceResolutionStructuredToolTipText(line, colAtEndOfNames))
1961+
threadSafeOp(fun()->dflt)(fun scope-> scope.GetReferenceResolutionStructuredToolTipText(line, colAtEndOfNames))
19881962
|_->
1989-
async.Returndflt
1963+
dflt
19901964

19911965
memberinfo.GetToolTipTextAlternate(line,colAtEndOfNames,lineStr,names,tokenTag)=
19921966
info.GetStructuredToolTipTextAlternate(line, colAtEndOfNames, lineStr, names, tokenTag)
1993-
|> Tooltips.Map Tooltips.ToFSharpToolTipText
1967+
|> Tooltips.ToFSharpToolTipText
19941968

19951969
memberinfo.GetF1KeywordAlternate(line,colAtEndOfNames,lineStr,names)=
1996-
reactorOp"GetF1Keyword" None(fun scope->
1997-
scope.GetF1Keyword(line, lineStr, colAtEndOfNames, names))
1970+
threadSafeOp(fun()-> None)(fun scope-> scope.GetF1Keyword(line, lineStr, colAtEndOfNames, names))
19981971

19991972
// Resolve the names at the given location to a set of methods
20001973
memberinfo.GetMethodsAlternate(line,colAtEndOfNames,lineStr,names)=
2001-
letdflt= FSharpMethodGroup("",[||])
2002-
reactorOp"GetMethods" dflt(fun scope->
1974+
threadSafeOp(fun()-> FSharpMethodGroup("",[||]))(fun scope->
20031975
scope.GetMethods(line, lineStr, colAtEndOfNames, names))
20041976

20051977
memberinfo.GetDeclarationLocationAlternate(line,colAtEndOfNames,lineStr,names,?preferFlag)=
20061978
letdflt= FSharpFindDeclResult.DeclNotFound FSharpFindDeclFailureReason.Unknown
2007-
reactorOp"GetDeclarationLocation"dflt(fun scope->
1979+
threadSafeOp(fun()->dflt)(fun scope->
20081980
scope.GetDeclarationLocation(line, lineStr, colAtEndOfNames, names, preferFlag))
20091981

20101982
memberinfo.GetSymbolUseAtLocation(line,colAtEndOfNames,lineStr,names)=
2011-
reactorOp"GetSymbolUseAtLocation"None(fun scope->
1983+
threadSafeOp(fun()->None)(fun scope->
20121984
scope.GetSymbolUseAtLocation(line, lineStr, colAtEndOfNames, names)
20131985
|> Option.map(fun(sym,denv,m)-> FSharpSymbolUse(scope.TcGlobals,denv,sym,ItemOccurence.Use,m)))
20141986

20151987
memberinfo.GetMethodsAsSymbols(line,colAtEndOfNames,lineStr,names)=
2016-
reactorOp"GetMethodsAsSymbols"None(fun scope->
1988+
threadSafeOp(fun()->None)(fun scope->
20171989
scope.GetMethodsAsSymbols(line, lineStr, colAtEndOfNames, names)
20181990
|> Option.map(fun(symbols,denv,m)->
20191991
symbols|> List.map(fun sym-> FSharpSymbolUse(scope.TcGlobals,denv,sym,ItemOccurence.Use,m))))
20201992

20211993
memberinfo.GetSymbolAtLocationAlternate(line,colAtEndOfNames,lineStr,names)=
2022-
reactorOp"GetSymbolUseAtLocation"None(fun scope->
1994+
threadSafeOp(fun()->None)(fun scope->
20231995
scope.GetSymbolUseAtLocation(line, lineStr, colAtEndOfNames, names)
20241996
|> Option.map(fun(sym,_,_)-> sym))
20251997

2026-
20271998
memberinfo.GetFormatSpecifierLocations()=
2028-
threadSafeOp
2029-
(fun()->[||])
2030-
(fun(scope,_builder,_reactor)->
2031-
// This operation is not asynchronous - GetFormatSpecifierLocations can be run on the calling thread
2032-
scope.GetFormatSpecifierLocations())
1999+
threadSafeOp(fun()->[||])(fun scope-> scope.GetFormatSpecifierLocations())
20332000

20342001
memberinfo.GetExtraColorizationsAlternate()=
2035-
threadSafeOp
2036-
(fun()->[||])
2037-
(fun(scope,_builder,_reactor)->
2038-
// This operation is not asynchronous - GetExtraColorizations can be run on the calling thread
2039-
scope.GetExtraColorizations())
2002+
threadSafeOp(fun()->[||])(fun scope-> scope.GetExtraColorizations())
20402003

20412004
memberinfo.PartialAssemblySignature=
20422005
threadSafeOp
20432006
(fun()-> failwith"not available")
2044-
(fun(scope,_builder,_reactor)->
2045-
// This operation is not asynchronous - PartialAssemblySignature can be run on the calling thread
2046-
scope.PartialAssemblySignature())
2007+
(fun scope-> scope.PartialAssemblySignature())
20472008

20482009
memberinfo.ProjectContext=
20492010
threadSafeOp
20502011
(fun()-> failwith"not available")
2051-
(fun(scope,_builder,_reactor)->
2052-
// This operation is not asynchronous - GetReferencedAssemblies can be run on the calling thread
2053-
FSharpProjectContext(scope.ThisCcu, scope.GetReferencedAssemblies(), scope.AccessRights))
2012+
(fun scope-> FSharpProjectContext(scope.ThisCcu, scope.GetReferencedAssemblies(), scope.AccessRights))
20542013

20552014
memberinfo.GetAllUsesOfAllSymbolsInFile()=
2056-
reactorOp"GetAllUsesOfAllSymbolsInFile"[||](fun scope->
2015+
threadSafeOp(fun()->[||])(fun scope->
20572016
[|for(item,itemOcc,denv,m)in scope.ScopeSymbolUses.GetAllUsesOfSymbols()do
20582017
if itemOcc<> ItemOccurence.RelatedTextthen
20592018
letsymbol= FSharpSymbol.Create(scope.TcGlobals, scope.ThisCcu, scope.TcImports, item)
20602019
yield FSharpSymbolUse(scope.TcGlobals, denv, symbol, itemOcc, m)|])
20612020

20622021
memberinfo.GetUsesOfSymbolInFile(symbol:FSharpSymbol)=
2063-
reactorOp"GetUsesOfSymbolInFile"[||](fun scope->
2022+
threadSafeOp(fun()->[||])(fun scope->
20642023
[|for(itemOcc,denv,m)in scope.ScopeSymbolUses.GetUsesOfSymbol(symbol.Item)|> Seq.distinctBy(fun(itemOcc,_denv,m)-> itemOcc, m)do
20652024
if itemOcc<> ItemOccurence.RelatedTextthen
20662025
yield FSharpSymbolUse(scope.TcGlobals, denv, symbol, itemOcc, m)|])
20672026

2068-
memberinfo.GetVisibleNamespacesAndModulesAtPoint(pos:pos):Async<ModuleOrNamespaceRef[]>=
2069-
reactorOp"GetDeclarations"[||](fun scope-> scope.GetVisibleNamespacesAndModulesAtPosition(pos)|> List.toArray)
2027+
memberinfo.GetVisibleNamespacesAndModulesAtPoint(pos:pos)=
2028+
threadSafeOp(fun()->[||])(fun scope-> scope.GetVisibleNamespacesAndModulesAtPosition(pos)|> List.toArray)
20702029

2071-
memberinfo.IsRelativeNameResolvable(pos:pos,plid:string list,item:Item):Async<bool>=
2072-
reactorOp"IsRelativeNameResolvable"true(fun scope-> scope.IsRelativeNameResolvable(pos, plid, item))
2030+
memberinfo.IsRelativeNameResolvable(pos:pos,plid:string list,item:Item)=
2031+
threadSafeOp(fun()->true)(fun scope-> scope.IsRelativeNameResolvable(pos, plid, item))
20732032

20742033
//----------------------------------------------------------------------------
20752034
// BackgroundCompiler

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp