dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.05k stars 4.04k forks source link

IntraTextAdornments conflict with intellicode line completion proposals #55631

Closed AdmiralSnyder closed 3 years ago

AdmiralSnyder commented 3 years ago

Version Used: VS 2022 Preview 3 Steps to Reproduce:

  1. Install my extension https://marketplace.visualstudio.com/items?itemName=AlexanderGayko.ShowInlineErrors
  2. create a line with an error so the error is being displayed inline
  3. complete the line with something intellicode creates a line completion proposal for

Expected Behavior: the intellicode line completion proposal gets added to the actual line's boundaries so that adornment placing logic can cooperate properly

Actual Behavior: the two adornments overlap, see this screenshot image

hey, @akhera99, I tag you because cyrus told me to :-)

(my extension is versioned in azure devops, so ... i don't really know how to properly link there from here. maybe i should move it over to github...) what i do to find the proper left coordinate for each adornment right now is: a) use the TextViewLines' GetTextMarkerGeometry()'s Bounds.Width + 20 to get the end of the individual line b) use a TagAggregator to find other tags (of mine, for now) that i need to offset by

thanks

akhera99 commented 3 years ago

Hey @AdmiralSnyder! So I was working with the platform team to try and overcome this issue as well. We decided on adding a tag called IEndOfLineAdornmentTag that each adornment creation tag will inherit from (intellicode, find and replace, inline diagnostics). I am then going to give precedence to intellicode and find and replace tags, so if the tags changed event gets raised, remove any of my inline diagnostics tag that would occur on the same line. We decided upon doing it this way because errors have squiggly lines as well as the error list, while intellicode/FR only appear once.

You can take a look at this PR to see what I am doing: https://github.com/dotnet/roslyn/pull/55095/files

AdmiralSnyder commented 3 years ago

hi, thanks for the line. i had a look and a followup question: Is that IEndOfLineAdornmentTag already in VS2022 preview 3? i didn't find code in the roslyn repo containing it. and: which inline diagnostics are you referring to? thank, Alex

akhera99 commented 3 years ago

hi, thanks for the line. i had a look and a followup question: Is that IEndOfLineAdornmentTag already in VS2022 preview 3? i didn't find code in the roslyn repo containing it. and: which inline diagnostics are you referring to? thank, Alex

It is currently not in preview 3, it should be accessible in preview 4. The inline diagnostics I was referring to are the ones in that PR I linked, here is a more general PR #55551

AdmiralSnyder commented 3 years ago

hmm... so if inline diagnostics is gonna be merged in preview 4, i won't need to bother with getting my extension to VS2022 by then, right?

but the PR you mentioned said it's not gonna be in Preview 4, right? so it will come in 17.1? should i make it work for 17.0 then? i mean, it's gonna be how long between .0 and .1 ? half a year? ... probably worth the effort.

so i'm gonna wait till preview 4 is out, respect the IEndOfLineAdornmentTag to not draw over and then officially stop supporting my extension for 17.1 ff, right?

thanks,

Alex

akhera99 commented 3 years ago

hmm... so if inline diagnostics is gonna be merged in preview 4, i won't need to bother with getting my extension to VS2022 by then, right?

but the PR you mentioned said it's not gonna be in Preview 4, right? so it will come in 17.1? should i make it work for 17.0 then? i mean, it's gonna be how long between .0 and .1 ? half a year? ... probably worth the effort.

so i'm gonna wait till preview 4 is out, respect the IEndOfLineAdornmentTag to not draw over and then officially stop supporting my extension for 17.1 ff, right?

thanks,

Alex

inline diagnostics is going to be merged in 17.1, the IEndOfLineAdornmentTag should've been merged in preview 4. Work done for intellicode/find and replace should also be hopefully done before the end of preview 4. By which point you should be able to add support to your extension. I will let you know precisely when those changes are in once I hear word from the editor team.

AdmiralSnyder commented 3 years ago

hi @akhera99, Preview 4 is out now - is IEndOfLineAdornmentTag in there? binging for it doesn't provide docs, so... i don't really know how to find that information myself...

akhera99 commented 3 years ago

hi @akhera99, Preview 4 is out now - is IEndOfLineAdornmentTag in there? binging for it doesn't provide docs, so... i don't really know how to find that information myself...

Hey, it should be in preview 4, if not, then it is definitely in preview 5.