Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
Task #101 - Auto Update LSP on Startup seems to be ignored.
  • Loading branch information
albilu committed Feb 7, 2024
1 parent a2871ee commit 764d405
Show file tree
Hide file tree
Showing 11 changed files with 97 additions and 161 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@
<properties>
<keystore>target/keystore</keystore>
<netbeans.release.version>RELEASE200</netbeans.release.version>
<next.version>1.8</next.version>
<next.version>1.9</next.version>
<git.url>https://github.com/albilu/netbeansPython</git.url>
<git.link>https://github.com/albilu/netbeansPython.git</git.link>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
10 changes: 5 additions & 5 deletions ppuc/13/updates.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE module_updates PUBLIC "-//NetBeans//DTD Autoupdate Catalog 2.8//EN" "http://www.netbeans.org/dtds/autoupdate-catalog-2_8.dtd">
<module_updates timestamp="00/00/00/09/01/2024">
<module codenamebase="io.github.albilu.python" distribution="https://github.com/albilu/netbeansPython/releases/download/1.8/python-RELEASE130-1.8.nbm" downloadsize="133405377" homepage="https://github.com/albilu/netbeansPython" moduleauthor="albilu" needsrestart="true" releasedate="2024/01/09">
<manifest OpenIDE-Module="io.github.albilu.python" AutoUpdate-Show-In-Client="true" OpenIDE-Module-Display-Category="Editing" OpenIDE-Module-Implementation-Version="RELEASE130-1.8" OpenIDE-Module-Name="Python" OpenIDE-Module-Requires="org.openide.windows.WindowManager" OpenIDE-Module-Short-Description="Netbeans Support for Python" OpenIDE-Module-Specification-Version="1.8"/>
</module>
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE module_updates PUBLIC "-//NetBeans//DTD Autoupdate Catalog 2.8//EN" "http://www.netbeans.org/dtds/autoupdate-catalog-2_8.dtd">
<module_updates timestamp="00/00/00/07/02/2024">
<module codenamebase="io.github.albilu.python" distribution="https://github.com/albilu/netbeansPython/releases/download/1.9/python-RELEASE130-1.9.nbm" downloadsize="133405377" homepage="https://github.com/albilu/netbeansPython" moduleauthor="albilu" needsrestart="true" releasedate="2024/02/07">
<manifest OpenIDE-Module="io.github.albilu.python" AutoUpdate-Show-In-Client="true" OpenIDE-Module-Display-Category="Editing" OpenIDE-Module-Implementation-Version="RELEASE130-1.9" OpenIDE-Module-Name="Python" OpenIDE-Module-Requires="org.openide.windows.WindowManager" OpenIDE-Module-Short-Description="Netbeans Support for Python" OpenIDE-Module-Specification-Version="1.9"/>
</module>
</module_updates>
10 changes: 5 additions & 5 deletions ppuc/14/updates.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE module_updates PUBLIC "-//NetBeans//DTD Autoupdate Catalog 2.8//EN" "http://www.netbeans.org/dtds/autoupdate-catalog-2_8.dtd">
<module_updates timestamp="00/00/00/09/01/2024">
<module codenamebase="io.github.albilu.python" distribution="https://github.com/albilu/netbeansPython/releases/download/1.8/python-RELEASE140-1.8.nbm" downloadsize="133405377" homepage="https://github.com/albilu/netbeansPython" moduleauthor="albilu" needsrestart="true" releasedate="2024/01/09">
<manifest OpenIDE-Module="io.github.albilu.python" AutoUpdate-Show-In-Client="true" OpenIDE-Module-Display-Category="Editing" OpenIDE-Module-Implementation-Version="RELEASE140-1.8" OpenIDE-Module-Name="Python" OpenIDE-Module-Requires="org.openide.windows.WindowManager" OpenIDE-Module-Short-Description="Netbeans Support for Python" OpenIDE-Module-Specification-Version="1.8"/>
</module>
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE module_updates PUBLIC "-//NetBeans//DTD Autoupdate Catalog 2.8//EN" "http://www.netbeans.org/dtds/autoupdate-catalog-2_8.dtd">
<module_updates timestamp="00/00/00/07/02/2024">
<module codenamebase="io.github.albilu.python" distribution="https://github.com/albilu/netbeansPython/releases/download/1.9/python-RELEASE140-1.9.nbm" downloadsize="133405377" homepage="https://github.com/albilu/netbeansPython" moduleauthor="albilu" needsrestart="true" releasedate="2024/02/07">
<manifest OpenIDE-Module="io.github.albilu.python" AutoUpdate-Show-In-Client="true" OpenIDE-Module-Display-Category="Editing" OpenIDE-Module-Implementation-Version="RELEASE140-1.9" OpenIDE-Module-Name="Python" OpenIDE-Module-Requires="org.openide.windows.WindowManager" OpenIDE-Module-Short-Description="Netbeans Support for Python" OpenIDE-Module-Specification-Version="1.9"/>
</module>
</module_updates>
10 changes: 5 additions & 5 deletions ppuc/15/updates.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE module_updates PUBLIC "-//NetBeans//DTD Autoupdate Catalog 2.8//EN" "http://www.netbeans.org/dtds/autoupdate-catalog-2_8.dtd">
<module_updates timestamp="00/00/00/09/01/2024">
<module codenamebase="io.github.albilu.python" distribution="https://github.com/albilu/netbeansPython/releases/download/1.8/python-RELEASE150-1.8.nbm" downloadsize="133405377" homepage="https://github.com/albilu/netbeansPython" moduleauthor="albilu" needsrestart="true" releasedate="2024/01/09">
<manifest OpenIDE-Module="io.github.albilu.python" AutoUpdate-Show-In-Client="true" OpenIDE-Module-Display-Category="Editing" OpenIDE-Module-Implementation-Version="RELEASE150-1.8" OpenIDE-Module-Name="Python" OpenIDE-Module-Requires="org.openide.windows.WindowManager" OpenIDE-Module-Short-Description="Netbeans Support for Python" OpenIDE-Module-Specification-Version="1.8"/>
</module>
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE module_updates PUBLIC "-//NetBeans//DTD Autoupdate Catalog 2.8//EN" "http://www.netbeans.org/dtds/autoupdate-catalog-2_8.dtd">
<module_updates timestamp="00/00/00/07/02/2024">
<module codenamebase="io.github.albilu.python" distribution="https://github.com/albilu/netbeansPython/releases/download/1.9/python-RELEASE150-1.9.nbm" downloadsize="133405377" homepage="https://github.com/albilu/netbeansPython" moduleauthor="albilu" needsrestart="true" releasedate="2024/02/07">
<manifest OpenIDE-Module="io.github.albilu.python" AutoUpdate-Show-In-Client="true" OpenIDE-Module-Display-Category="Editing" OpenIDE-Module-Implementation-Version="RELEASE150-1.9" OpenIDE-Module-Name="Python" OpenIDE-Module-Requires="org.openide.windows.WindowManager" OpenIDE-Module-Short-Description="Netbeans Support for Python" OpenIDE-Module-Specification-Version="1.9"/>
</module>
</module_updates>
10 changes: 5 additions & 5 deletions ppuc/16/updates.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE module_updates PUBLIC "-//NetBeans//DTD Autoupdate Catalog 2.8//EN" "http://www.netbeans.org/dtds/autoupdate-catalog-2_8.dtd">
<module_updates timestamp="00/00/00/09/01/2024">
<module codenamebase="io.github.albilu.python" distribution="https://github.com/albilu/netbeansPython/releases/download/1.8/python-RELEASE160-1.8.nbm" downloadsize="133405377" homepage="https://github.com/albilu/netbeansPython" moduleauthor="albilu" needsrestart="true" releasedate="2024/01/09">
<manifest OpenIDE-Module="io.github.albilu.python" AutoUpdate-Show-In-Client="true" OpenIDE-Module-Display-Category="Editing" OpenIDE-Module-Implementation-Version="RELEASE160-1.8" OpenIDE-Module-Name="Python" OpenIDE-Module-Requires="org.openide.windows.WindowManager" OpenIDE-Module-Short-Description="Netbeans Support for Python" OpenIDE-Module-Specification-Version="1.8"/>
</module>
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE module_updates PUBLIC "-//NetBeans//DTD Autoupdate Catalog 2.8//EN" "http://www.netbeans.org/dtds/autoupdate-catalog-2_8.dtd">
<module_updates timestamp="00/00/00/07/02/2024">
<module codenamebase="io.github.albilu.python" distribution="https://github.com/albilu/netbeansPython/releases/download/1.9/python-RELEASE160-1.9.nbm" downloadsize="133405377" homepage="https://github.com/albilu/netbeansPython" moduleauthor="albilu" needsrestart="true" releasedate="2024/02/07">
<manifest OpenIDE-Module="io.github.albilu.python" AutoUpdate-Show-In-Client="true" OpenIDE-Module-Display-Category="Editing" OpenIDE-Module-Implementation-Version="RELEASE160-1.9" OpenIDE-Module-Name="Python" OpenIDE-Module-Requires="org.openide.windows.WindowManager" OpenIDE-Module-Short-Description="Netbeans Support for Python" OpenIDE-Module-Specification-Version="1.9"/>
</module>
</module_updates>
10 changes: 5 additions & 5 deletions ppuc/17/updates.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE module_updates PUBLIC "-//NetBeans//DTD Autoupdate Catalog 2.8//EN" "http://www.netbeans.org/dtds/autoupdate-catalog-2_8.dtd">
<module_updates timestamp="00/00/00/09/01/2024">
<module codenamebase="io.github.albilu.python" distribution="https://github.com/albilu/netbeansPython/releases/download/1.8/python-RELEASE170-1.8.nbm" downloadsize="133405377" homepage="https://github.com/albilu/netbeansPython" moduleauthor="albilu" needsrestart="true" releasedate="2024/01/09">
<manifest OpenIDE-Module="io.github.albilu.python" AutoUpdate-Show-In-Client="true" OpenIDE-Module-Display-Category="Editing" OpenIDE-Module-Implementation-Version="RELEASE170-1.8" OpenIDE-Module-Name="Python" OpenIDE-Module-Requires="org.openide.windows.WindowManager" OpenIDE-Module-Short-Description="Netbeans Support for Python" OpenIDE-Module-Specification-Version="1.8"/>
</module>
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE module_updates PUBLIC "-//NetBeans//DTD Autoupdate Catalog 2.8//EN" "http://www.netbeans.org/dtds/autoupdate-catalog-2_8.dtd">
<module_updates timestamp="00/00/00/07/02/2024">
<module codenamebase="io.github.albilu.python" distribution="https://github.com/albilu/netbeansPython/releases/download/1.9/python-RELEASE170-1.9.nbm" downloadsize="133405377" homepage="https://github.com/albilu/netbeansPython" moduleauthor="albilu" needsrestart="true" releasedate="2024/02/07">
<manifest OpenIDE-Module="io.github.albilu.python" AutoUpdate-Show-In-Client="true" OpenIDE-Module-Display-Category="Editing" OpenIDE-Module-Implementation-Version="RELEASE170-1.9" OpenIDE-Module-Name="Python" OpenIDE-Module-Requires="org.openide.windows.WindowManager" OpenIDE-Module-Short-Description="Netbeans Support for Python" OpenIDE-Module-Specification-Version="1.9"/>
</module>
</module_updates>
10 changes: 5 additions & 5 deletions ppuc/18/updates.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE module_updates PUBLIC "-//NetBeans//DTD Autoupdate Catalog 2.8//EN" "http://www.netbeans.org/dtds/autoupdate-catalog-2_8.dtd">
<module_updates timestamp="00/00/00/09/01/2024">
<module codenamebase="io.github.albilu.python" distribution="https://github.com/albilu/netbeansPython/releases/download/1.8/python-RELEASE180-1.8.nbm" downloadsize="133405377" homepage="https://github.com/albilu/netbeansPython" moduleauthor="albilu" needsrestart="true" releasedate="2024/01/09">
<manifest OpenIDE-Module="io.github.albilu.python" AutoUpdate-Show-In-Client="true" OpenIDE-Module-Display-Category="Editing" OpenIDE-Module-Implementation-Version="RELEASE180-1.8" OpenIDE-Module-Name="Python" OpenIDE-Module-Requires="org.openide.windows.WindowManager" OpenIDE-Module-Short-Description="Netbeans Support for Python" OpenIDE-Module-Specification-Version="1.8"/>
</module>
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE module_updates PUBLIC "-//NetBeans//DTD Autoupdate Catalog 2.8//EN" "http://www.netbeans.org/dtds/autoupdate-catalog-2_8.dtd">
<module_updates timestamp="00/00/00/07/02/2024">
<module codenamebase="io.github.albilu.python" distribution="https://github.com/albilu/netbeansPython/releases/download/1.9/python-RELEASE180-1.9.nbm" downloadsize="133405377" homepage="https://github.com/albilu/netbeansPython" moduleauthor="albilu" needsrestart="true" releasedate="2024/02/07">
<manifest OpenIDE-Module="io.github.albilu.python" AutoUpdate-Show-In-Client="true" OpenIDE-Module-Display-Category="Editing" OpenIDE-Module-Implementation-Version="RELEASE180-1.9" OpenIDE-Module-Name="Python" OpenIDE-Module-Requires="org.openide.windows.WindowManager" OpenIDE-Module-Short-Description="Netbeans Support for Python" OpenIDE-Module-Specification-Version="1.9"/>
</module>
</module_updates>
10 changes: 5 additions & 5 deletions ppuc/19/updates.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE module_updates PUBLIC "-//NetBeans//DTD Autoupdate Catalog 2.8//EN" "http://www.netbeans.org/dtds/autoupdate-catalog-2_8.dtd">
<module_updates timestamp="00/00/00/09/01/2024">
<module codenamebase="io.github.albilu.python" distribution="https://github.com/albilu/netbeansPython/releases/download/1.8/python-RELEASE190-1.8.nbm" downloadsize="133405377" homepage="https://github.com/albilu/netbeansPython" moduleauthor="albilu" needsrestart="true" releasedate="2024/01/09">
<manifest OpenIDE-Module="io.github.albilu.python" AutoUpdate-Show-In-Client="true" OpenIDE-Module-Display-Category="Editing" OpenIDE-Module-Implementation-Version="RELEASE190-1.8" OpenIDE-Module-Name="Python" OpenIDE-Module-Requires="org.openide.windows.WindowManager" OpenIDE-Module-Short-Description="Netbeans Support for Python" OpenIDE-Module-Specification-Version="1.8"/>
</module>
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE module_updates PUBLIC "-//NetBeans//DTD Autoupdate Catalog 2.8//EN" "http://www.netbeans.org/dtds/autoupdate-catalog-2_8.dtd">
<module_updates timestamp="00/00/00/07/02/2024">
<module codenamebase="io.github.albilu.python" distribution="https://github.com/albilu/netbeansPython/releases/download/1.9/python-RELEASE190-1.9.nbm" downloadsize="133405377" homepage="https://github.com/albilu/netbeansPython" moduleauthor="albilu" needsrestart="true" releasedate="2024/02/07">
<manifest OpenIDE-Module="io.github.albilu.python" AutoUpdate-Show-In-Client="true" OpenIDE-Module-Display-Category="Editing" OpenIDE-Module-Implementation-Version="RELEASE190-1.9" OpenIDE-Module-Name="Python" OpenIDE-Module-Requires="org.openide.windows.WindowManager" OpenIDE-Module-Short-Description="Netbeans Support for Python" OpenIDE-Module-Specification-Version="1.9"/>
</module>
</module_updates>
10 changes: 5 additions & 5 deletions ppuc/20/updates.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE module_updates PUBLIC "-//NetBeans//DTD Autoupdate Catalog 2.8//EN" "http://www.netbeans.org/dtds/autoupdate-catalog-2_8.dtd">
<module_updates timestamp="00/00/00/09/01/2024">
<module codenamebase="io.github.albilu.python" distribution="https://github.com/albilu/netbeansPython/releases/download/1.8/python-RELEASE200-1.8.nbm" downloadsize="133405377" homepage="https://github.com/albilu/netbeansPython" moduleauthor="albilu" needsrestart="true" releasedate="2024/01/09">
<manifest OpenIDE-Module="io.github.albilu.python" AutoUpdate-Show-In-Client="true" OpenIDE-Module-Display-Category="Editing" OpenIDE-Module-Implementation-Version="RELEASE200-1.8" OpenIDE-Module-Name="Python" OpenIDE-Module-Requires="org.openide.windows.WindowManager" OpenIDE-Module-Short-Description="Netbeans Support for Python" OpenIDE-Module-Specification-Version="1.8"/>
</module>
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE module_updates PUBLIC "-//NetBeans//DTD Autoupdate Catalog 2.8//EN" "http://www.netbeans.org/dtds/autoupdate-catalog-2_8.dtd">
<module_updates timestamp="00/00/00/07/02/2024">
<module codenamebase="io.github.albilu.python" distribution="https://github.com/albilu/netbeansPython/releases/download/1.9/python-RELEASE200-1.9.nbm" downloadsize="133405377" homepage="https://github.com/albilu/netbeansPython" moduleauthor="albilu" needsrestart="true" releasedate="2024/02/07">
<manifest OpenIDE-Module="io.github.albilu.python" AutoUpdate-Show-In-Client="true" OpenIDE-Module-Display-Category="Editing" OpenIDE-Module-Implementation-Version="RELEASE200-1.9" OpenIDE-Module-Name="Python" OpenIDE-Module-Requires="org.openide.windows.WindowManager" OpenIDE-Module-Short-Description="Netbeans Support for Python" OpenIDE-Module-Specification-Version="1.9"/>
</module>
</module_updates>
79 changes: 40 additions & 39 deletions src/main/java/org/netbeans/modules/python/PythonLspClient.java
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
package org.netbeans.modules.python;

