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

Commita8d516a

Browse files
vasily-kirichenkoKevinRansom
authored andcommitted
fix namespace auto open if parsed input is empty (#5040)
@vasily-kirichenko Thank you for this fix.
1 parentca2e154 commita8d516a

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

‎src/fsharp/service/ServiceAssemblyContent.fs‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -999,8 +999,11 @@ module ParsedInput =
999999

10001000
mkPos line ctx.Pos.Column
10011001

1002-
lettryFindNearestPointToInsertOpenDeclaration(currentLine:int)(ast:ParsedInput)(entity:Idents)(insertionPoint:OpenStatementInsertionPoint)=
1002+
letfindNearestPointToInsertOpenDeclaration(currentLine:int)(ast:ParsedInput)(entity:Idents)(insertionPoint:OpenStatementInsertionPoint)=
10031003
match tryFindNearestPointAndModules currentLine ast insertionPointwith
10041004
| Some(scope,_, point), modules->
1005-
Some(findBestPositionToInsertOpenDeclaration modules scope point entity)
1006-
|_-> None
1005+
findBestPositionToInsertOpenDeclaration modules scope point entity
1006+
|_->
1007+
// we failed to find insertion point because ast is empty for some reason, return top left point in this case
1008+
{ ScopeKind= ScopeKind.TopModule
1009+
Pos= mkPos10}

‎src/fsharp/service/ServiceAssemblyContent.fsi‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ module public ParsedInput =
145145
(((* requiresQualifiedAccessParent:*) Idents option*(* autoOpenParent:*) Idents option*(* entityNamespace*) Idents option*(* entity:*) Idents)->(Entity* InsertContext)[])
146146

147147
/// Returns `InsertContext` based on current position and symbol idents.
148-
valtryFindNearestPointToInsertOpenDeclaration:currentLine:int->ast:Ast.ParsedInput->entity:Idents->insertionPoint:OpenStatementInsertionPoint->InsertContext option
148+
valfindNearestPointToInsertOpenDeclaration:currentLine:int->ast:Ast.ParsedInput->entity:Idents->insertionPoint:OpenStatementInsertionPoint->InsertContext
149149

150150
/// Returns lond identifier at position.
151151
valgetLongIdentAt:ast:Ast.ParsedInput->pos:Range.pos->Ast.LongIdent option

‎vsintegration/src/FSharp.Editor/Completion/CompletionProvider.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ type internal FSharpCompletionProvider
296296
if Settings.CodeFixes.AlwaysPlaceOpensAtTopLevelthen OpenStatementInsertionPoint.TopLevel
297297
else OpenStatementInsertionPoint.Nearest
298298

299-
let!ctx= ParsedInput.tryFindNearestPointToInsertOpenDeclaration line.LineNumber parsedInput fullNameIdents insertionPoint
299+
letctx= ParsedInput.findNearestPointToInsertOpenDeclaration line.LineNumber parsedInput fullNameIdents insertionPoint
300300
letfinalSourceText,changedSpanStartPos= OpenDeclarationHelper.insertOpenDeclaration textWithItemCommitted ctx ns
301301
letfullChangingSpan= TextSpan.FromBounds(changedSpanStartPos, item.Span.End)
302302
letchangedSpan= TextSpan.FromBounds(changedSpanStartPos, item.Span.End+(finalSourceText.Length- sourceText.Length))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp