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

Commit37517de

Browse files
committed
Make indexer fix "(f()) [i]"
1 parentea2ce2b commit37517de

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

‎vsintegration/src/FSharp.Editor/CodeFix/FixIndexerAccess.fs‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,25 @@ type internal FSharpFixIndexerAccessCodeFixProvider() =
4444
|> Seq.iter(fun diagnostic->
4545
letdiagnostics= ImmutableArray.Create diagnostic
4646
letspan,replacement=
47-
context.Span,sourceText.GetSubText(context.Span).ToString()
47+
try
48+
letspan= ref context.Span
49+
50+
// skip all braces and blanks until we find [
51+
while
52+
(!span).End< sourceText.Length&&
53+
lett= TextSpan((!span).Start,(!span).Length+1)
54+
lets= sourceText.GetSubText(t).ToString()
55+
s.[s.Length-1]<>'['do
56+
span:= TextSpan((!span).Start,(!span).Length+ 1)
57+
58+
!span,sourceText.GetSubText(!span).ToString()
59+
with
60+
|_-> context.Span,sourceText.GetSubText(context.Span).ToString()
4861

4962
letcodefix=
5063
createCodeFix(
5164
FSComp.SR.addIndexerDot(),
5265
context,
53-
TextChange(span, replacement+"."))
66+
TextChange(span, replacement.TrimEnd()+"."))
5467
context.RegisterCodeFix(codefix, diagnostics))
5568
}|> RoslynHelpers.StartAsyncUnitAsTask(context.CancellationToken)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp