Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 13:50
    dotnet-issue-labeler[bot] labeled #52832
  • 13:50
    dotnet-issue-labeler[bot] labeled #52832
  • 13:50
    AlekseyTs labeled #52832
  • 13:50
    AlekseyTs labeled #52832
  • 13:50
    AlekseyTs opened #52832
  • 13:46
    AlekseyTs commented #52802
  • 13:29
    Youssef1313 review_requested #52697
  • 13:29
    Youssef1313 reopened #52697
  • 13:29
    Youssef1313 closed #52697
  • 13:29
    Youssef1313 commented #52697
  • 12:35
    andreas-soroko closed #52830
  • 12:30
    andreas-soroko edited #52830
  • 12:28
    andreas-soroko edited #52830
  • 12:27
    dotnet-issue-labeler[bot] labeled #52830
  • 12:27
    dotnet-issue-labeler[bot] labeled #52830
  • 12:27
    andreas-soroko opened #52830
  • 12:13
    dotnet-maestro[bot] synchronize #52766
  • 12:13

    dotnet-maestro[bot] on darc-main-81a580e4-64fe-4695-a860-10155858872f

    Update dependencies from https:… (compare)

  • 12:13
    dotnet-maestro[bot] edited #52766
  • 12:01

    dotnet-bot on release

    (compare)

CyrusNajmabadi
@CyrusNajmabadi
the reet of the behavior has defaults that are provided (though which you can override if you want)
Yair Halberstadt
@YairHalberstadt
Thanks! Will check it out next opportunity I have
Yair Halberstadt
@YairHalberstadt

@CyrusNajmabadi are you saying I should implement CompletionService?

To clarify my use case, I want to insert some non existent method names into the Code Completion list a user sees when they're looking for members of a type. I'm not sure how CompletionService helps me

CyrusNajmabadi
@CyrusNajmabadi
hrmm.. i have to page this back into my brain
(this changed a few times)
sorry, implement CompletionProvider
Yair Halberstadt
@YairHalberstadt
Yep, so I implement CompletionProvider, but it looks like doing this correctly is ridiculously complex
CyrusNajmabadi
@CyrusNajmabadi
hrmm
give more info on what your provider wants to do?
Yair Halberstadt
@YairHalberstadt
In exactly the same way as you would normally display members of Span<T> display a bunch of extension methods which don't actually exist yet, but will be generated if you use them.
But SymbolCompletionProvider seems to have thousands of lines of logic just to work out when to display members and when not to, and it's all internal.
CyrusNajmabadi
@CyrusNajmabadi
got it
yeah, we could likely do with an extensino point of: i want to add more members to a particular symbol, allow me to intercept that
could you file an issue on that?
i can add more dtail.
it will have more weight as a customer asking for this
Yair Halberstadt
@YairHalberstadt
Ok, I can do that, Thanks!
CyrusNajmabadi
@CyrusNajmabadi
:+1:
Yair Halberstadt
@YairHalberstadt
Yair Halberstadt
@YairHalberstadt

As an aside you're not going to like my generator:

It creates a series of new Compilations in a loop:

First it check if anyone's called span.Select.

If they do it generates a method Select(Span, func) which returns a SelectSpan.

It then creates a new compilation which contains SelectSpan and checks if anyone's called selectSpan.Select. If so it generates SelectSelectSpan Select(selectSpan, func).

And so on etc.

This is the only way I could get chaining to work span.Select(x => x + 1).Where(x => x > 5).Skip(10).ToArray() without generating an exponential number of methods.

I wonder if there's a better way to do this?

CyrusNajmabadi
@CyrusNajmabadi
err... can you just analzye the original compilation up front, without needing to fork?
Yair Halberstadt
@YairHalberstadt
I don't think so because how can I tell that the type of span.Select(x => x + 1) in span.Select(x => x + 1).Where(x => x > 5).Skip(10).ToArray() is SelectSpan?
Seeing as SelectSpan doesn't exist yet.
CyrusNajmabadi
@CyrusNajmabadi
i mean... you would have to keep track of that :)
basically, you're 'forking' without acually forking/binding
you know you're generaitng SelectSpan for this case, so you just presume that that's the type when doing the next part.
Yair Halberstadt
@YairHalberstadt
That works well if you chain in one go, but would involve basically reimplementing the compiler once you introduce temporary variables.
CyrusNajmabadi
@CyrusNajmabadi
you could attempt to fork less
so you still take teh forking approach. however, you attempt to emit as many helper methods/types as it can in one analysis pass
(just spitballing. not saying i'm right)
forking is expensive though. so if you can prevent as much of it as possible (even through heuristics), it's a good thing
Yair Halberstadt
@YairHalberstadt

That sounds like a decent approach - don't fork when there's an obvious chain.

I'll put it on the backlog

MrSlim
@ondraslim
@YairHalberstadt Do you use the EmitCompilerGeneratedFiles? It seems to fix intellisense of generated files with no VS restart required. But then it also outputs the same code multiple times and I get errors because it is trying to output the same file twice. I wonder if there is a way to have fixed intellisense without explicitly emitting the generated code. Or if there is a way to check if the file has not been emitted during the previous generator execution.
Yair Halberstadt
@YairHalberstadt
I don't use it, no. When you pass a Name hint to Three source generator context when you add a file, what do you use? @ondraslim
Bernd Baumanns
@bernd5
recently I wanted to use Linq methods like Where or Skip (e.g. on Lists) in the VS "watch window". Unfortunately this works only if you have a using System.Linq directive in your source file - even if you don't need it
It would be nice if the watch expression evaluator could do a System.Linq fallback
Авдеев Вячеслав
@lsoft
@bernd5 agree! but there is a lot of space for improvements in watch window :) one more point: multiline watches; probably we should create the issues about these topics :)
Авдеев Вячеслав
@lsoft
I call 'SymbolFinder.FindReferencesAsync' from the 'ITagger<>.GetTags' (bad idea, I know) and it looks like there is some kind of deadlock, due to SymbolFinder.FindReferencesAsync does not return at all. and I CAN'T reproduce it in a small repro (works fine in a small repro). Any ideas how to investigate it further in the big solution? I have no more ideas))
Bernd Baumanns
@bernd5
Not to get me wrong. The "watch window" is amazing :-). But has still space for improvement
As a workaround I added just the following (because you get a hint that the using System.Linq is unused and could be removed):
using System.Linq; //!!FOR DEBUG!!!!!!!!!!!!!!
Joe4evr
@Joe4evr
#if DEBUG?
Bernd Baumanns
@bernd5
it is not even needed in debug - just occasionally for evaluations in the watch window. But that would make it more clear
Joseph Musser
@jnm2
@bernd5 Better to add pragma warning disable so 'fix all in project' doesnt remove it
Bernd Baumanns
@bernd5
but is it possible for a single using - I mean only "System.Linq" - that would be great
Joseph Musser
@jnm2
Yes, there is even a light bulb fix. It's common practice to wrap a single line with #pragma warning disable and #pragma warning enable.
In C# 10 I think you'll be able to add a global using and therefore not have to put lines in the tops of files for this.
Bernd Baumanns
@bernd5
a global using would be great
for that
sometimes it would be great to have a local using, too. But with var the need is not that big anymore.
I mean something like using Foo= Namespace.Foo.Bar.MyComplexType<X, Y, Z>...