Skip to content

Commit 0e3e89b

Browse files
committed
Rebase
1 parent 5c30041 commit 0e3e89b

File tree

2 files changed

+7
-239
lines changed

2 files changed

+7
-239
lines changed

bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/clangd/ClangdConfigurationFileManager.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.eclipse.cdt.core.settings.model.CProjectDescriptionEvent;
2727
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
2828
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
29+
import org.eclipse.cdt.lsp.clangd.internal.config.MacroResolver;
2930
import org.eclipse.cdt.lsp.plugin.LspPlugin;
3031
import org.eclipse.core.resources.IFile;
3132
import org.eclipse.core.resources.IProject;
@@ -60,8 +61,8 @@ public class ClangdConfigurationFileManager implements ClangdCProjectDescription
6061
private ICBuildConfigurationManager build;
6162

6263
@Override
63-
public void handleEvent(CProjectDescriptionEvent event, MacroResolver macroResolver) {
64-
setCompilationDatabasePath(event.getProject(), event.getNewCProjectDescription(), macroResolver);
64+
public void handleEvent(CProjectDescriptionEvent event) {
65+
setCompilationDatabasePath(event.getProject(), event.getNewCProjectDescription());
6566
}
6667

6768
/**
@@ -76,13 +77,11 @@ public void handleEvent(CProjectDescriptionEvent event, MacroResolver macroResol
7677
*
7778
* @param project C/C++ project
7879
* @param newCProjectDescription new CProject description
79-
* @param macroResolver helper to resolve macros in the CWD path of the builder
8080
*/
81-
protected void setCompilationDatabasePath(IProject project, ICProjectDescription newCProjectDescription,
82-
MacroResolver macroResolver) {
81+
protected void setCompilationDatabasePath(IProject project, ICProjectDescription newCProjectDescription) {
8382
if (project != null && newCProjectDescription != null) {
8483
if (enableSetCompilationDatabasePath(project)) {
85-
var relativeDatabasePath = getRelativeDatabasePath(project, newCProjectDescription, macroResolver);
84+
var relativeDatabasePath = getRelativeDatabasePath(project, newCProjectDescription);
8685
if (!relativeDatabasePath.isEmpty()) {
8786
setCompilationDatabase(project, relativeDatabasePath);
8887
} else {
@@ -107,18 +106,16 @@ protected boolean enableSetCompilationDatabasePath(IProject project) {
107106
* By de
108107
* @param project
109108
* @param newCProjectDescription
110-
* @param macroResolver
111109
* @return project relative path to active build folder or empty String
112110
*/
113-
private String getRelativeDatabasePath(IProject project, ICProjectDescription newCProjectDescription,
114-
MacroResolver macroResolver) {
111+
private String getRelativeDatabasePath(IProject project, ICProjectDescription newCProjectDescription) {
115112
if (project != null && newCProjectDescription != null) {
116113
ICConfigurationDescription config = newCProjectDescription.getDefaultSettingConfiguration();
117114
var cwdBuilder = config.getBuildSetting().getBuilderCWD();
118115
var projectLocation = project.getLocation().addTrailingSeparator().toOSString();
119116
if (cwdBuilder != null) {
120117
try {
121-
var cwdString = macroResolver.resolveValue(cwdBuilder.toOSString(), EMPTY, null, config);
118+
var cwdString = new MacroResolver().resolveValue(cwdBuilder.toOSString(), EMPTY, null, config);
122119
return cwdString.replace(projectLocation, EMPTY);
123120
} catch (CdtVariableException e) {
124121
Platform.getLog(getClass()).log(e.getStatus());

bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/clangd/internal/config/ClangdConfigurationFileManager.java

Lines changed: 0 additions & 229 deletions
This file was deleted.

0 commit comments

Comments
 (0)