Skip to content

Commit

Permalink
191: update light-psi
Browse files Browse the repository at this point in the history
  • Loading branch information
gregsh committed May 19, 2019
1 parent a1812a3 commit 695f47d
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 17 deletions.
21 changes: 21 additions & 0 deletions binaries/light-psi-all-licenses/automaton_license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Copyright (c) 2001-2017 Anders Møller
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17 changes: 13 additions & 4 deletions resources/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
Manifest-Version: 1.0
Class-Path: light-psi-all.jar lib/annotations.jar lib/asm-all-7.0.1.ja
r lib/automaton-1.12-1.jar lib/extensions.jar lib/guava-25.1-jre.jar
lib/idea.jar lib/jdom.jar lib/picocontainer-1.2.jar lib/platform-api.
jar lib/platform-impl.jar lib/trove4j.jar lib/util.jar
Class-Path: light-psi-all.jar
lib/annotations.jar
lib/asm-all-7.0.1.jar
lib/automaton-1.12-1.jar
lib/extensions.jar
lib/guava-25.1-jre.jar
lib/idea.jar
lib/picocontainer-1.2.jar
lib/platform-api.jar
lib/platform-impl.jar
lib/util.jar
lib/trove4j.jar
lib/jdom.jar
Main-Class: org.intellij.grammar.Main

31 changes: 18 additions & 13 deletions src/org/intellij/grammar/LightPsi.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static com.intellij.openapi.extensions.ExtensionPoint.Kind.BEAN_CLASS;
import static com.intellij.openapi.extensions.ExtensionPoint.Kind.INTERFACE;

/**
* @author greg
* @noinspection UseOfSystemOutOrSystemErr
Expand Down Expand Up @@ -166,9 +169,11 @@ private static boolean shouldAddEntry(String path) {
if (path.contains("/grammar-kit/")) return false;

return path.contains("/out/classes/production/") ||
path.contains("extensions.jar") ||
path.contains("openapi.jar") ||
path.contains("idea.jar");
path.contains("idea.jar") ||
path.contains("platform-api.jar") ||
path.contains("platform-impl.jar") ||
path.contains("util.jar") ||
path.contains("extensions.jar");
}

private static void addJarEntry(JarOutputStream jarFile, String resourceName) throws IOException {
Expand Down Expand Up @@ -228,13 +233,15 @@ public void dispose() {
public static class Init {

public static void initExtensions(@NotNull MockProject project) {
Extensions.getRootArea().registerExtensionPoint("com.intellij.referencesSearch", "com.intellij.util.QueryExecutor");
Extensions.getRootArea().registerExtensionPoint("com.intellij.useScopeEnlarger", "com.intellij.psi.search.UseScopeEnlarger");
Extensions.getRootArea().registerExtensionPoint("com.intellij.useScopeOptimizer", "com.intellij.psi.search.UseScopeOptimizer");
Extensions.getRootArea().registerExtensionPoint("com.intellij.languageInjector", "com.intellij.psi.LanguageInjector");
Extensions.getArea(project).registerExtensionPoint("com.intellij.multiHostInjector", "com.intellij.lang.injection.MultiHostInjector");
Extensions.getRootArea().registerExtensionPoint("com.intellij.codeInsight.containerProvider", "com.intellij.codeInsight.ContainerProvider");
Extensions.getRootArea().getExtensionPoint("com.intellij.referencesSearch").registerExtension(new CachesBasedRefSearcher());
ExtensionsArea rootArea = Extensions.getRootArea();
rootArea.registerExtensionPoint("com.intellij.referencesSearch", "com.intellij.util.QueryExecutor", INTERFACE);
rootArea.registerExtensionPoint("com.intellij.useScopeEnlarger", "com.intellij.psi.search.UseScopeEnlarger", INTERFACE);
rootArea.registerExtensionPoint("com.intellij.useScopeOptimizer", "com.intellij.psi.search.UseScopeOptimizer", INTERFACE);
rootArea.registerExtensionPoint("com.intellij.languageInjector", "com.intellij.psi.LanguageInjector", INTERFACE);
rootArea.registerExtensionPoint("com.intellij.codeInsight.containerProvider", "com.intellij.codeInsight.ContainerProvider", INTERFACE);
rootArea.getExtensionPoint("com.intellij.referencesSearch").registerExtension(new CachesBasedRefSearcher(), project);
ExtensionsArea projectArea = Extensions.getArea(project);
projectArea.registerExtensionPoint("com.intellij.multiHostInjector", "com.intellij.lang.injection.MultiHostInjector", INTERFACE);
registerApplicationService(project, PsiReferenceService.class, PsiReferenceServiceImpl.class);
registerApplicationService(project, JobLauncher.class, JobLauncherImpl.class);
registerApplicationService(project, AsyncFutureFactory.class, AsyncFutureFactoryImpl.class);
Expand Down Expand Up @@ -313,9 +320,7 @@ public static <T> void registerExtensionPoint(ExtensionPointName<T> extensionPoi
public static <T> void registerExtensionPoint(ExtensionsArea area, ExtensionPointName<T> extensionPointName, Class<? extends T> aClass) {
final String name = extensionPointName.getName();
if (!area.hasExtensionPoint(name)) {
ExtensionPoint.Kind kind = aClass.isInterface() || (aClass.getModifiers() & Modifier.ABSTRACT) != 0
? ExtensionPoint.Kind.INTERFACE
: ExtensionPoint.Kind.BEAN_CLASS;
ExtensionPoint.Kind kind = aClass.isInterface() || (aClass.getModifiers() & Modifier.ABSTRACT) != 0 ? INTERFACE : BEAN_CLASS;
area.registerExtensionPoint(name, aClass.getName(), kind);
}
}
Expand Down

0 comments on commit 695f47d

Please sign in to comment.