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

Commit0d54038

Browse files
vasily-kirichenkoKevinRansom
authored andcommitted
remove restrictions on where Add Open code fix can appear in parse AST because it's already ruled by Diagnostic code (dotnet#2081)
1 parent162e572 commit0d54038

File tree

1 file changed

+21
-33
lines changed

1 file changed

+21
-33
lines changed

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

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -184,40 +184,28 @@ type internal FSharpAddOpenCodeFixProvider
184184
match symbolwith
185185
| Some symbol->
186186
letpos= Pos.fromZ textLinePos.Line textLinePos.Character
187-
match ParsedInput.getEntityKind parsedInput poswith
187+
letisAttribute= ParsedInput.getEntityKind parsedInput pos= Some EntityKind.Attribute
188+
letentities=
189+
assemblyContentProvider.GetAllEntitiesInProjectAndReferencedAssemblies checkFileResults
190+
|> List.map(fun e->
191+
[yield e.TopRequireQualifiedAccessParent, e.AutoOpenParent, e.Namespace, e.CleanedIdents
192+
if isAttributethen
193+
letlastIdent= e.CleanedIdents.[e.CleanedIdents.Length-1]
194+
if e.Kind= EntityKind.Attribute&& lastIdent.EndsWith"Attribute"then
195+
yield
196+
e.TopRequireQualifiedAccessParent,
197+
e.AutoOpenParent,
198+
e.Namespace,
199+
e.CleanedIdents
200+
|> Array.replace(e.CleanedIdents.Length-1)(lastIdent.Substring(0, lastIdent.Length-9))])
201+
|> List.concat
202+
203+
letidents= ParsedInput.getLongIdentAt parsedInput(Range.mkPos pos.Line symbol.RightColumn)
204+
match identswith
205+
| Some idents->
206+
letcreateEntity= ParsedInput.tryFindInsertionContext pos.Line parsedInput idents
207+
return entities|> Seq.map createEntity|> Seq.concat|> Seq.toList|> getSuggestions context
188208
| None->()
189-
| Some entityKind->
190-
letisAttribute= entityKind= EntityKind.Attribute
191-
letentities=
192-
assemblyContentProvider.GetAllEntitiesInProjectAndReferencedAssemblies checkFileResults
193-
|> List.filter(fun e->
194-
match entityKind, e.Kindwith
195-
| EntityKind.Attribute, EntityKind.Attribute
196-
| EntityKind.Type,(EntityKind.Type| EntityKind.Attribute)
197-
| EntityKind.FunctionOrValue_,_->true
198-
| EntityKind.Attribute,_
199-
|_, EntityKind.Module_
200-
| EntityKind.Module_,_
201-
| EntityKind.Type,_->false)
202-
|> List.map(fun e->
203-
[yield e.TopRequireQualifiedAccessParent, e.AutoOpenParent, e.Namespace, e.CleanedIdents
204-
if isAttributethen
205-
letlastIdent= e.CleanedIdents.[e.CleanedIdents.Length-1]
206-
if e.Kind= EntityKind.Attribute&& lastIdent.EndsWith"Attribute"then
207-
yield
208-
e.TopRequireQualifiedAccessParent,
209-
e.AutoOpenParent,
210-
e.Namespace,
211-
e.CleanedIdents
212-
|> Array.replace(e.CleanedIdents.Length-1)(lastIdent.Substring(0, lastIdent.Length-9))])
213-
|> List.concat
214-
215-
letidents= ParsedInput.getLongIdentAt parsedInput(Range.mkPos pos.Line symbol.RightColumn)
216-
match identswith
217-
| Some idents->
218-
letcreateEntity= ParsedInput.tryFindInsertionContext pos.Line parsedInput idents
219-
return entities|> Seq.map createEntity|> Seq.concat|> Seq.toList|> getSuggestions context
220-
| None->()
221209
| None->()
222210
| None->()
223211
}|> CommonRoslynHelpers.StartAsyncUnitAsTask(context.CancellationToken)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp