From 92019a830e88d36ea8cc6b89e16e121a9901e4f3 Mon Sep 17 00:00:00 2001 From: Sergey Savenko Date: Mon, 9 Feb 2015 14:22:20 +0300 Subject: [PATCH 1/6] DBE-1091: track modification count to update QuickDocs --- .../documentation/DocumentationComponent.java | 19 +++++++++++++++++-- .../documentation/DocumentationManager.java | 5 +++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java index a260439b1c18..895cd2e2ce75 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java @@ -48,6 +48,7 @@ import com.intellij.pom.Navigatable; import com.intellij.psi.PsiElement; import com.intellij.psi.SmartPointerManager; import com.intellij.psi.SmartPsiElementPointer; +import com.intellij.psi.util.PsiModificationTracker; import com.intellij.ui.IdeBorderFactory; import com.intellij.ui.JBColor; import com.intellij.ui.SideBorder; @@ -94,6 +95,7 @@ public class DocumentationComponent extends JPanel implements Disposable, DataPr private DocumentationManager myManager; private SmartPsiElementPointer myElement; + private long myModificationCount; private final Stack myBackStack = new Stack(); private final Stack myForwardStack = new Stack(); @@ -485,6 +487,19 @@ public class DocumentationComponent extends JPanel implements Disposable, DataPr return myElement != null ? myElement.getElement() : null; } + private void setElement(SmartPsiElementPointer element) { + myElement = element; + myModificationCount = getCurrentModificationCount(); + } + + public boolean isUpToDate() { + return getElement() != null && myModificationCount == getCurrentModificationCount(); + } + + private long getCurrentModificationCount() { + return myElement != null ? PsiModificationTracker.SERVICE.getInstance(myElement.getProject()).getModificationCount() : -1; + } + public void setNavigateCallback(Consumer navigateCallback) { myNavigateCallback = navigateCallback; } @@ -531,7 +546,7 @@ public class DocumentationComponent extends JPanel implements Disposable, DataPr : null; if (element != null) { - myElement = element; + setElement(element); } myIsEmpty = false; @@ -546,7 +561,7 @@ public class DocumentationComponent extends JPanel implements Disposable, DataPr } private void setDataInternal(SmartPsiElementPointer element, String text, final Rectangle viewRect, boolean skip) { - myElement = element; + setElement(element); boolean justShown = false; if (!myIsShown && myHint != null) { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java index c5de46f9332a..d1bbdf28bf32 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java @@ -395,7 +395,8 @@ public class DocumentationManager extends DockablePopupManager Date: Mon, 9 Feb 2015 10:49:55 +0100 Subject: [PATCH 2/6] source info: lazy compute offset --- .../org/jetbrains/debugger/SourceInfo.java | 74 +++++++++++++------ .../xdebugger/impl/XSourcePositionImpl.java | 13 +++- 2 files changed, 63 insertions(+), 24 deletions(-) diff --git a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/SourceInfo.java b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/SourceInfo.java index 4bfce6088d09..f1c899be3e04 100644 --- a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/SourceInfo.java +++ b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/SourceInfo.java @@ -2,42 +2,38 @@ package org.jetbrains.debugger; import com.intellij.openapi.application.AccessToken; import com.intellij.openapi.application.ReadAction; +import com.intellij.openapi.editor.Document; +import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.fileEditor.OpenFileDescriptor; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.pom.Navigatable; -import com.intellij.xdebugger.XDebuggerUtil; import com.intellij.xdebugger.XSourcePosition; -import com.intellij.xdebugger.XSourcePositionWrapper; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class SourceInfo extends XSourcePositionWrapper { +public class SourceInfo implements XSourcePosition { private final String functionName; + + private final VirtualFile file; + private final int line; private final int column; + private int offset = -1; + + private SourceInfo(@Nullable String functionName, @NotNull VirtualFile file, int line, int column) { + this.functionName = functionName; + this.file = file; + this.line = line; + this.column = column; + } + @Nullable public static SourceInfo create(@Nullable String functionName, @Nullable VirtualFile file, int line, int column) { - if (file == null) { + if (file == null || !file.isValid()) { return null; } - - XSourcePosition position; - AccessToken token = ReadAction.start(); - try { - position = XDebuggerUtil.getInstance().createPosition(file, line); - } - finally { - token.finish(); - } - return position == null ? null : new SourceInfo(functionName, position, column); - } - - private SourceInfo(@Nullable String functionName, @NotNull XSourcePosition position, int column) { - super(position); - - this.functionName = functionName; - this.column = column; + return new SourceInfo(functionName, file, line, column); } @Nullable @@ -45,18 +41,50 @@ public class SourceInfo extends XSourcePositionWrapper { return functionName; } + @Override + public int getLine() { + return line; + } + public int getColumn() { return column; } + @Override + public int getOffset() { + if (offset == -1) { + Document document; + AccessToken token = ReadAction.start(); + try { + document = file.isValid() ? FileDocumentManager.getInstance().getDocument(file) : null; + } + finally { + token.finish(); + } + + if (document == null) { + return -1; + } + + offset = line < document.getLineCount() ? document.getLineStartOffset(line) : -1; + } + return offset; + } + + @NotNull + @Override + public VirtualFile getFile() { + return file; + } + @NotNull @Override public Navigatable createNavigatable(@NotNull Project project) { - return new OpenFileDescriptor(project, myPosition.getFile(), myPosition.getLine(), column); + return new OpenFileDescriptor(project, getFile(), getLine(), getColumn()); } @Override public String toString() { - return myPosition.getFile() + ":" + myPosition.getLine() + (column == -1 ? "": (":" + getColumn())); + return getFile() + ":" + getLine() + (column == -1 ? "": (":" + getColumn())); } } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XSourcePositionImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XSourcePositionImpl.java index c11e8f5547cb..fd68ef40752c 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XSourcePositionImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XSourcePositionImpl.java @@ -113,11 +113,22 @@ public class XSourcePositionImpl implements XSourcePosition { @Override @NotNull public Navigatable createNavigatable(@NotNull Project project) { - return createOpenFileDescriptor(project, this); + return doCreateOpenFileDescriptor(project, this); } @NotNull public static OpenFileDescriptor createOpenFileDescriptor(@NotNull Project project, @NotNull XSourcePosition position) { + Navigatable navigatable = position.createNavigatable(project); + if (navigatable instanceof OpenFileDescriptor) { + return (OpenFileDescriptor)navigatable; + } + else { + return doCreateOpenFileDescriptor(project, position); + } + } + + @NotNull + private static OpenFileDescriptor doCreateOpenFileDescriptor(@NotNull Project project, @NotNull XSourcePosition position) { return position.getOffset() != -1 ? new OpenFileDescriptor(project, position.getFile(), position.getOffset()) : new OpenFileDescriptor(project, position.getFile(), position.getLine(), 0); From 9a19bb2b8e3422eda46703a4f54d557db87529e9 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Mon, 9 Feb 2015 12:22:03 +0100 Subject: [PATCH 3/6] =?UTF-8?q?move=20FileUrlMapper=20to=20community=20?= =?UTF-8?q?=E2=80=94=20kotlin=20should=20be=20able=20to=20use=20this=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../javascript/debugger/FileUrlMapper.java | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 platform/script-debugger/debugger-ui/src/com/jetbrains/javascript/debugger/FileUrlMapper.java diff --git a/platform/script-debugger/debugger-ui/src/com/jetbrains/javascript/debugger/FileUrlMapper.java b/platform/script-debugger/debugger-ui/src/com/jetbrains/javascript/debugger/FileUrlMapper.java new file mode 100644 index 000000000000..b079afcddcd1 --- /dev/null +++ b/platform/script-debugger/debugger-ui/src/com/jetbrains/javascript/debugger/FileUrlMapper.java @@ -0,0 +1,54 @@ +package com.jetbrains.javascript.debugger; + +import com.intellij.openapi.extensions.ExtensionPointName; +import com.intellij.openapi.fileEditor.OpenFileDescriptor; +import com.intellij.openapi.fileTypes.FileType; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.pom.Navigatable; +import com.intellij.util.Url; +import com.intellij.util.containers.ObjectIntHashMap; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +public abstract class FileUrlMapper { + public static final ExtensionPointName EP_NAME = ExtensionPointName.create("com.jetbrains.fileUrlMapper"); + + @NotNull + public abstract List getUrls(@NotNull VirtualFile file, @NotNull Project project, @Nullable String currentAuthority); + + /** + * Optional to implement, useful if default navigation position to source file is not equals to 0:0 (java file for example) + */ + @Nullable + public Navigatable getNavigatable(@NotNull Url url, @NotNull Project project, @Nullable Url requestor) { + VirtualFile file = getFile(url, project, requestor); + return file == null ? null : new OpenFileDescriptor(project, file); + } + + @Nullable + public abstract VirtualFile getFile(@NotNull Url url, @NotNull Project project, @Nullable Url requestor); + + /** + * Optional to implement, sometimes you cannot build URL, but can match. + * Lifetime: resolve session lifetime. Could be called multiple times: n <= total sourcemap count + */ + @Nullable + public SourceResolver createSourceResolver(@NotNull VirtualFile file, @NotNull Project project) { + return null; + } + + @Nullable + public FileType getFileType(@NotNull Url url) { + return null; + } + + public static abstract class SourceResolver { + /** + * Return -1 if no match + */ + public abstract int resolve(@NotNull ObjectIntHashMap map, @NotNull Project project); + } +} \ No newline at end of file From 71c6e5f3f02aa55cc57cab882885333e6286dd1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20C=C3=A9bron?= Date: Mon, 9 Feb 2015 12:37:08 +0100 Subject: [PATCH 4/6] IDEA-126386 Update eclipse logo, re-fix EclipseIcons --- plugins/eclipse/eclipse.iml | 6 ++-- plugins/eclipse/gen/icons/EclipseIcons.java | 17 ++++++++++ .../eclipse/resources/icons/EclipseIcons.java | 32 ------------------ plugins/eclipse/resources/icons/eclipse.png | Bin 0 -> 428 bytes .../eclipse/resources/icons/eclipse@2x.png | Bin 0 -> 751 bytes .../resources/icons/eclipse@2x_dark.png | Bin 0 -> 757 bytes .../eclipse/resources/icons/eclipse_dark.png | Bin 0 -> 438 bytes plugins/eclipse/resources/images/eclipse.gif | Bin 308 -> 0 bytes 8 files changed, 20 insertions(+), 35 deletions(-) create mode 100644 plugins/eclipse/gen/icons/EclipseIcons.java delete mode 100644 plugins/eclipse/resources/icons/EclipseIcons.java create mode 100644 plugins/eclipse/resources/icons/eclipse.png create mode 100644 plugins/eclipse/resources/icons/eclipse@2x.png create mode 100644 plugins/eclipse/resources/icons/eclipse@2x_dark.png create mode 100644 plugins/eclipse/resources/icons/eclipse_dark.png delete mode 100644 plugins/eclipse/resources/images/eclipse.gif diff --git a/plugins/eclipse/eclipse.iml b/plugins/eclipse/eclipse.iml index 30486e5f0e57..c75f9703346e 100644 --- a/plugins/eclipse/eclipse.iml +++ b/plugins/eclipse/eclipse.iml @@ -3,9 +3,10 @@ - + + @@ -22,5 +23,4 @@ - - + \ No newline at end of file diff --git a/plugins/eclipse/gen/icons/EclipseIcons.java b/plugins/eclipse/gen/icons/EclipseIcons.java new file mode 100644 index 000000000000..891304281e9e --- /dev/null +++ b/plugins/eclipse/gen/icons/EclipseIcons.java @@ -0,0 +1,17 @@ +package icons; + +import com.intellij.openapi.util.IconLoader; + +import javax.swing.*; + +/** + * NOTE THIS FILE IS AUTO-GENERATED + * DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead + */ +public class EclipseIcons { + private static Icon load(String path) { + return IconLoader.getIcon(path, EclipseIcons.class); + } + + public static final Icon Eclipse = load("/icons/eclipse.png"); // 16x16 +} diff --git a/plugins/eclipse/resources/icons/EclipseIcons.java b/plugins/eclipse/resources/icons/EclipseIcons.java deleted file mode 100644 index ab91ce0e357b..000000000000 --- a/plugins/eclipse/resources/icons/EclipseIcons.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2000-2013 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package icons; - -import com.intellij.openapi.util.IconLoader; - -import javax.swing.*; - -/** - * NOTE THIS FILE IS AUTO-GENERATED - * DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead - */ -public class EclipseIcons { - private static Icon load(String path) { - return IconLoader.getIcon(path, EclipseIcons.class); - } - - public static final Icon Eclipse = load("/images/eclipse.gif"); // 16x16 -} diff --git a/plugins/eclipse/resources/icons/eclipse.png b/plugins/eclipse/resources/icons/eclipse.png new file mode 100644 index 0000000000000000000000000000000000000000..decb2e41988963e79bd741d8cc76ac31f56b361b GIT binary patch literal 428 zcmV;d0aN~oP)if0uBnYRGq2QF%)C>SIrTk0T$(fORdemEYpwNjE>UDa zOa1H%SiP`t_V(ioW^F%#3$I$b_aMj%yLX(J1~Z@uIS^w*n*V3SPQr@QVmR z=~rT8y%V;i8~{qnC6Nh}a3*Dca8kAax(I7t0AUFrt^j4G#<-{sq|7u8XJ(=_I|Bft WKR#rAroZa|0000o5Gj? literal 0 HcmV?d00001 diff --git a/plugins/eclipse/resources/icons/eclipse@2x.png b/plugins/eclipse/resources/icons/eclipse@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..3d636e1cbbcb59efb16a2c8d8ea0467cd24d320a GIT binary patch literal 751 zcmV|x44rdAQ@jE_i(-K|4Tuwg*bRuKfS7?8 zOpF7VfH)3_uLJR^hn<>1K#e6pd>)AZ0r7tv_$Cln0kIe*4p0T+qd@%Q+a&pd5U+xK zpr-eDEX9Vu0dW%$vyhohY6nz! zl|swGILNE`F_2avq(yN#0F>ZP0P%ky?guKE zLQTtII5MzeH;`t;=70pKxwHq-&FR7iAqaa2&{Qy|TR z>;PM+<^LAudfL#^_b{9q*W`}ufKI3b&H^R5_wG6sb?4Tj<+Q}NZ$9!xcEDk%13(GS zX2G0Ib2hBmznhkL&5Au!kR9*>>Htt_cMLta(qkt4&xoBwF%I-BM&yQ|%CE={_z87D z3{cW?&(4z@fzhx9hIei|v2E+7qdUQP%*<4H6Mz zn`G~xO|pylYPDdm5^%@_dzTVwlHCW=%0P#b)+oK+s^$)AZ0r7tv_$Cln0kIe*4p0T+qd@%Q+hqBIjF_H$ zpr-eDEX9Vu0dW%$vymS_YX?+# zl|swGI4!3CF_2avff04Two0OJ2Z+z(VR zg_@Sba8AjzM-1?EqR} zbO+#xf_|z5e^J_e)B*`D3I-w(P90R)&<^T=zpKh3tjBs_$(m`Fb n%H(};X2QgWK-vnM0pUQ+=L(ZLwqnzWjMHQLe-~xWa6vXe1c={G%FXE_ zq#1^@6DNJnNuDeQGobP7B>6SzaT7igYXAs0lrLNaGvLD09-XY++s@89xcAcbO{-5G z#)r3WJiGts!7E!1?YlG;X26fll|iW!I@ez5Yg>1xrE>jye7L=4{i}&x>#j}i*>H&> z115E^zkt;XYnPokzGmt16S(l!b!QHOyl{B`5H3kygrT`Qcg_Fogy~@UoTSO0kfRZvkcyHzHp2|bil6eoAZ0GlMGOAt zCC~n!7Bc~skbV_s&2Yk&lmkFXxh1`960W42l`sjElr4ZR!kQOASOSPEK$)pOJFf#N gGfl&pnJCT90Nzt&JEE`9{{R3007*qoM6N<$g5PD!X#fBK literal 0 HcmV?d00001 diff --git a/plugins/eclipse/resources/images/eclipse.gif b/plugins/eclipse/resources/images/eclipse.gif deleted file mode 100644 index eb7b90c76711ac9cfcea0843bccf09b78457fa7f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 308 zcmZ?wbhEHb6krfwxXQqA_T;J4$4?$PaBSbsL;H6h-o9!7rZsyvuiLk5!S>|~cPyH- zt*L5RSM#bVee3hn=9T0us4HI@6*wg(cxp<_%b={S9^AQf z_vXdxSI*tOe&OcT^Ow$@`Tzev11*8#PZmZ71_cHkkR>2LF|Y+XOepZsk?Qw&_$)yq zW0Is>iqu3CgJZm{r`9HPa Date: Mon, 9 Feb 2015 12:41:21 +0100 Subject: [PATCH 5/6] allow to create instance of non-public files --- .../src/org/jetbrains/ide/XmlRpcServerImpl.java | 4 +++- .../src/com/intellij/ide/XmlRpcHandlerBean.java | 12 ++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/platform/built-in-server/src/org/jetbrains/ide/XmlRpcServerImpl.java b/platform/built-in-server/src/org/jetbrains/ide/XmlRpcServerImpl.java index 9b683b53ab65..22fa38db97fb 100644 --- a/platform/built-in-server/src/org/jetbrains/ide/XmlRpcServerImpl.java +++ b/platform/built-in-server/src/org/jetbrains/ide/XmlRpcServerImpl.java @@ -17,7 +17,9 @@ package org.jetbrains.ide; import com.intellij.ide.XmlRpcHandlerBean; import com.intellij.ide.XmlRpcServer; +import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.extensions.AbstractExtensionPointBean; import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.CharsetToolkit; @@ -48,7 +50,7 @@ public class XmlRpcServerImpl implements XmlRpcServer { handlerMapping = new THashMap(); for (XmlRpcHandlerBean handlerBean : Extensions.getExtensions(XmlRpcHandlerBean.EP_NAME)) { try { - handlerMapping.put(handlerBean.name, handlerBean.instantiate()); + handlerMapping.put(handlerBean.name, AbstractExtensionPointBean.instantiate(handlerBean.findClass(handlerBean.implementation), ApplicationManager.getApplication().getPicoContainer(), true)); } catch (ClassNotFoundException e) { LOG.error(e); diff --git a/platform/platform-api/src/com/intellij/ide/XmlRpcHandlerBean.java b/platform/platform-api/src/com/intellij/ide/XmlRpcHandlerBean.java index dff2f1054814..77630f66b30e 100644 --- a/platform/platform-api/src/com/intellij/ide/XmlRpcHandlerBean.java +++ b/platform/platform-api/src/com/intellij/ide/XmlRpcHandlerBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,14 +15,10 @@ */ package com.intellij.ide; -import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.extensions.AbstractExtensionPointBean; import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.util.xmlb.annotations.Attribute; -/** - * @author yole - */ public class XmlRpcHandlerBean extends AbstractExtensionPointBean { public static final ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.xmlRpcHandler"); @@ -31,8 +27,4 @@ public class XmlRpcHandlerBean extends AbstractExtensionPointBean { @Attribute("implementation") public String implementation; - - public Object instantiate() throws ClassNotFoundException { - return instantiate(implementation, ApplicationManager.getApplication().getPicoContainer()); - } -} +} \ No newline at end of file From 8fffa312a176313a19a81bda30b2aef555e3eb5b Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Mon, 9 Feb 2015 14:37:06 +0300 Subject: [PATCH 6/6] DaemonRespondToChangesTest fixes; really ignore action of IgnoreDocumentRunnable class --- .../codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java | 6 ------ .../intellij/codeInsight/daemon/impl/DaemonListeners.java | 7 +++---- .../fixtures/impl/CodeInsightTestFixtureImpl.java | 2 ++ 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java index 215b80e89064..b3de08e25172 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java @@ -42,7 +42,6 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.RangeMarker; -import com.intellij.openapi.editor.colors.EditorColorsManager; import com.intellij.openapi.editor.ex.RangeHighlighterEx; import com.intellij.openapi.editor.impl.DocumentMarkupModel; import com.intellij.openapi.editor.markup.MarkupModel; @@ -125,7 +124,6 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzerEx implements Pers @NotNull DaemonCodeAnalyzerSettings daemonCodeAnalyzerSettings, @NotNull EditorTracker editorTracker, @NotNull PsiDocumentManager psiDocumentManager, - @NotNull EditorColorsManager colorsManager, @SuppressWarnings("UnusedParameters") @NotNull final NamedScopeManager namedScopeManager, @SuppressWarnings("UnusedParameters") @NotNull final DependencyValidationManager dependencyValidationManager) { myProject = project; @@ -305,7 +303,6 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzerEx implements Pers UIUtil.dispatchAllInvocationEvents(); Project project = file.getProject(); - setUpdateByTimerEnabled(false); FileStatusMap.getAndClearLog(); FileStatusMap fileStatusMap = getFileStatusMap(); fileStatusMap.allowDirt(canChangeDocument); @@ -367,9 +364,6 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzerEx implements Pers @TestOnly public void prepareForTest() { - //if (!myInitialized) { - // projectOpened(); - //} setUpdateByTimerEnabled(false); waitForTermination(); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonListeners.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonListeners.java index 884c59cc082c..083ea16e5091 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonListeners.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonListeners.java @@ -363,6 +363,7 @@ public class DaemonListeners implements Disposable { static boolean isUnderIgnoredAction(@Nullable Object action) { return action instanceof DocumentRunnable.IgnoreDocumentRunnable || + action == DocumentRunnable.IgnoreDocumentRunnable.class || ApplicationManager.getApplication().hasWriteAction(DocumentRunnable.IgnoreDocumentRunnable.class); } @@ -428,15 +429,13 @@ public class DaemonListeners implements Disposable { @Override public void beforeWriteActionStart(Object action) { myDaemonWasRunning = myDaemonCodeAnalyzer.isRunning(); - if (!myDaemonWasRunning) return; // we'll restart in writeActionFinished() + if (!myDaemonWasRunning || isUnderIgnoredAction(action)) return; // we'll restart in writeActionFinished() stopDaemon(true, "Write action start"); } @Override public void writeActionFinished(Object action) { - if (myDaemonWasRunning) { - stopDaemon(true, "Write action finish"); - } + stopDaemon(true, "Write action finish"); } } diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java index 817b2105d1da..0b958006e33a 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java @@ -1631,6 +1631,8 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig return infos; } catch (ProcessCanceledException e) { + PsiDocumentManager.getInstance(project).commitAllDocuments(); + UIUtil.dispatchAllInvocationEvents(); exception = e; } }