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

Commit992ca9e

Browse files
committed
Applying review.
Signed-off-by: realvictorprm <mueller.vpr@gmail.com>
1 parent9552970 commit992ca9e

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

‎src/fsharp/NicePrint.fs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,6 @@ module private PrintTastMemberOrVals =
11201120
for_,infoin argInfodo
11211121
info.Attribs<-[]
11221122
info.Name<- None
1123-
11241123

11251124
letmkNameL niceMethodTypars tagFunction name=
11261125
letnameL=

‎vsintegration/src/FSharp.Editor/CodeLens/FSharpCodeLensService.fs‎

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ type internal FSharpCodeLensService
6565
match binding|> Seq.tryFind(fun b-> b.RangeOfHeadPat.StartLine= pos.Line)with
6666
| Some entry->
6767
Some entry.RangeOfBindingAndRhs
68-
|_-> Some range// This can be invalid and should not happen
68+
| None->
69+
// We choose to use the default range because
70+
// it wasn't possible to find the complete range
71+
// including implementation code.
72+
Some range
6973

7074
override__.VisitBinding(fn,binding)=
7175
Some binding.RangeOfBindingAndRhs
@@ -193,30 +197,29 @@ type internal FSharpCodeLensService
193197
return None
194198
}
195199

196-
let inlinesetNewResultsAndWarnIfOverridenfullDeclarationText value=
197-
if newResults.ContainsKeyfullDeclarationTextthen
200+
let inlinesetNewResultsAndWarnIfOverridenfuncID value=
201+
if newResults.ContainsKeyfuncIDthen
198202
#if DEBUG
199-
logWarningf"New results already contains:%A"fullDeclarationText
203+
logWarningf"New results already contains:%A"funcID
200204
#else
201205
()
202206
#endif
203-
newResults.[fullDeclarationText]<- value
207+
newResults.[funcID]<- value
204208
for symbolUsein symbolUsesdo
205209
if symbolUse.IsFromDefinitionthen
206210
match symbolUse.Symbolwith
207211
|:? FSharpMemberOrFunctionOrValueas funcwhen func.IsModuleValueOrMember|| func.IsProperty->
208212
letfuncID= func.LogicalName+(func.FullType.ToString()|> hash|> string)
209213
// Use a combination of the the function name + the hashed value of the type signature
210-
letfullDeclarationText= funcID// (textSnapshot.GetText declarationSpan).Replace(func.CompiledName, funcID)
211214
letfullTypeSignature= func.FullType.ToString()
212215
// Try to re-use the last results
213-
if lastResults.ContainsKeyfullDeclarationTextthen
216+
if lastResults.ContainsKeyfuncIDthen
214217
// Make sure that the results are usable
215-
let inlinesetNewResultsAndWarnIfOverridenLocal value= setNewResultsAndWarnIfOverridenfullDeclarationText value
216-
letlastTrackingSpan,codeLens as lastResult= lastResults.[fullDeclarationText]
218+
let inlinesetNewResultsAndWarnIfOverridenLocal value= setNewResultsAndWarnIfOverridenfuncID value
219+
letlastTrackingSpan,codeLens as lastResult= lastResults.[funcID]
217220
if codeLens.FullTypeSignature= fullTypeSignaturethen
218221
setNewResultsAndWarnIfOverridenLocal lastResult
219-
oldResults.RemovefullDeclarationText|> ignore
222+
oldResults.RemovefuncID|> ignore
220223
else
221224
letdeclarationLine,range=
222225
match visit func.DeclarationLocation.Start parsedInputwith
@@ -236,19 +239,19 @@ type internal FSharpCodeLensService
236239
fullTypeSignature,
237240
null)
238241
// The old results aren't computed at all, because the line might have changed create new results
239-
tagsToUpdate.[lastTrackingSpan]<-(newTrackingSpan,fullDeclarationText, res)
242+
tagsToUpdate.[lastTrackingSpan]<-(newTrackingSpan,funcID, res)
240243
setNewResultsAndWarnIfOverridenLocal(newTrackingSpan, res)
241244

242-
oldResults.RemovefullDeclarationText|> ignore
245+
oldResults.RemovefuncID|> ignore
243246
else
244247
// The symbol might be completely new or has slightly changed.
245248
// We need to track this and iterate over the left entries to ensure that there isn't anything
246-
unattachedSymbols.Add((symbolUse, func,fullDeclarationText, fullTypeSignature))
249+
unattachedSymbols.Add((symbolUse, func,funcID, fullTypeSignature))
247250
|_->()
248251

249252
// In best case this works quite `covfefe` fine because often enough we change only a small part of the file and not the complete.
250253
for unattachedSymbolin unattachedSymbolsdo
251-
letsymbolUse,func,fullDeclarationText,fullTypeSignature= unattachedSymbol
254+
letsymbolUse,func,funcID,fullTypeSignature= unattachedSymbol
252255
letdeclarationLine,range=
253256
match visit func.DeclarationLocation.Start parsedInputwith
254257
| Some range-> range.StartLine-1, range
@@ -267,8 +270,8 @@ type internal FSharpCodeLensService
267270
letnewTrackingSpan=
268271
textSnapshot.CreateTrackingSpan(declarationSpan, SpanTrackingMode.EdgeExclusive)
269272
if codeLens.Computed&&(isNull codeLens.UiElement|>not)then
270-
newResults.[fullDeclarationText]<-(newTrackingSpan, codeLens)
271-
tagsToUpdate.[trackingSpan]<-(newTrackingSpan,fullDeclarationText, codeLens)
273+
newResults.[funcID]<-(newTrackingSpan, codeLens)
274+
tagsToUpdate.[trackingSpan]<-(newTrackingSpan,funcID, codeLens)
272275
else
273276
letres=
274277
CodeLens(
@@ -277,8 +280,8 @@ type internal FSharpCodeLensService
277280
fullTypeSignature,
278281
null)
279282
// The tag might be still valid but it hasn't been computed yet so create fresh results
280-
tagsToUpdate.[trackingSpan]<-(newTrackingSpan,fullDeclarationText, res)
281-
newResults.[fullDeclarationText]<-(newTrackingSpan, res)
283+
tagsToUpdate.[trackingSpan]<-(newTrackingSpan,funcID, res)
284+
newResults.[funcID]<-(newTrackingSpan, res)
282285
letkey= res.Key
283286
oldResults.Remove key|> ignore// no need to check this entry again
284287
| None->
@@ -299,7 +302,7 @@ type internal FSharpCodeLensService
299302
lettrackingSpan=
300303
textSnapshot.CreateTrackingSpan(declarationSpan, SpanTrackingMode.EdgeExclusive)
301304
codeLensToAdd.Add(trackingSpan, res)
302-
newResults.[fullDeclarationText]<-(trackingSpan, res)
305+
newResults.[funcID]<-(trackingSpan, res)
303306
#if DEBUG
304307
with e->
305308
logExceptionWithContext(e,"Line Lens tracking tag span creation")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp