From 764d405388b1921f6248a9782cdcae78c1b06f17 Mon Sep 17 00:00:00 2001 From: albilu <35330562+albilu@users.noreply.github.com> Date: Wed, 7 Feb 2024 15:27:56 +0100 Subject: [PATCH] Fix Task #101 - Auto Update LSP on Startup seems to be ignored. --- pom.xml | 2 +- ppuc/13/updates.xml | 10 +- ppuc/14/updates.xml | 10 +- ppuc/15/updates.xml | 10 +- ppuc/16/updates.xml | 10 +- ppuc/17/updates.xml | 10 +- ppuc/18/updates.xml | 10 +- ppuc/19/updates.xml | 10 +- ppuc/20/updates.xml | 10 +- .../modules/python/PythonLspClient.java | 79 +++++++-------- .../org/netbeans/modules/python/schema.json | 97 +++---------------- 11 files changed, 97 insertions(+), 161 deletions(-) diff --git a/pom.xml b/pom.xml index 5d12bc4..aa6b6ba 100644 --- a/pom.xml +++ b/pom.xml @@ -802,7 +802,7 @@ target/keystore RELEASE200 - 1.8 + 1.9 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 a480b21..16567b0 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 46762a5..025240c 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 dccfc40..303d44c 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 f77bcaf..321d1a9 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 8e3ebcc..d511dac 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 d7472de..6e5d44a 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 f0d6b59..a32a633 100644 --- a/ppuc/19/updates.xml +++ b/ppuc/19/updates.xml @@ -1,6 +1,6 @@ - - - - - + + + + + \ No newline at end of file diff --git a/ppuc/20/updates.xml b/ppuc/20/updates.xml index 455c48e..17c29ce 100644 --- a/ppuc/20/updates.xml +++ b/ppuc/20/updates.xml @@ -1,6 +1,6 @@ - - - - - + + + + + \ No newline at end of file diff --git a/src/main/java/org/netbeans/modules/python/PythonLspClient.java b/src/main/java/org/netbeans/modules/python/PythonLspClient.java index a00cb33..cd87ffc 100644 --- a/src/main/java/org/netbeans/modules/python/PythonLspClient.java +++ b/src/main/java/org/netbeans/modules/python/PythonLspClient.java @@ -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; + } + } + +} diff --git a/src/main/resources/org/netbeans/modules/python/schema.json b/src/main/resources/org/netbeans/modules/python/schema.json index f8806be..2740495 100644 --- a/src/main/resources/org/netbeans/modules/python/schema.json +++ b/src/main/resources/org/netbeans/modules/python/schema.json @@ -66,13 +66,7 @@ "examples": [false], "type": "boolean" } - }, - "required": [ - "enabled", - "live_mode", - "dmypy", - "strict" - ] + } }, "rope": { "additionalProperties": true, @@ -91,11 +85,7 @@ "examples": [""], "type": "string" } - }, - "required": [ - "extensionModules", - "ropeFolder" - ] + } }, "black": { "additionalProperties": true, @@ -123,10 +113,7 @@ } }, "required": [ - "enabled", - "cache_config", - "line_length", - "preview" + "enabled" ] }, "pycodestyle": { @@ -166,14 +153,7 @@ } }, "required": [ - "enabled", - "exclude", - "filename", - "select", - "ignore", - "hangClosing", - "maxLineLength", - "indentSize" + "enabled" ] }, "jedi_hover": { @@ -202,8 +182,7 @@ } }, "required": [ - "enabled", - "eager" + "enabled" ] }, "preload": { @@ -218,8 +197,7 @@ "modules": {"type": "array"} }, "required": [ - "enabled", - "modules" + "enabled" ] }, "flake8": { @@ -274,17 +252,7 @@ } }, "required": [ - "config", - "enabled", - "exclude", - "executable", - "filename", - "hangClosing", - "ignore", - "maxLineLength", - "indentSize", - "perFileIgnores", - "select" + "enabled" ] }, "jedi": { @@ -304,12 +272,7 @@ "additionalProperties": true, "type": "object" } - }, - "required": [ - "auto_import_modules", - "extra_paths", - "env_vars" - ] + } }, "jedi_symbols": { "additionalProperties": true, @@ -332,9 +295,7 @@ } }, "required": [ - "enabled", - "all_scopes", - "include_import_symbols" + "enabled" ] }, "mccabe": { @@ -353,8 +314,7 @@ } }, "required": [ - "enabled", - "threshold" + "enabled" ] }, "pylint": { @@ -374,9 +334,7 @@ } }, "required": [ - "enabled", - "args", - "executable" + "enabled" ] }, "jedi_references": { @@ -421,12 +379,7 @@ "additional_search_paths": {"type": "array"} }, "required": [ - "enabled", - "recursive", - "decorator_module", - "decorator_function", - "reason_keyword", - "additional_search_paths" + "enabled" ] }, "jedi_completion": { @@ -483,14 +436,7 @@ } }, "required": [ - "enabled", - "include_params", - "include_class_objects", - "include_function_objects", - "fuzzy", - "eager", - "resolve_at_most", - "cache_for" + "enabled" ] }, "jedi_signature_help": { @@ -540,14 +486,7 @@ } }, "required": [ - "enabled", - "convention", - "addIgnore", - "addSelect", - "ignore", - "select", - "match", - "matchDir" + "enabled" ] }, "rope_autoimport": { @@ -566,8 +505,7 @@ } }, "required": [ - "enabled", - "memory" + "enabled" ] }, "jedi_definition": { @@ -596,10 +534,7 @@ } }, "required": [ - "enabled", - "follow_imports", - "follow_builtin_imports", - "follow_builtin_definitions" + "enabled" ] } },