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

Commit8f8cbd6

Browse files
realvictorprmKevinRansom
authored andcommitted
Code Lens and Line Lens (dotnet#3608)
* Found a workaround for the heavy code lens bug.Merged master into the branch.Signed-off-by: realvictorprm <mueller.vpr@gmail.com>* Fixes a deadlock due to context changes + started removing mutex. This is from yesterday!Review is NOT applied yet!Signed-off-by: realvictorprm <mueller.vpr@gmail.com>* Small fixes, applied a part of the reviewsThe UI is still buggy. This is very annoying.@saul I should report the bug you read about in my comments. . .Signed-off-by: realvictorprm <mueller.vpr@gmail.com>* Fixed CodeLens layout updates.Added possibility to enforce a re-layout of the visible code lens for the next layout-changed call.Applied suggestions from the reviews (could be that I missed one or two).Small cleanup.Small documentation additions.More checks.Removed some debug code.Added some debug code, most only appears if exceptions are thrown.The caching is still a small bit broken. At least I found out it's only a bit broken.Signed-off-by: realvictorprm <mueller.vpr@gmail.com>* Fixing removal of Code Lens.Reuse of elements still needs to be finished. I started it months ago but didn't finish it.Signed-off-by: realvictorprm <mueller.vpr@gmail.com>* Fixing fatal UI logic.Finally activated code for using cache results (so fixed a bug which included that code lens could be lost for us).Small cleanup to reduce confusion and decreased chance of introducing bugs due to this.Changing TaggerProvider to a more appropriate one.Discovered bugs in the visitor logic.* Added Line-LensAdded Options page to disable Code-Lens and to switch between Code-Lens and Line-LensMore caching fixes. Minimal UI fixesSigned-off-by: realvictorprm <mueller.vpr@gmail.com>* Fixed caching completely.Also fixed with this UI issues.Big cleanup.Now it's ready for another round of reviews!Signed-off-by: realvictorprm <mueller.vpr@gmail.com>* Added prefix optionSigned-off-by: realvictorprm <mueller.vpr@gmail.com>* Fixing bug reported by VasilyFixing cache bug.Fixing ui-offset bug.Fixing multi-view bug.Fixing build.Fixing signature bug reported by@saulSigned-off-by: realvictorprm <mueller.vpr@gmail.com>* Fixing KeyNotFoundException.Signed-off-by: realvictorprm <mueller.vpr@gmail.com>* Another UI fix.Code Lens are now hidden as soon as their line isn't visible anymore due to inserting new lines.Signed-off-by: realvictorprm <mueller.vpr@gmail.com>* Applied some review comments.Heavy performance improvements, now layouting isn't done every time due to that Visual Studio just transforms everything together (it's not viewport relative anymore, it's owner controlled but still in the wpf-text-view-coordinate-system)!The UI should now be fine in my opinion. It wasn't able for me to find a better workaround as just subtracting one pixel from the top position of the adornments.Signed-off-by: realvictorprm <mueller.vpr@gmail.com>* Another round of small cleanup.Signed-off-by: realvictorprm <mueller.vpr@gmail.com>* Another UI layout fix.Now weird code lens anymore :PSigned-off-by: realvictorprm <mueller.vpr@gmail.com>* Fixing merge* start working on color option* use darker gray à la normal CodeLens* Bind only from XAML. Fixes issue where "prefix" option was not saved* Undo unintended whitespace change* Should be part of previous commit* start working on color option* use darker gray à la normal CodeLens* Undo unintended whitespace change* Should be part of previous commit* fix value names* Applied review + small workaround for a bug.Merry Christmas!Signed-off-by: realvictorprm <mueller.vpr@gmail.com>* Removed old files* trying to fix CISigned-off-by: realvictorprm <mueller.vpr@gmail.com>* First fix for member and constructor signatures!Signed-off-by: realvictorprm <mueller.vpr@gmail.com>
1 parent7453587 commit8f8cbd6

File tree

35 files changed

+1556
-6
lines changed

35 files changed

+1556
-6
lines changed

‎src/fsharp/NicePrint.fs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1970,6 +1970,7 @@ let isGeneratedExceptionField pos f = TastDefinitionPrinting.isGeneratedExce
19701970
letstringOfTyparConstraint denv tpc= stringOfTyparConstraints denv[tpc]
19711971
letstringOfTy denv x= x|> PrintTypes.layoutType denv|> showL
19721972
letprettyLayoutOfType denv x= x|> PrintTypes.prettyLayoutOfType denv
1973+
letprettyLayoutOfTypeNoCx denv x= x|> PrintTypes.prettyLayoutOfTypeNoConstraints denv
19731974
letprettyStringOfTy denv x= x|> PrintTypes.prettyLayoutOfType denv|> showL
19741975
letprettyStringOfTyNoCx denv x= x|> PrintTypes.prettyLayoutOfTypeNoConstraints denv|> showL
19751976
letstringOfRecdField denv x= x|> TastDefinitionPrinting.layoutRecdFieldfalse denv|> showL

‎src/fsharp/service/service.fs‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,9 @@ type TypeCheckInfo
908908
match itemwith
909909
| Item.Types_| Item.ModuleOrNamespaces_->true
910910
|_->false
911+
912+
/// Find the most precise display context for the given line and column.
913+
member__.GetBestDisplayEnvForPos cursorPos= GetBestEnvForPos cursorPos
911914

912915
member__.GetVisibleNamespacesAndModulesAtPosition(cursorPos:pos):ModuleOrNamespaceRef list=
913916
let(nenv,ad),m= GetBestEnvForPos cursorPos
@@ -1982,6 +1985,7 @@ type FSharpCheckFileResults(filename: string, errors: FSharpErrorInfo[], scopeOp
19821985
|_->
19831986
async.Return dflt
19841987

1988+
19851989
memberinfo.GetToolTipText(line,colAtEndOfNames,lineStr,names,tokenTag,userOpName)=
19861990
info.GetStructuredToolTipText(line, colAtEndOfNames, lineStr, names, tokenTag, ?userOpName=userOpName)
19871991
|> Tooltips.Map Tooltips.ToFSharpToolTipText
@@ -2093,6 +2097,13 @@ type FSharpCheckFileResults(filename: string, errors: FSharpErrorInfo[], scopeOp
20932097
RequireCompilationThread ctok
20942098
scope.IsRelativeNameResolvableFromSymbol(pos, plid, symbol))
20952099

2100+
memberinfo.GetDisplayEnvForPos(pos:pos):Async<DisplayEnvoption>=
2101+
letuserOpName="CodeLens"
2102+
reactorOp userOpName"GetDisplayContextAtPos" None(fun ctok scope->
2103+
DoesNotRequireCompilerThreadTokenAndCouldPossiblyBeMadeConcurrent ctok
2104+
let(nenv,_),_= scope.GetBestDisplayEnvForPos pos
2105+
Some nenv.DisplayEnv)
2106+
20962107
memberinfo.ImplementationFiles=
20972108
ifnot keepAssemblyContentsthen invalidOp"The 'keepAssemblyContents' flag must be set to true on the FSharpChecker in order to access the checked contents of assemblies"
20982109
scopeOptX

‎src/fsharp/service/service.fsi‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,9 @@ type public FSharpCheckFileResults =
242242

243243
member internal GetVisibleNamespacesAndModulesAtPoint: pos-> Async<Tast.ModuleOrNamespaceRef[]>
244244

245+
/// Find the most precise display environment for the given line and column.
246+
member internal GetDisplayEnvForPos: pos: pos-> Async<DisplayEnv option>
247+
245248
/// Determines if a long ident is resolvable at a specific point.
246249
///<param name="userOpName">An optional string usedfor tracing compiler operations associatedwith this request.</param>
247250
memberinternalIsRelativeNameResolvable:cursorPos:pos* plid: string list* item: Item* ?userOpName: string-> Async<bool>

‎src/fsharp/symbols/Symbols.fs‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1844,6 +1844,23 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
18441844
prefix+ x.LogicalName
18451845
with_->"??"
18461846

1847+
memberx.FormatLayout(denv:FSharpDisplayContext)=
1848+
match x.IsMember, dwith
1849+
|true, V v->
1850+
NicePrint.prettyLayoutOfValOrMemberNoInst{(denv.Contents cenv.g)with showMemberContainers=true} v.Deref
1851+
|_,_->
1852+
checkIsResolved()
1853+
letty=
1854+
match dwith
1855+
| E e-> e.GetDelegateType(cenv.amap, range0)
1856+
| P p-> p.GetPropertyType(cenv.amap, range0)
1857+
| M m| C m->
1858+
letrty= m.GetFSharpReturnTy(cenv.amap, range0, m.FormalMethodInst)
1859+
letargtysl= m.GetParamTypes(cenv.amap, range0, m.FormalMethodInst)
1860+
mkIteratedFunTy(List.map(mkRefTupledTy cenv.g) argtysl) rty
1861+
| V v-> v.TauType
1862+
NicePrint.prettyLayoutOfTypeNoCx(denv.Contents cenv.g) ty
1863+
18471864

18481865
andFSharpType(cenv,typ:TType)=
18491866

@@ -1989,7 +2006,11 @@ and FSharpType(cenv, typ:TType) =
19892006

19902007
memberx.Format(denv:FSharpDisplayContext)=
19912008
protect<|fun()->
1992-
NicePrint.prettyStringOfTyNoCx(denv.Contents cenv.g) typ
2009+
NicePrint.prettyStringOfTyNoCx(denv.Contents cenv.g) typ
2010+
2011+
memberx.FormatLayout(denv:FSharpDisplayContext)=
2012+
protect<|fun()->
2013+
NicePrint.prettyLayoutOfTypeNoCx(denv.Contents cenv.g) typ
19932014

19942015
overridex.ToString()=
19952016
protect<|fun()->

‎src/fsharp/symbols/Symbols.fsi‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,9 @@ and [<Class>] public FSharpMemberOrFunctionOrValue =
819819

820820
/// Indicates if this is a constructor.
821821
memberIsConstructor:bool
822+
823+
/// Format the type using the rules of the given display context
824+
memberFormatLayout:context:FSharpDisplayContext->Layout
822825

823826

824827
/// A subtype of FSharpSymbol that represents a parameter
@@ -931,6 +934,9 @@ and [<Class>] public FSharpType =
931934
/// Format the type using the rules of the given display context
932935
memberFormat:context:FSharpDisplayContext->string
933936

937+
/// Format the type using the rules of the given display context
938+
memberFormatLayout:context:FSharpDisplayContext->Layout
939+
934940
/// Instantiate generic type parameters in a type
935941
memberInstantiate:(FSharpGenericParameter* FSharpType)list->FSharpType
936942

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp