Skip to content
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

Fixing newly created cpplite project, avoiding starting the C/C++ LSP server when the configuration is not readable. #2877

Merged
merged 1 commit into from May 23, 2021

Conversation

jlahoda
Copy link
Contributor

@jlahoda jlahoda commented Apr 11, 2021

No description provided.

… server when the configuration is not readable.
@jlahoda jlahoda added the C/C++ label Apr 11, 2021
Copy link
Contributor

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know much about the CPPLite code, but I suggest to get this into master, so that is does not bit rot. I left a few inline comments, that I think should be addressed though.

@@ -78,6 +80,7 @@ public Set instantiate() throws IOException {
Preferences prefs = CPPLiteProject.getRootPreferences(projectDirectory);
prefs.putBoolean(CPPLiteProject.KEY_IS_PROJECT, true);
settings.getBuildConfig().save(getBuildPreferences(projectDirectory));
getRootPreferences(projectDirectory).put(KEY_COMPILE_COMMANDS, settings.getEditorConfigPath());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to use the following, to be inline with the existing code in line 81:

Suggested change
getRootPreferences(projectDirectory).put(KEY_COMPILE_COMMANDS, settings.getEditorConfigPath());
prefs.put(KEY_COMPILE_COMMANDS, settings.getEditorConfigPath())

LOG.log(Level.WARNING, null, ex);
return null;
}
} else if (config.commandJsonPath != null && commandsPath.canRead()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would simplify to

Suggested change
} else if (config.commandJsonPath != null && commandsPath.canRead()) {
} else if (commandsPath != null && commandsPath.canRead()) {

import static org.netbeans.modules.cpplite.project.CPPLiteProject.getBuildPreferences;
import static org.netbeans.modules.cpplite.project.CPPLiteProject.getRootPreferences;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be dropped with the change in line 83.

matthiasblaesing added a commit that referenced this pull request May 23, 2021
Import changes from #2877 and do followup fixes
@matthiasblaesing matthiasblaesing merged commit 1fc3ac2 into apache:master May 23, 2021
@matthiasblaesing matthiasblaesing added this to the 12.5 milestone May 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants