WIP: Enable DateTime completion in string interpolation format strings.#43569
WIP: Enable DateTime completion in string interpolation format strings.#43569CyrusNajmabadi merged 2 commits intodotnet:masterfrom
Conversation
There was a problem hiding this comment.
I'm not sure what to do with this line. CompletionProvider receives position of '}' of format expression inside of string interpolation. I get previous token for analization, but SpanStart for the token is position - 1. I've temporarily commented this line. @CyrusNajmabadi Do you have any idea what the best way to handle it?
There was a problem hiding this comment.
i'm not really understanding the issue. stringTokenOpt should be the appropriate string token for either case, unless the caller isn't passing the right thing.
There was a problem hiding this comment.
why were these removed.
There was a problem hiding this comment.
IsMethodArgument contains these conditions:
private static bool IsMethodArgument(SyntaxToken token, ISyntaxFacts syntaxFacts)
=> syntaxFacts.IsLiteralExpression(token.Parent) &&
syntaxFacts.IsArgument(token.Parent!.Parent);
...s/Core/Portable/EmbeddedLanguages/DateAndTime/LanguageServices/DateAndTimePatternDetector.cs
Outdated
Show resolved
Hide resolved
...s/Core/Portable/EmbeddedLanguages/DateAndTime/LanguageServices/DateAndTimePatternDetector.cs
Outdated
Show resolved
Hide resolved
...tiesAndExtensions/Compiler/CSharp/EmbeddedLanguages/VirtualChars/CSharpVirtualCharService.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
no equivalent change for VB?
...s/Core/Portable/EmbeddedLanguages/DateAndTime/LanguageServices/DateAndTimePatternDetector.cs
Outdated
Show resolved
Hide resolved
...s/Core/Portable/EmbeddedLanguages/DateAndTime/LanguageServices/DateAndTimePatternDetector.cs
Outdated
Show resolved
Hide resolved
...s/Core/Portable/EmbeddedLanguages/DateAndTime/LanguageServices/DateAndTimePatternDetector.cs
Outdated
Show resolved
Hide resolved
...s/Core/Portable/EmbeddedLanguages/DateAndTime/LanguageServices/DateAndTimePatternDetector.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
To get InterpolatedStringTextToken. For ToString method it returns the same token.
There was a problem hiding this comment.
Seems weird. If I was after the token in a format clause, what token is returned?
There was a problem hiding this comment.
root.FindToken(position) returns } for $"Text {date:$$}" and for $"Text {date:M$$}"
There was a problem hiding this comment.
ok. but what does it return for FindTokenOnLeftOfPosition? i would expect it to return the : token then. Is that not hte case? If FindToken returns the } chec if that's the case (i.e. you're at the start of that token, and move back one token. That seems like the simpler approach to take.
There was a problem hiding this comment.
FindTokenOnLeftOfPosition returns : for $"Text {date:$$}" and :M for $"Text {date:$$}". That exactly what we need here.
There was a problem hiding this comment.
ok. can you please doc in the code. thanks :)
|
@zaytsev-victor What woudl you like to do with this PR? Thanks! :) |
|
@CyrusNajmabadi I will be very busy until the end of this week but I can finish it on the next week. I need to add comment for line var token = root.FindTokenOnLeftOfPosition(position);. Could you please help me with this line? This isn't work in string interpolation case. Should I delete it or rework somehow? |
Once you make your changes, let me know. I'll debug through to see waht hte issue is. |
|
Hey @zaytsev-victor will you be able to get to this? or would you want us to take this over for you? Thanks! |
|
Hey @zaytsev-victor will you be able to get to this? or would you want us to take this over for you? Thanks! |
|
I'm going to look at thsi to see what it woudl take to support this scenario. |
6c29c0f to
45588cc
Compare
|
@zaytsev-victor thanks for the PR! |
Fixes #43267