@@ -43,7 +43,7 @@ type internal DocumentLocations =
4343{ Document: Document
4444 Locations: InlineRenameLocation [] }
4545
46- type internal InlineRenameLocationSet ( locationsByDocument : DocumentLocations [], originalSolution : Solution ) =
46+ type internal InlineRenameLocationSet ( locationsByDocument : DocumentLocations [], originalSolution : Solution , symbolKind : LexerSymbolKind , symbol : FSharpSymbol ) =
4747interface IInlineRenameLocationSetwith
4848member __.Locations : IList < InlineRenameLocation > =
4949upcast [| for docin locationsByDocumentdo yield ! doc.Locations|]. ToList()
@@ -66,7 +66,7 @@ type internal InlineRenameLocationSet(locationsByDocument: DocumentLocations [],
6666return
6767{ new IInlineRenameReplacementInfowith
6868member __.NewSolution = newSolution
69- member __.ReplacementTextValid = true
69+ member __.ReplacementTextValid = CommonHelpers.isValidNameForSymbol ( symbolKind , symbol , replacementText )
7070member __.DocumentIds = locationsByDocument|> Seq.map( fun doc -> doc.Document.Id)
7171member __.GetReplacements ( documentId ) = Seq.empty}
7272}
@@ -78,6 +78,7 @@ type internal InlineRenameInfo
7878 projectInfoManager: ProjectInfoManager,
7979 document: Document,
8080 sourceText: SourceText,
81+ lexerSymbol: LexerSymbol,
8182 symbolUse: FSharpSymbolUse,
8283 declLoc: SymbolDeclarationLocation,
8384 checkFileResults: FSharpCheckFileResults
@@ -130,7 +131,7 @@ type internal InlineRenameInfo
130131return { Document= document; Locations= locations}
131132})
132133|> Async.Parallel
133- return InlineRenameLocationSet( locationsByDocument, document.Project.Solution) :> IInlineRenameLocationSet
134+ return InlineRenameLocationSet( locationsByDocument, document.Project.Solution, lexerSymbol.Kind , symbolUse.Symbol ) :> IInlineRenameLocationSet
134135} |> CommonRoslynHelpers.StartAsyncAsTask( cancellationToken)
135136
136137member __.TryOnBeforeGlobalSymbolRenamed ( _workspace , _changedDocumentIDs , _replacementText ) = true
@@ -150,12 +151,12 @@ type internal InlineRenameService
150151asyncMaybe {
151152let textLine = sourceText.Lines.GetLineFromPosition( position)
152153let textLinePos = sourceText.Lines.GetLinePosition( position)
153- let fcsTextLineNumber = textLinePos. Line+ 1 // Roslyn line numbers are zero-based, FSharp.Compiler.Service line numbers are 1-based
154+ let fcsTextLineNumber = Line.fromZ textLinePos.Line
154155let! symbol = CommonHelpers.getSymbolAtPosition( document.Id, sourceText, position, document.FilePath, defines, SymbolLookupKind.Greedy)
155156let! _ , _ , checkFileResults = checker.ParseAndCheckDocument( document, options, allowStaleResults= true )
156157let! symbolUse = checkFileResults.GetSymbolUseAtLocation( fcsTextLineNumber, symbol.Ident.idRange.EndColumn, textLine.Text.ToString(), symbol.FullIsland)
157158let! declLoc = symbolUse.GetDeclarationLocation( document)
158- return InlineRenameInfo( checker, projectInfoManager, document, sourceText, symbolUse, declLoc, checkFileResults) :> IInlineRenameInfo
159+ return InlineRenameInfo( checker, projectInfoManager, document, sourceText, symbol , symbolUse, declLoc, checkFileResults) :> IInlineRenameInfo
159160}
160161
161162interface IEditorInlineRenameServicewith