microsoft / PTVS

Python Tools for Visual Studio
https://aka.ms/PTVS
Apache License 2.0
2.52k stars 673 forks source link

Live share doesn't show LSP features #6877

Open AdamYoblick opened 2 years ago

AdamYoblick commented 2 years ago

From email:

I am from Live Share team and currently looking at a python LSP bug in Live Share guest where none of the LSP features (other than syntax highlighting) are working for python project in 16.11. On debugging the Live Share code, I am seeing that PythonLanguageClient.InitializeAsync() calls LanguageServerHostService.CreateCustomLanguageServerProviderAsync() with metadata having IsLanguageClientProvider=false. Is this expected? If that is the case then how does Python language server supports LSP request within Live Share as guest does not activate the Python language server.

Callstack:

> Microsoft.VisualStudio.LanguageServices.LanguageExtension.VSCore.dll!Microsoft.VisualStudio.LanguageServices.LanguageExtension.LanguageServerHostService.CreateCustomLanguageServerProviderAsync(string serviceName, Microsoft.VisualStudio.LiveShare.LanguageServices.LanguageServerProviderMetadata metadata, Microsoft.VisualStudio.LiveShare.LanguageServices.ILanguageServiceProviderCallback languageServiceProviderCallback, Microsoft.VisualStudio.LiveShare.LanguageServices.ICustomRequestMessageHandler customRequestMessageHandler) Line 270            
  Microsoft.PythonTools.LiveShare.dll!Microsoft.PythonTools.LiveShare.PythonLanguageClient.InitializeAsync(Microsoft.VisualStudio.LiveShare.LanguageServices.ILanguageServerHostService languageServerHostService)       
  Microsoft.PythonTools.LiveShare.dll!Microsoft.PythonTools.LiveShare.PythonLanguageClientFactory.CreateServiceAsync(Microsoft.VisualStudio.LiveShare.CollaborationSession session, System.Threading.CancellationToken cancellationToken)              
  Microsoft.VisualStudio.LiveShare.Client.dll!Microsoft.Cascade.Client.Extensibility.CollaborationServiceUtils.CreateServicesAsync.__CreateServiceAsync|0() Line 130                
  Microsoft.VisualStudio.LiveShare.Client.dll!Microsoft.Cascade.Client.Extensibility.CollaborationServiceUtils.CreateServicesAsync<Microsoft.Cascade.Client.Extensibility.LiveShareCollaborationSession>(System.Collections.Generic.IEnumerable<System.Lazy<Microsoft.VisualStudio.LiveShare.ICollaborationServiceFactory, Microsoft.VisualStudio.LiveShare.ICollaborationServiceMetadata>> serviceFactories, System.Func<Microsoft.VisualStudio.LiveShare.ICollaborationServiceFactory, Microsoft.Cascade.Client.Extensibility.LiveShareCollaborationSession> sessionFactory, System.Action<Microsoft.VisualStudio.LiveShare.ICollaborationService, Microsoft.VisualStudio.LiveShare.ICollaborationServiceMetadata, Microsoft.Cascade.Client.Extensibility.LiveShareCollaborationSession> createServiceCallback, System.Func<string, System.Threading.Tasks.Task<bool>> faultSeverityCheck, System.Diagnostics.TraceSource trace, System.Threading.CancellationToken cancellationToken) Line 172              
  Microsoft.VisualStudio.LiveShare.Client.dll!Microsoft.Cascade.Client.Extensibility.CollaborationServiceUtils.CreateServicesAsync(System.Collections.Generic.IEnumerable<System.Lazy<Microsoft.VisualStudio.LiveShare.ICollaborationServiceFactory, Microsoft.VisualStudio.LiveShare.ICollaborationServiceMetadata>> serviceFactories, System.IServiceProvider serviceProvider, Microsoft.VisualStudio.LiveShare.SessionScope scope, System.Action<Microsoft.VisualStudio.LiveShare.ICollaborationService, Microsoft.VisualStudio.LiveShare.ICollaborationServiceMetadata, Microsoft.Cascade.Client.Extensibility.LiveShareCollaborationSession> createServiceCallback, System.Diagnostics.TraceSource trace, System.Threading.CancellationToken cancellationToken) Line 213                
  Microsoft.VisualStudio.LiveShare.Client.dll!Microsoft.Cascade.Client.Extensibility.CollaborationServiceUtils.CreateServicesAsync(System.Collections.Generic.IEnumerable<System.Lazy<Microsoft.VisualStudio.LiveShare.ICollaborationServiceFactory, Microsoft.VisualStudio.LiveShare.ICollaborationServiceMetadata>> serviceFactories, System.IServiceProvider serviceProvider, Microsoft.VisualStudio.LiveShare.SessionScope scope, System.Collections.Generic.IReadOnlyList<Microsoft.VisualStudio.LiveShare.ServiceRole> roles, System.Collections.Generic.IReadOnlyList<string> enabledFeatures, System.Version appVersion, System.Action<Microsoft.VisualStudio.LiveShare.ICollaborationService, Microsoft.VisualStudio.LiveShare.ICollaborationServiceMetadata, Microsoft.Cascade.Client.Extensibility.LiveShareCollaborationSession> createServiceCallback, System.Diagnostics.TraceSource trace, System.Threading.CancellationToken cancellationToken) Line 58  
                [Resuming Async Method]           
    mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(object stateMachine)  
                mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)           
                mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) 
                mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()             
                mscorlib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__0()                
                mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke() 
  mscorlib.dll!System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation..cctor.AnonymousMethod__8_0(object state)    
  Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTaskFactory.SingleExecuteProtector.TryExecute()                
  Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTaskFactory.SingleExecuteProtector..cctor.AnonymousMethod__20_0(object state)    
                WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)             
                WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler)         
                WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl()               
                WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(object state)                
                WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(object obj)  
                mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)           
                mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) 
                mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)              
  WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext executionContext, System.Threading.ContextCallback callback, object state)         
                WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke()       
                WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue()            
                WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled)  
                WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) 
                WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o)           
                WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)             
                WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler)         
  WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) 
                WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) 
                [Async Call Stack]             
               [Async] Microsoft.VisualStudio.LiveShare.Core.dll!Microsoft.VisualStudio.Cascade.VsSessionConfigurator.RegisterExtensionServicesAsync(Microsoft.VisualStudio.Cascade.Contracts.IVsCascadeClientSession session, Microsoft.VisualStudio.LiveShare.ServiceRole[] roles, System.Threading.CancellationToken cancellationToken) Line 322                
                [Async] Microsoft.VisualStudio.LiveShare.Core.dll!Microsoft.VisualStudio.Cascade.VsSessionConfigurator.ConfigureSessionForSharingAsync(Microsoft.VisualStudio.Cascade.Contracts.IVsCascadeClientSession session, System.Threading.CancellationToken cancellationToken) Line 115             
                [Async] Microsoft.VisualStudio.LiveShare.Core.dll!Microsoft.VisualStudio.Cascade.Commands.ShareWorkspaceCommand.ShareWorkspaceInternalAsync(Microsoft.VisualStudio.Cascade.Commands.ShareWorkspaceCommand.CommandContext context, System.IProgress<Microsoft.VisualStudio.TaskStatusCenter.TaskProgressData> progress, System.Threading.CancellationToken cancellationToken) Line 523              
                [Async] Microsoft.VisualStudio.LiveShare.Core.dll!Microsoft.VisualStudio.Cascade.Commands.ShareWorkspaceCommand.ShareWorkspaceAsync(Microsoft.Cascade.Common.LiveShareUserIdentity userAccount, bool isNonInteractive, System.IProgress<Microsoft.VisualStudio.TaskStatusCenter.TaskProgressData> progress, System.Threading.CancellationToken cancellationToken) Line 284          
                [Async] [Awaited by multiple tasks/threads]        
StellaHuang95 commented 1 year ago

Is this something we want to fix? Seems like the bug is in Dev16.

AdamYoblick commented 1 year ago

We need to see if this repros in VS2022. I know Live Share has been a constant pain point for lots of language teams.