diff --git a/pom.xml b/pom.xml
index 20af5a2..ab8b8e0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -812,8 +812,8 @@
target/keystore
RELEASE190
- 1.4
- 1.3
+ 1.5
+ 1.4
https://github.com/albilu/netbeansPython
https://github.com/albilu/netbeansPython.git
UTF-8
diff --git a/ppuc/13/updates.xml b/ppuc/13/updates.xml
index d054800..3712cbe 100644
--- a/ppuc/13/updates.xml
+++ b/ppuc/13/updates.xml
@@ -1,6 +1,6 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/ppuc/14/updates.xml b/ppuc/14/updates.xml
index 544c6c7..25e9805 100644
--- a/ppuc/14/updates.xml
+++ b/ppuc/14/updates.xml
@@ -1,6 +1,6 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/ppuc/15/updates.xml b/ppuc/15/updates.xml
index d60f5a3..4bccda4 100644
--- a/ppuc/15/updates.xml
+++ b/ppuc/15/updates.xml
@@ -1,6 +1,6 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/ppuc/16/updates.xml b/ppuc/16/updates.xml
index ac87baf..93c98e6 100644
--- a/ppuc/16/updates.xml
+++ b/ppuc/16/updates.xml
@@ -1,6 +1,6 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/ppuc/17/updates.xml b/ppuc/17/updates.xml
index 346f284..06289af 100644
--- a/ppuc/17/updates.xml
+++ b/ppuc/17/updates.xml
@@ -1,6 +1,6 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/ppuc/18/updates.xml b/ppuc/18/updates.xml
index 375e4bd..6a6db82 100644
--- a/ppuc/18/updates.xml
+++ b/ppuc/18/updates.xml
@@ -1,6 +1,6 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/ppuc/19/updates.xml b/ppuc/19/updates.xml
index 5c5b3dd..8735f9a 100644
--- a/ppuc/19/updates.xml
+++ b/ppuc/19/updates.xml
@@ -1,6 +1,6 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/src/main/java/org/netbeans/modules/python/PythonUtility.java b/src/main/java/org/netbeans/modules/python/PythonUtility.java
index e5aa249..d5f4467 100644
--- a/src/main/java/org/netbeans/modules/python/PythonUtility.java
+++ b/src/main/java/org/netbeans/modules/python/PythonUtility.java
@@ -16,6 +16,7 @@
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ExecutionException;
+import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.prefs.Preferences;
import java.util.regex.Matcher;
@@ -148,7 +149,13 @@ public static String getTermFontFam() {
}
public static String getServerVersion() throws IOException {
- return getCommandOutput(new String[]{getLspPythonExe(), "-m", "pylsp", "--version"}, null);
+ String commandOutput = getCommandOutput(new String[]{getLspPythonExe(), "-m", "pylsp", "--version"}, null);
+ if (!commandOutput.startsWith("__main__.py")) {
+ LOG.log(Level.SEVERE, commandOutput);
+ return "UNKNOW";
+ }
+ return commandOutput;
+
}
public static String getCommandOutput(String[] cmd, FileObject projectDir) throws IOException {
@@ -291,7 +298,12 @@ public static Properties getProperties(@NonNull Project project, boolean isCreat
}
public static String getVersion(String projectPythonExe) throws IOException {
- return getCommandOutput(new String[]{projectPythonExe, "--version"}, null);
+ String commandOutput = getCommandOutput(new String[]{projectPythonExe, "--version"}, null);
+ if (!commandOutput.startsWith("Py")) {
+ LOG.log(Level.SEVERE, commandOutput);
+ return "";
+ }
+ return commandOutput;
}
public static ImageIcon getErrorIcon() {
diff --git a/src/main/java/org/netbeans/modules/python/options/PythonLspServerConfigsPanel.form b/src/main/java/org/netbeans/modules/python/options/PythonLspServerConfigsPanel.form
index b23a09f..9a18543 100644
--- a/src/main/java/org/netbeans/modules/python/options/PythonLspServerConfigsPanel.form
+++ b/src/main/java/org/netbeans/modules/python/options/PythonLspServerConfigsPanel.form
@@ -135,6 +135,9 @@
+
+
+
@@ -213,6 +216,9 @@
+
+
+
diff --git a/src/main/java/org/netbeans/modules/python/options/PythonLspServerConfigsPanel.java b/src/main/java/org/netbeans/modules/python/options/PythonLspServerConfigsPanel.java
index 2f2ccb0..6cfb222 100644
--- a/src/main/java/org/netbeans/modules/python/options/PythonLspServerConfigsPanel.java
+++ b/src/main/java/org/netbeans/modules/python/options/PythonLspServerConfigsPanel.java
@@ -4,11 +4,15 @@
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.ToNumberPolicy;
+import java.awt.event.ActionEvent;
import java.io.IOException;
import java.nio.file.Files;
import java.util.HashMap;
import java.util.Map;
import javax.swing.DefaultListModel;
+import javax.swing.JMenuItem;
+import javax.swing.JPopupMenu;
+import javax.swing.SwingUtilities;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import org.eclipse.lsp4j.DidChangeConfigurationParams;
@@ -100,6 +104,11 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) {
lspServerLabel.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(lspServerLabel, org.openide.util.NbBundle.getMessage(PythonLspServerConfigsPanel.class, "PythonLspServerConfigsPanel.lspServerLabel.text")); // NOI18N
+ lspList.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ lspListMouseClicked(evt);
+ }
+ });
lspScrollPane.setViewportView(lspList);
lspPythonVersionLabel.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N
@@ -180,6 +189,26 @@ private void lspServerCheckBoxStateChanged(javax.swing.event.ChangeEvent evt) {/
controller.changed();
}//GEN-LAST:event_lspServerCheckBoxStateChanged
+ private void lspListMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lspListMouseClicked
+ if (SwingUtilities.isRightMouseButton(evt)) {
+ Pair selected = (Pair) lspList.getSelectedValue();
+ if (!selected.second()) {
+ JPopupMenu menu = new JPopupMenu();
+ JMenuItem pm = new JMenuItem("Install");
+ pm.addActionListener((ActionEvent e) -> {
+ String[] cmd = {
+ PythonUtility.getLspPythonExe(), "-m", "pip", "install",
+ "--upgrade", selected.first()
+ };
+ PythonUtility.processExecutor(cmd, String.format("%s %s", "Installing", selected.first()));
+ });
+ menu.add(pm);
+ menu.show(evt.getComponent(), evt.getX(), evt.getY());
+ }
+
+ }
+ }//GEN-LAST:event_lspListMouseClicked
+
void load() {
try {
lspServerCheckBox.setSelected(NbPreferences.root().getBoolean("autoUpdate", false));
diff --git a/src/main/java/org/netbeans/modules/python/options/PythonPlatformManager.java b/src/main/java/org/netbeans/modules/python/options/PythonPlatformManager.java
index c7b3c75..909de37 100644
--- a/src/main/java/org/netbeans/modules/python/options/PythonPlatformManager.java
+++ b/src/main/java/org/netbeans/modules/python/options/PythonPlatformManager.java
@@ -35,7 +35,8 @@ public static List> getPythonExes() {
JSONArray platformJsonArray = new JSONArray(Files.readString(getPlatformFile().toPath()));
for (int i = 0; i < platformJsonArray.length(); i++) {
JSONObject jsonObject = platformJsonArray.getJSONObject(i);
- exes.add(Quartet.with(jsonObject.getString("name"), jsonObject.getString("cmd"), jsonObject.getString("version"),
+ exes.add(Quartet.with(jsonObject.has("name")
+ ? jsonObject.getString("name") : jsonObject.getString("version"), jsonObject.getString("cmd"), jsonObject.getString("version"),
jsonObject.getBoolean("state")));
}
@@ -67,6 +68,7 @@ public static void refresh() {
List> pythonExes = PythonUtility.getPythonExes();
JSONArray platformJsonArray = new JSONArray(Files.readString(getPlatformFile().toPath()));
for (Pair pythonExe : pythonExes) {
+ //FIXME fore platformJsonArray.cmd not equals second
if (!platformJsonArray.toString().contains(StringEscapeUtils.escapeJava(pythonExe.second()))) {
Map hashMap = new HashMap<>();
hashMap.put("cmd", pythonExe.second());
diff --git a/src/main/java/org/netbeans/modules/python/projectproperties/PythonGeneralPanel.java b/src/main/java/org/netbeans/modules/python/projectproperties/PythonGeneralPanel.java
index 0cf8584..a38e757 100644
--- a/src/main/java/org/netbeans/modules/python/projectproperties/PythonGeneralPanel.java
+++ b/src/main/java/org/netbeans/modules/python/projectproperties/PythonGeneralPanel.java
@@ -188,7 +188,7 @@ private void loadProperties() {
.getVersion(python_path.toString()), python_path.toString()));
}
for (Pair pair : pyPlat) {
- //FIX #57 Need work here
+ //FIXME #57 Need work here
pythonComboBox.addItem(pair);
}
for (Quartet pythonExe : PythonPlatformManager.getPythonExes()) {