-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add public API for "BlockStructure" #27332
Comments
Note: current BlocKStructure API is currently insufficient for VS itself. VS has asked for Roslyn to include more info. So we should probably kill two birds with one stone. |
@CyrusNajmabadi : What additional info was requested? |
i think it was @AmadeusW who was asking for it (but i could be wrong) :-). Essentially, the thought from the VS side is that we're not including enough information to exactly know where to place the dotted line for a block-span. Specifically, for the cases where the start/end points of a span don't line up. I'm skeptical myself about this. My feeling is that "taking the leftmost (in view coordinates) of the start/end points" is a sufficient and appropriate algorithm here. However, before making anything public we should be confident we have the right API that both Roslyn and the Editor feels is sufficient. Thanks! :) |
I think it was @gundermanc who asked for it. He uses these APIs extensively for various refactorings, and he'll be able to explain better the scenarios that would benefit from the API. |
It was me. There are a few missing pieces in most implementations of the current API. Namely, we aren't provided with the position of the '{' in C#, the current API has no notion of structure below the block level (i.e.: what's the span of the statement at the caret), we have no knowledge of the span of the contents of the block (between the braces) and what the indent is for the block. As Amadeusz mentioned, one of the things I've been experimenting with for 15.8 and 16.0 is using the IBlockTag and IStructureTags to implement language agnostic navigational and refactoring commands. The idea behind this effort is that we can implement versions of these commands that would work well in both Roslyn and Razor scenarios without requiring individual LS's to close the gap. I'm still working on requirements for these commands but if you're planning to make changes in this area, perhaps we could work this in as a bonus productivity enhancement? |
We would do this through lsp. closing out. |
The current BlockStructure API is internal, which means we have to write ugly reflection code to consume it in OmniSharp. Please consider creating a public version so that consumers of Roslyn can use its outlining functionality. cc @DustinCampbell
In reference to: OmniSharp/omnisharp-roslyn#1209 and https://github.com/dotnet/roslyn/blob/master/src/Features/Core/Portable/Structure/BlockStructureService.cs
The text was updated successfully, but these errors were encountered: