-
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
Make completion service public #8170
Conversation
if (_importedProviders == null) | ||
{ | ||
var language = this.GetLanguageName(); | ||
var mefExporter = (IMefHostExportProvider)_workspace.Services.HostServices; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if this type doesn't implement that interface?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It always does now. We have this dependency in a few places already.
Pretty sure @DustinCampbell and @rchande will want to look at this too. |
@@ -20,7 +20,7 @@ namespace Microsoft.CodeAnalysis.CSharp.Symbols | |||
/// <summary> | |||
/// Represents an assembly built by compiler. | |||
/// </summary> | |||
internal sealed class SourceAssemblySymbol : MetadataOrSourceAssemblySymbol, IAttributeTargetSymbol | |||
internal sealed class SourceAssemblySymbol : MetadataOrSourceAssemblySymbol, ISourceAssemblySymbol, IAttributeTargetSymbol |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this supposed to be part of your change?
@dotnet-bot test eta |
Okay @DustinCampbell @Pilchie @rchande @CyrusNajmabadi Here's the real proposed change with all the bits made public. |
@@ -0,0 +1,68 @@ | |||
[1mdiff --git a/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller_Commit.cs b/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller_Commit.cs[m |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not idea. I did not create it.
@mattwar: I looked through this and nothing seemed obviously wrong to me. I did want to build it locally and try things out. However you're missing some changes in master (as you can see from Jenkins) and I encountered a ton of merge commits trying to sync. |
retest prtest/win/vsi/p0 please |
When will the changes for this Issue make it into a NuGet release (which release is going to be associated with these changes?) |
You can get them on our 1.3 myget feed already, and they should show up on NuGet when our 1.3 release comes out (with VS 2015 Update 3). |
Yup! Here's the myget feed: http://myget.org/gallery/roslyn-master-nightly |
Thanks |
How do I get a reference to the completion service? I am getting the language services from a C# project or from a workspace containing it: but then csServices.GetService() returns null. THanks |
What sort of Workpace are you in? Is it possible that the CSharpFeatures assembly is not part of the MEF composition used to populate the workspace and language services? |
After I created my own MefHostServices with the composition container that loaded CSharpFeatures and created the Workspace based on that, I started getting the completion service, but should not there be a better way to do it? Here is my code:
Is there a better way to make sure the CompletionServices exist? |
I don't know of a better way to do it. @mattwar Should we consider adding adding these two |
@Pilchie that sort of makes sense, seeing as we are making these APIs public now. |
How can I get the type of a CompletionItem now (whether it is a property or a method or an event)? Before you had a Glyph property on the CompletionItem - but it is no longer there. Thanks |
I think i got it - it is now in Tags. Still I think an enumeration would be better. |
Let me clarify myself - from my point of view - it would be better to rename the Glyph enumeration to CompletionType, make it public and create a public CompletionType property within CompletionItem class. That way the ViewModel does not have any hints of View constracts (like Glyph) and value conversion can achieve transformation between the CompletionType and the corresponding image. |
Can you explain why CompletionTag is insufficient? Thanks! |
Hey Cyrus, |
Yes, that's a virtue :)
That's a problem. Now we need to know the set of things that will go in completion. As this is an extensible API that we would like any language to be able to plug into, that's not ok.
Yes. It may. Any code processing it will have to handle this case.
It can be used for anything else. The point is that's its a mechanism to allow people to use it how they want. We're moving away from being prescriptive here. That's because it's really hard to be both prescriptive, while still being generally usable by any language. Instead, we allow providers to be descriptive. They loosely state what they are, and consumers can loosely process what they understand. |
I do not want to spend much time arguing, but the strong typing is very important for the ease of usage and in no way restrictive (when you have a new completion type you can always modify the enumeration). |
@npolyak, modifying an enumeration is actually an API breaking change. It can break existing code that uses the enumeration. |
Using the same logic, one can drop all the strong types because modifying them is an API breaking change. |
No, that's not true at all. Adding members to enumerations can specifically break existing code, for example a switch case that tests every value and throws in the default case. That'll fail at runtime. That does not extend to, say, classes, where members can be added in a non-breaking way. |
Yes, if e.g you remove a class field and there is a code which uses that field, it can definitely break. The key is - the word 'can' - both enum and class change can break existing API but do not have to. A shift towards less type safe approach brings more problems from my point of view than benefits. Anyways I rest my case. |
Appreciate the feedback. |
I was also somewhat irked to find Wouldn't it be better for |
This change makes the completion API public.
Lots of refactoring.