-
Notifications
You must be signed in to change notification settings - Fork 65
Open
Description
During initialization of the language server, we already transmit the workspace folders, see
| initParams.setWorkspaceFolders(getRelevantWorkspaceFolders()); |
When we are done with the initialization, we immediately schedule a job to send a WorkspaceFoldersChangeEvent with same projects again, see:
lsp4e/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageServerWrapper.java
Lines 727 to 746 in bbf499f
| private void watchProjects() { | |
| if (!supportsWorkspaceFolderCapability()) { | |
| return; | |
| } | |
| final LanguageServer currentLS = context.languageServer; | |
| new WorkspaceJob("Setting watch projects on server " + serverDefinition.label) { //$NON-NLS-1$ | |
| @Override | |
| public IStatus runInWorkspace(@Nullable IProgressMonitor monitor) throws CoreException { | |
| final var wsFolderEvent = new WorkspaceFoldersChangeEvent(); | |
| wsFolderEvent.getAdded().addAll(getRelevantWorkspaceFolders()); | |
| if (currentLS != null && currentLS == context.languageServer) { | |
| currentLS.getWorkspaceService() | |
| .didChangeWorkspaceFolders(new DidChangeWorkspaceFoldersParams(wsFolderEvent)); | |
| } | |
| ResourcesPlugin.getWorkspace().addResourceChangeListener(workspaceFolderUpdater, | |
| IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.PRE_DELETE | IResourceChangeEvent.PRE_CLOSE); | |
| return Status.OK_STATUS; | |
| } | |
| }.schedule(); | |
| } |
Depending on how the language server handles a WorkspaceFoldersChangeEvent, this might degrade the initial responsiveness of the LS quite a bit.
For example, basedpyright has to remove all workspace folders only to add them all back again.
Metadata
Metadata
Assignees
Labels
No labels