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

Send back icons for FAR via LSP #47882

Merged
20 commits merged into from
Oct 7, 2020

Conversation

davidwengier
Copy link
Contributor

@davidwengier davidwengier commented Sep 21, 2020

Fixes AB#1178452

Commit-by-commit makes sense here, as most of the work was in responding to nullability changes in Microsoft.VisualStudio.LangaugeServer.Protocol.
Thanks Sam for the first commit :D

@davidwengier davidwengier changed the base branch from master to release/dev16.8 September 22, 2020 04:34
@davidwengier
Copy link
Contributor Author

Retargeting this to 16.8, FYI @jinujoseph

@davidwengier
Copy link
Contributor Author

@dibarbet should this be targeting a different branch? I noticed you mentioned Cyrus' PR should be retargeted, and that one and this one will now have conflicts, but they won't show up until a later merge.

@dibarbet
Copy link
Member

dibarbet commented Sep 24, 2020

@davidwengier I think it should target release/dev16.8-vs-deps since we're moving the editor packages to 16.8.

Once 16.8 ships we'll merge the 16.8-vs-deps branch back into non-vs-deps

@davidwengier davidwengier changed the base branch from release/dev16.8 to release/dev16.8-vs-deps September 24, 2020 07:41
@davidwengier davidwengier changed the base branch from release/dev16.8-vs-deps to master-vs-deps September 25, 2020 06:57
@@ -423,7 +423,7 @@ static DiagnosticData CreateMockDiagnosticDataWithMappedLocation(Document docume
var diagnostic = Diagnostic.Create(descriptor, location);
return new DiagnosticData(diagnostic.Id,
diagnostic.Descriptor.Category,
null,
message: "",
Copy link
Member

Choose a reason for hiding this comment

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

See earlier question: are we sure we don't have to deal with diagnostics with no message?

@@ -78,7 +81,7 @@ void M2()
Assert.Equal("M", results[1].ContainingMember);
Assert.Equal("M2", results[3].ContainingMember);

AssertValidDefinitionProperties(results, 0);
AssertValidDefinitionProperties(results, 0, Glyph.FieldPublic);
Copy link
Member

Choose a reason for hiding this comment

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

Do we want some test for something other than FieldPublic?

{
DisplayText = text,
TextDocument = requestParameters.TextDocument,
Position = requestParameters.Position
},
}),
Icon = tags != null ? new ImageElement(tags.ToImmutableArray().GetFirstGlyph().GetImageId()) : null,
Copy link
Member

Choose a reason for hiding this comment

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

Not using tags.ToImmutableArray().GetFirstGlyph().GetImageElement()? You added the extension method... 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤦‍♂️
I think I need to start this PR again.. its been rebased so many times to different branches I don't even know what is real any more

@@ -51,6 +51,11 @@ internal class CompletionHandler : IRequestHandler<LSP.CompletionParams, LSP.Com
return null;
}

if (request.Context?.TriggerCharacter == null)
{
return null;
Copy link
Contributor

@NTaylorMullen NTaylorMullen Oct 5, 2020

Choose a reason for hiding this comment

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

TriggerCharacter being null in a proper functioning LSP client results in completions when typing out an identifier. I don't think returning null here is correct.
image

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, to be clear, Razor translates the LSP platform's requests into spec abiding LSP requests which ends up hitting this call path. If you checked this in it'd stop returning C# identifier completions in Razor scenarios 😢

Copy link
Member

Choose a reason for hiding this comment

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

I think for now we can just match the spec and say invoked if we get null. If we actually get null, this will result in completions coming up unexpectedly (as invoked is generally more aggressive). But VS is currently passing the trigger char 'incorrectly' so we'll only hit this in Razor right now.

Then we can followup with a longterm fix from https://github.com/microsoft/ms-lsp/issues/57#issuecomment-703863301 (probably some kind of new property)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated the PR to what I believe is spec-compliant behaviour, specifically in 0f09454 (#47882). PTAL.

@@ -41,6 +41,12 @@ public async Task<LSP.VSReferenceItem[]> HandleRequestAsync(ReferenceParams refe
return Array.Empty<LSP.VSReferenceItem>();
}

// We only support streaming results back, so no point doing any work if the client doesn't
if (referenceParams.PartialResultToken == null)
Copy link
Member

Choose a reason for hiding this comment

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

Once pull diagnostics goes in we should switch this to use the progress implementation there.
Filed #48350

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I already logged #48150 (and #48151) for this :P
I started working on, but need to make changes to the BufferedProgress to make it thread safe, so yes, was waiting for pull diagnostics to be in first.

Copy link
Member

Choose a reason for hiding this comment

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

Woops, closed mine as dupe!

AssertValidDefinitionProperties(results, 0, Glyph.FieldPublic);
}

[WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/43063")]
Copy link
Member

Choose a reason for hiding this comment

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

does this need to be skipped still?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't see the build results in the linked issue to see why they failed, but with the handler only supporting streaming I can't see how they ever passed, so was planning on unskipping when adding non-streaming support.

Assert.Equal(definitionId, referenceItems[i].DefinitionId);
Assert.NotEqual(definitionId, referenceItems[i].Id);
}
}

private sealed class ProgressCollector<T> : IProgress<object>
Copy link
Member

Choose a reason for hiding this comment

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

Making a note here to switch this as well in #48350

@ghost
Copy link

ghost commented Oct 7, 2020

Hello @davidwengier!

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

@ghost ghost merged commit bf030da into dotnet:master-vs-deps Oct 7, 2020
@ghost ghost added this to the Next milestone Oct 7, 2020
@Cosifne Cosifne modified the milestones: Next, 16.9.P1 Oct 12, 2020
@davidwengier davidwengier deleted the LSPFindAllReferencesIcons branch January 11, 2021 05:41
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.

8 participants