Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

                while (en.hasMoreElements()) {
                    ZipEntry ze = en.nextElement();
                    if (ze.isDirectory()) {
                        continue;
                    }
                    File target = new File(serverCache, ze.getName());
                    target.getParentFile().mkdirs();
                    try (OutputStream out = new FileOutputStream(target)) {
                        FileUtil.copy(zf.getInputStream(ze), out);
                    }
                }
                if (!Utilities.isWindows()) {
                    executable.setExecutable(true);
                }
                for (ModuleInfo mi : Lookup.getDefault().lookupAll(ModuleInfo.class)) {
                    if ("org.netbeans.modules.kotlin.editor".equals(mi.getCodeNameBase())) {
                        Class<?> utils = mi.getClassLoader().loadClass("org.netbeans.modules.kotlin.editor.Utils");
                        NbPreferences.forModule(utils).node("lsp").put("location", serverDir.getAbsolutePath());
                    }
                }
            } catch (IOException | ClassNotFoundException ex) {
                Exceptions.printStackTrace(ex);
            }
        }
    }

}

More changes are needed. The interested reader can study java/kotlin.editor and nb/updatecenters/extras/libs.kotlin.lsp modules for more details.

Open the source file again and try code completion, formatting, navigation (e.g. jump to definition, peek definition), find all references, symbol search etc.

...