Skip to content

Commit

Permalink
an extendedClientCapability to skip project configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
mickaelistria committed Mar 9, 2023
1 parent 5743294 commit 5764ca4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -932,8 +932,10 @@ public CompletableFuture<BuildWorkspaceStatus> buildProjects(ProjectBuildParams
@Override
public void didChangeWorkspaceFolders(DidChangeWorkspaceFoldersParams params) {
logInfo(">> java/didChangeWorkspaceFolders");
WorkspaceFolderChangeHandler handler = new WorkspaceFolderChangeHandler(pm, preferenceManager);
handler.update(params);
if (!preferenceManager.getClientPreferences().skipProjectConfiguration()) {
WorkspaceFolderChangeHandler handler = new WorkspaceFolderChangeHandler(pm, preferenceManager);
handler.update(params);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,22 @@ public ProjectsManager(PreferenceManager preferenceManager) {

@Override
public void initializeProjects(final Collection<IPath> rootPaths, IProgressMonitor monitor) throws CoreException, OperationCanceledException {
SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
cleanInvalidProjects(rootPaths, subMonitor.split(20));
createJavaProject(getDefaultProject(), subMonitor.split(10));
cleanupResources(getDefaultProject());
Collection<IPath> projectConfigurations = preferenceManager.getPreferences().getProjectConfigurations();
if (projectConfigurations == null) {
// old way to import project
importProjects(rootPaths, subMonitor.split(70));
} else {
importProjectsFromConfigurationFiles(rootPaths, projectConfigurations, monitor);
if (!preferenceManager.getClientPreferences().skipProjectConfiguration()) {
SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
cleanInvalidProjects(rootPaths, subMonitor.split(20));
createJavaProject(getDefaultProject(), subMonitor.split(10));
cleanupResources(getDefaultProject());
Collection<IPath> projectConfigurations = preferenceManager.getPreferences().getProjectConfigurations();
if (projectConfigurations == null) {
// old way to import project
importProjects(rootPaths, subMonitor.split(70));
} else {
importProjectsFromConfigurationFiles(rootPaths, projectConfigurations, monitor);
}
updateEncoding(monitor);
reportProjectsStatus();
subMonitor.done();
}
updateEncoding(monitor);
reportProjectsStatus();
subMonitor.done();
}

private void updateEncoding(IProgressMonitor monitor) throws CoreException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,4 +392,8 @@ public boolean isInlayHintRefreshSupported() {
&& capabilities.getWorkspace().getInlayHint().getRefreshSupport().booleanValue();
}

public boolean skipProjectConfiguration() {
return Boolean.parseBoolean(extendedClientCapabilities.getOrDefault("skipProjectConfiguration", "false").toString());
}

}

0 comments on commit 5764ca4

Please sign in to comment.