Skip to content

Commit

Permalink
wait for lifecycle jobs before calc semantic tokens (#1412)
Browse files Browse the repository at this point in the history
Signed-off-by: Yan Zhang <[email protected]>
  • Loading branch information
Eskibear authored Apr 26, 2020
1 parent 4455d06 commit 465ee9a
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import org.eclipse.jdt.core.manipulation.CoreASTProvider;
import org.eclipse.jdt.ls.core.internal.JDTUtils;
import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin;
import org.eclipse.jdt.ls.core.internal.JobHelpers;
import org.eclipse.jdt.ls.core.internal.handlers.DocumentLifeCycleHandler;
import org.eclipse.jdt.ls.core.internal.handlers.JsonRpcHelpers;
import org.eclipse.jdt.ls.core.internal.semantictokens.SemanticTokenManager;
import org.eclipse.jdt.ls.core.internal.semantictokens.SemanticTokens;
Expand All @@ -30,9 +32,12 @@
import org.eclipse.jface.text.IDocument;

public class SemanticTokensCommand {

public static SemanticTokens provide(String uri) {
JobHelpers.waitForJobs(DocumentLifeCycleHandler.DOCUMENT_LIFE_CYCLE_JOBS, null);
return doProvide(uri);
}

private static SemanticTokens doProvide(String uri) {
IDocument document = null;

ICompilationUnit cu = JDTUtils.resolveCompilationUnit(uri);
Expand Down

0 comments on commit 465ee9a

Please sign in to comment.