/**
*
*/
import java.io.IOException;
import org.netbeans.api.editor.mimelookup.MimeRegistration;
import org.netbeans.modules.lsp.client.spi.LanguageServerProvider;
import org.openide.util.Exceptions;
import org.openide.util.Lookup;

@MimeRegistration(mimeType = PythonUtility.PYTHON_MIME_TYPE,
service = LanguageServerProvider.class)
public class PythonLspClient implements LanguageServerProvider {

@Override
public LanguageServerDescription startServer(Lookup lkp) {
try {
Process p = new ProcessBuilder(
PythonUtility.getLspPythonExe(),
"-m",
"pylsp",
"--log-file",
PythonUtility.PYLSP_VENV_DIR.toPath().resolve("lsp_log_file").toString()
//,
//"-v"
)
.redirectError(ProcessBuilder.Redirect.INHERIT)
.start();
return LanguageServerDescription.create(p.getInputStream(),
p.getOutputStream(), p
);
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
return null;
}
}

}
package org.netbeans.modules.python;

/**
*
*/
import java.io.IOException;
import org.netbeans.api.editor.mimelookup.MimeRegistration;
import org.netbeans.modules.lsp.client.spi.LanguageServerProvider;
import org.openide.util.Exceptions;
import org.openide.util.Lookup;

@MimeRegistration(mimeType = PythonUtility.PYTHON_MIME_TYPE,
service = LanguageServerProvider.class)
public class PythonLspClient implements LanguageServerProvider {

@Override
public LanguageServerDescription startServer(Lookup lkp) {
try {
Process p = new ProcessBuilder(
PythonUtility.getLspPythonExe(),
"-m",
"pylsp",
"--verbose",
"--log-file",
PythonUtility.PYLSP_VENV_DIR.toPath().resolve("lsp_log_file").toString()
//,
//"-v"
)
.redirectError(ProcessBuilder.Redirect.INHERIT)
.start();
return LanguageServerDescription.create(p.getInputStream(),
p.getOutputStream(), p
);
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
return null;
}
}

}
Loading

0 comments on commit 764d405

Please sign in to comment.