~damien/jedit-lsp

102b4e412fc126a2320ca6605a1a376dcb28766e — Damien Radtke 3 months ago 611eef4
Attempt to make ProjectViewer an optional dependency
3 files changed, 9 insertions(+), 7 deletions(-)

M LSP.props
M lsp/Server.java
M lsp/jEditLanguageClient.java
M LSP.props => LSP.props +1 -1
@@ 12,7 12,7 @@ plugin.lsp.LanguageServerPlugin.depend.0=jdk 11
plugin.lsp.LanguageServerPlugin.depend.1=jedit 05.05.99.00
plugin.lsp.LanguageServerPlugin.depend.2=plugin errorlist.ErrorListPlugin 2.4.0
plugin.lsp.LanguageServerPlugin.depend.3=plugin sidekick.SideKickPlugin 1.8
plugin.lsp.LanguageServerPlugin.depend.4=plugin projectviewer.ProjectPlugin 3.6
plugin.lsp.LanguageServerPlugin.depend.4=optional plugin projectviewer.ProjectPlugin 3.6

plugin.lsp.LanguageServerPlugin.menu=lsp.status - lsp.completion lsp.code-action lsp.rename lsp.execute-command - lsp.hover lsp.goto-definition lsp.format - lsp.restart lsp.stop lsp.start - lsp.install
lsp.status.label=Get Server Status

M lsp/Server.java => lsp/Server.java +1 -1
@@ 183,7 183,7 @@ public class Server {
					starting = false;
				}
			} catch(MockHandleException e) {
				log(Log.DEBUG, "Starting server must have failed, not initialized");
				log(Log.DEBUG, "Starting server must have failed, not initialized", e);
			} catch(Exception e) {
				log(Log.ERROR, "Failed to start server", e);
				Utils.showTemporaryMessage("Failed to start server: " + process.getName());

M lsp/jEditLanguageClient.java => lsp/jEditLanguageClient.java +7 -5
@@ 767,16 767,18 @@ public class jEditLanguageClient implements LanguageClient {
			for (projectviewer.vpt.VPTProject project : projectviewer.ProjectManager.getInstance().getProjects()) {
				project = projectviewer.ProjectManager.getInstance().getProject(project.getName()); // ensure it's loaded
				if (Paths.get(new URI(uri).getPath()).startsWith(Paths.get(project.getRootPath()))) {
					projectviewer.vpt.VPTNode node = null;
					if (isDir) {
						Log.log(Log.DEBUG, this, "Registering new directory in " + project + ": " + uri);
						// NOTE: For some reason, the call to project.registerNodePath() causes the plugin to
						// fail loading due to a NoClassDefFound error if we try to make ProjectViewer an
						// optional dependency.
						project.registerNodePath(new projectviewer.vpt.VPTDirectory(uri));
						node = new projectviewer.vpt.VPTDirectory(uri);
					} else {
						Log.log(Log.DEBUG, this, "Registering new file in " + project + ": " + uri);
						project.registerNodePath(new projectviewer.vpt.VPTFile(uri));
						node = new projectviewer.vpt.VPTFile(uri);
					}
					// NOTE: For some reason, the call to project.registerNodePath() causes the plugin to
					// fail loading due to a NoClassDefFound error if we try to make ProjectViewer an
					// optional dependency.
					project.registerNodePath(node);
				} else {
					Log.log(Log.WARNING, this, "URI " + uri + " does not start with " + project.getRootPath());
				}