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

Commitbc53e0d

Browse files
Fix find references bug in VS for operators which start with '>' (#15386)
1 parentd9e267b commitbc53e0d

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

‎vsintegration/src/FSharp.Editor/LanguageService/Tokenizer.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ module internal Tokenizer =
361361
typeFSharpTokenInfowith
362362

363363
membertoken.IsIdentifier=(token.CharClass= FSharpTokenCharKind.Identifier)
364-
membertoken.IsOperator=(token.ColorClass=FSharpTokenColorKind.Operator)
364+
membertoken.IsOperator=(token.CharClass=FSharpTokenCharKind.Operator)
365365
membertoken.IsPunctuation=(token.ColorClass= FSharpTokenColorKind.Punctuation)
366366
membertoken.IsString=(token.ColorClass= FSharpTokenColorKind.String)
367367
membertoken.IsComment=(token.ColorClass= FSharpTokenColorKind.Comment)

‎vsintegration/tests/FSharp.Editor.Tests/FindReferencesTests.fs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,44 @@ module FindReferences =
129129
foundReferences.Count<>2// One in signature file, one in Third file
130130
then
131131
failwith $"Expected 2 references but found {foundReferences.Count}"
132+
133+
[<Theory>]
134+
[<InlineData(">=>")>]
135+
[<InlineData(">++")>]
136+
let``Find references to operators start with>``operator=
137+
138+
letproject2=
139+
SyntheticProject.Create(
140+
{ sourceFile"First"[]with
141+
SignatureFile= No
142+
ExtraSource=
143+
"let compose x = fun y -> x - y\n"
144+
+ $"let ({operator}) = compose\n"
145+
+ $"let test t = t {operator} 5\n"
146+
},
147+
{ sourceFile"Second"["First"]with
148+
ExtraSource="open ModuleFirst\n"+ $"let z = 4 {operator} 5\n"
149+
}
150+
)
151+
152+
letsolution2,_= RoslynTestHelpers.CreateSolution project2
153+
154+
letcontext,foundDefinitions,foundReferences= getContext()
155+
156+
letdocumentPath= project2.GetFilePath"Second"
157+
158+
letdocument=
159+
solution2.TryGetDocumentFromPath documentPath
160+
|> Option.defaultWith(fun _-> failwith"Document not found")
161+
162+
findUsagesService
163+
.FindReferencesAsync(document, getPositionOf operator documentPath, context)
164+
.Wait()
165+
166+
// We cannot easily inspect what exactly was found here, but that should be verified
167+
// in FSharp.Compiler.ComponentTests.FSharpChecker.FindReferences
168+
if foundDefinitions.Count<>1then
169+
failwith $"Expected 1 definition but found {foundDefinitions.Count}"
170+
171+
if foundReferences.Count<>2then
172+
failwith $"Expected 2 reference but found {foundReferences.Count}"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp