You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2021/04/30 19:50:20 UTC
[GitHub] [netbeans] matthiasblaesing commented on a change in pull request #2877: Fixing newly created cpplite project, avoiding starting the C/C++ LSP server when the configuration is not readable.
matthiasblaesing commented on a change in pull request #2877:
URL: https://github.com/apache/netbeans/pull/2877#discussion_r624151427
##########
File path: cpplite/cpplite.project/src/org/netbeans/modules/cpplite/project/ui/wizard/CPPLiteProjectWizardIterator.java
##########
@@ -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());
Review comment:
I suggest to use the following, to be inline with the existing code in line 81:
```suggestion
prefs.put(KEY_COMPILE_COMMANDS, settings.getEditorConfigPath())
```
##########
File path: cpplite/cpplite.project/src/org/netbeans/modules/cpplite/project/ui/wizard/CPPLiteProjectWizardIterator.java
##########
@@ -33,7 +33,9 @@
import org.netbeans.api.templates.TemplateRegistration;
import org.netbeans.modules.cpplite.project.BuildConfiguration;
import org.netbeans.modules.cpplite.project.CPPLiteProject;
+import static org.netbeans.modules.cpplite.project.CPPLiteProject.KEY_COMPILE_COMMANDS;
import static org.netbeans.modules.cpplite.project.CPPLiteProject.getBuildPreferences;
+import static org.netbeans.modules.cpplite.project.CPPLiteProject.getRootPreferences;
Review comment:
Can be dropped with the change in line 83.
##########
File path: cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/lsp/LanguageServerImpl.java
##########
@@ -177,16 +183,13 @@ private static File getCompileCommandsDir(CProjectConfigurationProvider configPr
LOG.log(Level.WARNING, null, ex);
return null;
}
- } else if (config.commandJsonPath != null) {
- File commandsPath = new File(config.commandJsonPath);
- if (commandsPath.canRead()) {
- try (InputStream in = new FileInputStream(commandsPath);
- OutputStream out = new FileOutputStream(tempFile)) {
- FileUtil.copy(in, out);
- } catch (IOException ex) {
- LOG.log(Level.WARNING, null, ex);
- return null;
- }
+ } else if (config.commandJsonPath != null && commandsPath.canRead()) {
Review comment:
I would simplify to
```suggestion
} else if (commandsPath != null && commandsPath.canRead()) {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists