From 1bbff65eb572ea144bb418406557d24e1008d0bf Mon Sep 17 00:00:00 2001 From: Jinbo Wang Date: Mon, 8 May 2023 15:42:49 +0800 Subject: [PATCH] No need to run didOpen/didClose/didChange with scheduling rule (#2637) No need to run document lifecycle operation with scheduling rule --- .../internal/handlers/BaseDocumentLifeCycleHandler.java | 9 +++------ .../jdt/ls/core/internal/handlers/JsonRpcHelpers.java | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/BaseDocumentLifeCycleHandler.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/BaseDocumentLifeCycleHandler.java index 292ebe4f1c..c572efe7fe 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/BaseDocumentLifeCycleHandler.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/BaseDocumentLifeCycleHandler.java @@ -302,14 +302,13 @@ public IProblemRequestor getProblemRequestor(ICompilationUnit workingCopy) { public void didClose(DidCloseTextDocumentParams params) { documentVersions.remove(params.getTextDocument().getUri()); - ISchedulingRule rule = JDTUtils.getRule(params.getTextDocument().getUri()); try { ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { @Override public void run(IProgressMonitor monitor) throws CoreException { handleClosed(params); } - }, rule, IWorkspace.AVOID_UPDATE, new NullProgressMonitor()); + }, null, IWorkspace.AVOID_UPDATE, new NullProgressMonitor()); } catch (CoreException e) { JavaLanguageServerPlugin.logException("Handle document close ", e); } @@ -317,14 +316,13 @@ public void run(IProgressMonitor monitor) throws CoreException { public void didOpen(DidOpenTextDocumentParams params) { documentVersions.put(params.getTextDocument().getUri(), params.getTextDocument().getVersion()); - ISchedulingRule rule = JDTUtils.getRule(params.getTextDocument().getUri()); try { ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { @Override public void run(IProgressMonitor monitor) throws CoreException { handleOpen(params); } - }, rule, IWorkspace.AVOID_UPDATE, new NullProgressMonitor()); + }, null, IWorkspace.AVOID_UPDATE, new NullProgressMonitor()); } catch (CoreException e) { JavaLanguageServerPlugin.logException("Handle document open ", e); } @@ -332,14 +330,13 @@ public void run(IProgressMonitor monitor) throws CoreException { public void didChange(DidChangeTextDocumentParams params) { documentVersions.put(params.getTextDocument().getUri(), params.getTextDocument().getVersion()); - ISchedulingRule rule = JDTUtils.getRule(params.getTextDocument().getUri()); try { ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { @Override public void run(IProgressMonitor monitor) throws CoreException { handleChanged(params); } - }, rule, IWorkspace.AVOID_UPDATE, new NullProgressMonitor()); + }, null, IWorkspace.AVOID_UPDATE, new NullProgressMonitor()); } catch (CoreException e) { JavaLanguageServerPlugin.logException("Handle document change ", e); } diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/JsonRpcHelpers.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/JsonRpcHelpers.java index b9b9cabb5d..0d488bc61b 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/JsonRpcHelpers.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/JsonRpcHelpers.java @@ -84,7 +84,7 @@ public static int toOffset(IDocument document, int line, int column) { try { return document.getLineOffset(line) + column; } catch (BadLocationException e) { - JavaLanguageServerPlugin.logException(e.getMessage(), e); + JavaLanguageServerPlugin.debugTrace("toOffset: " + (e.getMessage() == null ? e.toString() : e.getMessage())); } } return -1; @@ -157,7 +157,7 @@ public static int[] toLine(IDocument document, int offset) { int column = offset - document.getLineOffset(line); return new int[] { line, column }; } catch (BadLocationException e) { - JavaLanguageServerPlugin.logException(e.getMessage(), e); + JavaLanguageServerPlugin.debugTrace("toLine: " + (e.getMessage() == null ? e.toString() : e.getMessage())); } } return null;