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 support for directive attribute descriptions #625

Merged
merged 1 commit into from
May 28, 2019

Conversation

NTaylorMullen
Copy link
Contributor

  • Updated the RazorCompletionItem type to no longer contain a Documentation/Description property because in completion scenarios descriptions are never readily available and don't make a lot of sense being on the completion item itself. This is also how Roslyn does completions.
  • We now utilize an item bag on RazorCompletionItems to hold description data. Currently there's just two type of completion descriptions (directive and attribute). Based off of the completion item kind (directive or attribute) we can extract the appropriate description. The goal of this new description type was to represent all data for a completion in an unstructured way so each platform can display it using its own capabilities.
  • Added a description factory to convert description items into classified containers. Tried to replicate WTE's description look as much as possible.
  • Left out documentation parsing. Will do this at a later date; however directive attributes rarely have documentation specific pieces that require parsing so we handle the 90% case.
  • Updated existing tests to reflect the new documentation mechanisms for RazorCompletionItems.
  • Added new tests to validate the completion source and the description factory.

image

Note: This accomplishes bullet point six of dotnet/aspnetcore#6364 (comment)

dotnet/aspnetcore#6364

- Updated the `RazorCompletionItem` type to no longer contain a `Documentation`/`Description` property because in completion scenarios descriptions are never readily available and don't make a lot of sense being on the completion item itself. This is also how Roslyn does completions.
- We now utilize an item bag on `RazorCompletionItem`s to hold description data. Currently there's just two type of completion descriptions (directive and attribute). Based off of the completion item kind (directive or attribute) we can extract the appropriate description. The goal of this new description type was to represent all data for a completion in an unstructured way so each platform can display it using its own capabilities.
- Added a description factory to convert description items into classified containers. Tried to replicate WTE's description look as much as possible.
- Left out documentation parsing. Will do this at a later date; however directive attributes rarely have documentation specific pieces that require parsing so we handle the 90% case.
- Updated existing tests to reflect the new documentation mechanisms for RazorCompletionItems.
- Added new tests to validate the completion source and the description factory.

dotnet/aspnetcore#6364
@NTaylorMullen
Copy link
Contributor Author

Merging this into the parameter completion PR, will address feedback on the base completion pr (the one for names) to avoid mass re-builds / delays. We're looking to get a VS insertion out today.

@NTaylorMullen NTaylorMullen merged commit 6c73031 into nimullen/completion.5 May 28, 2019
@ghost ghost deleted the nimullen/completion.6 branch May 28, 2019 22:37
Copy link
Contributor

@ajaybhargavb ajaybhargavb left a comment

Choose a reason for hiding this comment

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

LGTM

// Microsoft.AspnetCore.Components.
tagHelperTypeNamePrefix = tagHelperTypeName.Substring(0, afterLastDot);

// And the type name looks like BindBinds
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo

{
if (_items == null)
{
lock (this)
Copy link
Contributor

Choose a reason for hiding this comment

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

Use explicit lock object?

}

[Fact]
public void GetAttributeParameterCompletions_ReturnsCompletion()
{
// Arrange
var expectedCompletion = new RazorCompletionItem("format", "format", string.Empty, RazorCompletionItemKind.DirectiveAttributeParameter);


// Act
Copy link
Contributor

Choose a reason for hiding this comment

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

// Arrange & Act

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants