Skip to content

Remove C#/VB dependency on inline hints.#48479

Merged
8 commits merged intodotnet:masterfrom
CyrusNajmabadi:abstractInlineHints
Oct 12, 2020
Merged

Remove C#/VB dependency on inline hints.#48479
8 commits merged intodotnet:masterfrom
CyrusNajmabadi:abstractInlineHints

Conversation

@CyrusNajmabadi
Copy link
Contributor

This is necessary if F# or TS want to add thse sorts of hints to their experience in VS. Note: This is a followup to my previous PRs. It shoudl not be reviewed until that goes in.

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner October 9, 2020 18:43
@CyrusNajmabadi CyrusNajmabadi requested a review from a team October 9, 2020 18:43
@CyrusNajmabadi
Copy link
Contributor Author

Tagging @cartermp @DanielRosenwasser THis allows experiences like holding down ctrl-alt to see tags like this:

image

Hints can be shown in-situ with text (like v2: ) or can replace text entirely (like List<int>). Can be good for allowing people to quickly see this information in a lightweight fashion. Once you release ctrl-alt, they go away.

You can also just have permanently showing hints. Though we advise that users be able to opt-into/out of that in case they don't like it.

@cartermp
Copy link
Contributor

cartermp commented Oct 9, 2020

Tagging myself here to add this API to the F# shim. This is neat!

@cartermp
Copy link
Contributor

cartermp commented Oct 9, 2020

FWIW this is a pretty damn useful feature for F#, we may want to experiment with having it on by default

@DanielRosenwasser
Copy link
Contributor

FWIW this is a pretty damn useful feature for F#, we may want to experiment with having it on by default

TypeScript/JavaScript would have to be careful - semantic highlighting done naively tended to have issues since we only have one fully semantic thread. The key combo is probably more desirable.

(CC @mjbvz @RyanCavanaugh @minestarks @uniqueiniquity)

@CyrusNajmabadi
Copy link
Contributor Author

semantic highlighting done naively tended to have issues since we only have one fully semantic thread

:'(

I recommend having interruptible semantic operations that you can yield back on but then resume later.

@CyrusNajmabadi
Copy link
Contributor Author

CyrusNajmabadi commented Oct 9, 2020

Sorry, our entire compiler/LS is blue.

THe compiler can stay blue. It would require making the LS async/reenterable. However, i do not see that being that difficult to do. Source: i wrote the original LS :)

@minestarks
Copy link

Is there a corresponding LSP spec for this?

@CyrusNajmabadi
Copy link
Contributor Author

Is there a corresponding LSP spec for this?

Not yet. Primarily because i don't want to preemptively write sucha spec, and then have to change it as we learn about new requirements. For example, when i started, the feature was just about inserting some text at a particular location in the document. But it has already morphed three times:

  1. it can now replace a span of text. We use this to replace var with the actual type while the user is holding Ctrl-Alt.
  2. it can produce classified text (as you can see in teh picture)
  3. you can hover over the tag to get rich documentation. i.e.:

image

This is why i'd liek to see how F#/TS/JS want to use this. If you run into changes you'd like we can design through all of that. once we feel like we're in a good place, we coudl then bring this to be an LSP addition :)

Copy link
Contributor

@cartermp cartermp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually if it's not too big a deal @CyrusNajmabadi - if you wanted to just create F# shims for the relevant types and interfaces then that would be great. I imagine this would be the best subfolder: https://github.com/dotnet/roslyn/tree/master/src/Tools/ExternalAccess/FSharp/Editor

@CyrusNajmabadi
Copy link
Contributor Author

Actually if it's not too big a deal @CyrusNajmabadi - if you wanted to just create F# shims for the relevant types and interfaces then that would be great.

Will do once this PR goes in.

var taggedText = await _hint.GetDescriptionAsync(document, cancellationToken).ConfigureAwait(false);
if (!taggedText.IsDefaultOrEmpty)
{
var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all this logic moved in the C#/VB impl of GetDescriptionAsync

@ghost
Copy link

ghost commented Oct 12, 2020

Hello @CyrusNajmabadi!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approval

@davidwengier
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@ghost ghost merged commit 63dbafb into dotnet:master Oct 12, 2020
@ghost ghost added this to the Next milestone Oct 12, 2020
@Cosifne Cosifne modified the milestones: Next, 16.9.P1 Oct 12, 2020
@CyrusNajmabadi CyrusNajmabadi deleted the abstractInlineHints branch October 13, 2020 16:48
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants