-
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
Move to instantiating and setting up the language service on a bg thread #73351
Conversation
this.EditorOptionsService = this.Package.ComponentModel.GetService<EditorOptionsService>(); | ||
this.Workspace = this.Package.ComponentModel.GetService<VisualStudioWorkspaceImpl>(); | ||
this.EditorAdaptersFactoryService = this.Package.ComponentModel.GetService<IVsEditorAdaptersFactoryService>(); | ||
this.AnalyzerFileWatcherService = this.Package.ComponentModel.GetService<AnalyzerFileWatcherService>(); |
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.
inlined GetServices
|
||
// TODO: Is the below access to component model required or can be removed? | ||
_ = this.Package.ComponentModel; | ||
this.LanguageDebugInfo = CreateLanguageDebugInfo(); |
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.
moved this to here so it can happen on the BG, instead of on the UI thread when the debugger calls into us.
{ | ||
var formatter = this.Workspace.Services.GetLanguageServices(RoslynLanguageName).GetService<ISyntaxFormattingService>(); | ||
formatter?.GetDefaultFormattingRules(); | ||
}, cancellationToken).Forget(); |
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.
moved to normal Task.Run here. Could switch back to VsTaskLibraryHelper. Need to understand the value of that type.
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.
Fire and forget operations need to be tracked
|
||
_isSetUp = true; | ||
} | ||
|
||
private object CreateComAggregate() | ||
=> Interop.ComAggregate.CreateAggregatedObject(this); |
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.
inlined this.
@@ -273,9 +232,6 @@ private VsLanguageDebugInfo CreateLanguageDebugInfo() | |||
this.Package.ComponentModel.GetService<IUIThreadOperationExecutor>()); | |||
} | |||
|
|||
private void UninitializeLanguageDebugInfo() |
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.
this uninitialize stuff doesn't appear to serve any purpose. nulling out simple managed types doesnt' buy us anything.
{ | ||
this.EditorAdaptersFactoryService = null; | ||
this.Workspace = null; | ||
} |
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.
this doesn't seem to serve any purpose. nulling out these simple managed types serves no purpose.
this.EditorOptionsService = this.Package.ComponentModel.GetService<EditorOptionsService>(); | ||
this.Workspace = this.Package.ComponentModel.GetService<VisualStudioWorkspaceImpl>(); | ||
this.EditorAdaptersFactoryService = this.Package.ComponentModel.GetService<IVsEditorAdaptersFactoryService>(); | ||
this.AnalyzerFileWatcherService = this.Package.ComponentModel.GetService<AnalyzerFileWatcherService>(); |
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.
inlined into constructor.
@@ -117,9 +128,6 @@ internal void TearDown() | |||
|
|||
_isSetUp = false; | |||
GC.SuppressFinalize(this); | |||
|
|||
this.Uninitialize(); | |||
this.RemoveServices(); |
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.
no need for these. all they did was null out managed objects. something unnecessary with managed types and disposal.
internal VisualStudioWorkspaceImpl Workspace { get; private set; } | ||
internal IVsEditorAdaptersFactoryService EditorAdaptersFactoryService { get; private set; } | ||
internal AnalyzerFileWatcherService AnalyzerFileWatcherService { get; private set; } | ||
internal readonly EditorOptionsService EditorOptionsService; |
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.
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.
yes. will do in followup.
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.
@jasonmalinowski For review when you get back. |
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1812707