Skip to content
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

Closed
rchande opened this issue Jun 1, 2018 · 6 comments
Closed

Add public API for "BlockStructure" #27332

rchande opened this issue Jun 1, 2018 · 6 comments
Assignees
Labels
Area-IDE Concept-API This issue involves adding, removing, clarification, or modification of an API.
Milestone

Comments

@rchande
Copy link
Contributor

rchande commented Jun 1, 2018

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

@DustinCampbell DustinCampbell added Area-IDE Concept-API This issue involves adding, removing, clarification, or modification of an API. labels Jun 1, 2018
@DustinCampbell DustinCampbell self-assigned this Jun 1, 2018
@CyrusNajmabadi
Copy link
Member

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.

@DustinCampbell
Copy link
Member

@CyrusNajmabadi : What additional info was requested?

@jinujoseph jinujoseph added this to the Unknown milestone Jun 6, 2018
@CyrusNajmabadi
Copy link
Member

CyrusNajmabadi commented Jun 6, 2018

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! :)

@AmadeusW
Copy link
Contributor

AmadeusW commented Jun 8, 2018

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.

@gundermanc
Copy link
Member

gundermanc commented Jun 8, 2018

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?

@CyrusNajmabadi
Copy link
Member

We would do this through lsp. closing out.

@CyrusNajmabadi CyrusNajmabadi closed this as not planned Won't fix, can't repro, duplicate, stale Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Concept-API This issue involves adding, removing, clarification, or modification of an API.
Projects
None yet
Development

No branches or pull requests

6 participants