Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-Blocking mark occurences #85

Open
wants to merge 14 commits into
base: kotlin-1.3.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kotlin-bundled-compiler/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Bundled Kotlin Compiler
Bundle-SymbolicName: org.jetbrains.kotlin.bundled-compiler;singleton:=true
Bundle-Version: 0.8.7.qualifier
Bundle-Version: 0.8.8.qualifier
Bundle-Vendor: JetBrains
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ClassPath: .,
Expand Down
3 changes: 2 additions & 1 deletion kotlin-bundled-compiler/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ bin.includes = META-INF/,\
lib/kotlin-script-runtime.jar,\
lib/allopen-compiler-plugin.jar,\
lib/sam-with-receiver-compiler-plugin.jar,\
lib/noarg-compiler-plugin.jar
lib/noarg-compiler-plugin.jar,\
lib/annotations-13.0.jar
src.includes = lib/
bin.excludes = lib/kotlin-compiler-sources.jar,\
lib/downloads/
Expand Down
19 changes: 10 additions & 9 deletions kotlin-bundled-compiler/get_bundled.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<project default="get_bundled">
<property name="compiler.tag" value="1.2.70"/>
<property name="compiler.tag" value="1.3.0"/>
<property name="bootstrap_branch" value=""/>
<property name="idea-version" value="162.1812.17"/>

<property name="compiler.query" value="1604268:id"/>
<property name="compiler.query" value=".lastSuccessful"/>

<property name="teamcity-base" value="https://teamcity.jetbrains.com"/>

<property name="kotlin-idea-compatible-version" value="IJ2017.3-1" />
<property name="kotlin-version" value="1.2.70"/>
<property name="kotlin-version" value="1.3.0-*"/>
<property name="teamcity-kotlin-url"
value="${teamcity-base}/guestAuth/repository/download/Kotlin_1270_CompilerAllPlugins/${compiler.query}"/>
value="${teamcity-base}/guestAuth/app/rest/builds/buildType:Kotlin_130_CompilerAllPlugins,status:success,count:1/artifacts/content"/>

<property name="idea-sdk-url" value="https://www.jetbrains.com/intellij-repository/releases/com/jetbrains/intellij/idea" />

Expand Down Expand Up @@ -86,7 +86,7 @@
<mkdir dir="${download.dir}" />

<get
src="${teamcity-kotlin-url}/kotlin-plugin-${kotlin-version}-release-${kotlin-idea-compatible-version}.zip"
src="${teamcity-kotlin-url}/kotlin-plugin-${kotlin-version}-${kotlin-idea-compatible-version}.zip"
dest="${download.dir}/${compiler-artifact-file}"
usetimestamp="true" />

Expand Down Expand Up @@ -192,6 +192,7 @@
<include name="Kotlin/kotlinc/lib/allopen-compiler-plugin.jar"/>
<include name="Kotlin/kotlinc/lib/noarg-compiler-plugin.jar"/>
<include name="Kotlin/kotlinc/lib/sam-with-receiver-compiler-plugin.jar"/>
<include name="Kotlin/kotlinc/lib/annotations-13.0.jar"/>
</patternset>
<mapper type="flatten"/>
</unzip>
Expand All @@ -218,16 +219,16 @@
</unzip>

<!-- Also retrivive sources -->
<get src="${teamcity-kotlin-url}/maven/org/jetbrains/kotlin/kotlin-compiler/${kotlin-version}/kotlin-compiler-${kotlin-version}-sources.jar"
dest="${download.dir}/${compiler-sources-file}" usetimestamp="true" />
<!--<get src="${teamcity-kotlin-url}/maven/org/jetbrains/kotlin/kotlin-compiler/${kotlin-version}/kotlin-compiler-${kotlin-version}-sources.jar"
dest="${download.dir}/${compiler-sources-file}" usetimestamp="true" />-->
<!-- Get idea sources -->
<get src="${idea-sdk-url}/ideaIC/${idea-version}/ideaIC-${idea-version}-sources.jar" dest="${download.dir}/idea-sdk-sources.jar" usetimestamp="true" />

<!-- Pack souces into single archive -->
<zip destfile="${target.dir}/${compiler-sources-file}">
<!--<zip destfile="${target.dir}/${compiler-sources-file}">
<zipfileset src="${download.dir}/${compiler-sources-file}" />
<zipfileset src="${download.dir}/idea-sdk-sources.jar" />
</zip>
</zip>-->
</target>

<target name="get_bundled" depends="download_bundled, download_test_data,
Expand Down
2 changes: 1 addition & 1 deletion kotlin-bundled-compiler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<relativePath>../pom.xml</relativePath>
<groupId>kotlin.eclipse</groupId>
<artifactId>kotlin.eclipse.plugin</artifactId>
<version>0.8.7-SNAPSHOT</version>
<version>0.8.8-SNAPSHOT</version>
</parent>

<artifactId>org.jetbrains.kotlin.bundled-compiler</artifactId>
Expand Down
103 changes: 103 additions & 0 deletions kotlin-bundled-compiler/src/com/intellij/util/text/TextRangeUtil.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/*
* Copyright 2000-2014 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 com.intellij.util.text;

import com.intellij.openapi.util.Segment;
import com.intellij.openapi.util.TextRange;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
* @author Rustam Vishnyakov
*/
public class TextRangeUtil {

public static final Comparator<TextRange> RANGE_COMPARATOR = new Comparator<TextRange>() {
@Override
public int compare(TextRange range1, TextRange range2) {
int startOffsetDiff = range1.getStartOffset() - range2.getStartOffset();
return startOffsetDiff != 0 ? startOffsetDiff : range1.getEndOffset() - range2.getEndOffset();
}
};

private TextRangeUtil() {
}

/**
* Excludes ranges from the original range. For example, if the original range is [30..100] and ranges to exclude are
* [20..50] and [60..90], resulting ranges will be [50..60] and [90..100]. The ranges may overlap and follow in any order. In the latter
* case the original list of excluded ranges is sorted by start/end offset.
*
* @param original The original range to exclude the ranges from.
* @param excludedRanges The list of ranges to exclude.
* @return A list of ranges after excluded ranges have been applied.
*/
public static Iterable<TextRange> excludeRanges(@NotNull TextRange original, @NotNull List<TextRange> excludedRanges) {
if (!excludedRanges.isEmpty()) {
if (excludedRanges.size() > 1) {
Collections.sort(excludedRanges, RANGE_COMPARATOR);
}
int enabledRangeStart = original.getStartOffset();
List<TextRange> enabledRanges = new ArrayList<TextRange>();
for (TextRange excludedRange : excludedRanges) {
if (excludedRange.getEndOffset() < enabledRangeStart) continue;
int excludedRangeStart = excludedRange.getStartOffset();
if (excludedRangeStart > original.getEndOffset()) break;
if (excludedRangeStart > enabledRangeStart) {
enabledRanges.add(new TextRange(enabledRangeStart, excludedRangeStart));
}
enabledRangeStart = excludedRange.getEndOffset();
}
if (enabledRangeStart < original.getEndOffset()) {
enabledRanges.add(new TextRange(enabledRangeStart, original.getEndOffset()));
}
return enabledRanges;
}
return Collections.singletonList(original);
}

/**
* Return least text range that contains all of passed text ranges.
* For example for {[0, 3],[3, 7],[10, 17]} this method will return [0, 17]
* @param textRanges The list of ranges to process
* @return least text range that contains all of passed text ranges
*/
@NotNull
public static TextRange getEnclosingTextRange(@NotNull List<TextRange> textRanges) {
if(textRanges.isEmpty())
return TextRange.EMPTY_RANGE;
int lowerBound = textRanges.get(0).getStartOffset();
int upperBound = textRanges.get(0).getEndOffset();
for(int i = 1; i < textRanges.size(); ++i) {
TextRange textRange = textRanges.get(i);
lowerBound = Math.min(lowerBound, textRange.getStartOffset());
upperBound = Math.max(upperBound, textRange.getEndOffset());
}
return new TextRange(lowerBound, upperBound);
}

public static int getDistance(@NotNull Segment r2, @NotNull Segment r1) {
int s1 = r1.getStartOffset();
int e1 = r1.getEndOffset();
int s2 = r2.getStartOffset();
int e2 = r2.getEndOffset();
return Math.max(s1, s2) <= Math.min(e1, e2) ? 0 : Math.min(Math.abs(s1 - e2), Math.abs(s2 - e1));
}
}
2 changes: 2 additions & 0 deletions kotlin-eclipse-aspects/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry combineaccessrules="false" kind="src" path="/kotlin-eclipse-ui"/>
<classpathentry combineaccessrules="false" kind="src" path="/kotlin-bundled-compiler"/>
<classpathentry kind="con" path="org.jetbrains.kotlin.core.KOTLIN_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
6 changes: 6 additions & 0 deletions kotlin-eclipse-aspects/.project
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.jetbrains.kotlin.ui.kotlinBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.ajdt.core.ajbuilder</name>
<arguments>
Expand All @@ -25,6 +30,7 @@
<nature>org.eclipse.ajdt.ui.ajnature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.jetbrains.kotlin.core.kotlinNature</nature>
</natures>
<linkedResources>
<link>
Expand Down
6 changes: 4 additions & 2 deletions kotlin-eclipse-aspects/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: kotlin-eclipse-aspects
Bundle-SymbolicName: org.jetbrains.kotlin.aspects
Bundle-Version: 0.8.7.qualifier
Bundle-Version: 0.8.8.qualifier
Bundle-Activator: org.jetbrains.kotlin.aspects.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
Expand Down Expand Up @@ -33,7 +33,9 @@ Import-Package: org.eclipse.core.resources,
org.eclipse.jdt.launching.sourcelookup.containers,
org.eclipse.jface.text,
org.eclipse.ui.ide,
org.eclipse.jdt.internal.ui.viewsupport
org.eclipse.jdt.internal.ui.packageview,
org.eclipse.jdt.internal.ui.viewsupport,
org.eclipse.swt.graphics
Eclipse-SupplementBundle:
org.eclipse.jdt.debug.ui,
org.eclipse.jdt.debug,
Expand Down
2 changes: 1 addition & 1 deletion kotlin-eclipse-aspects/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<relativePath>../pom.xml</relativePath>
<groupId>kotlin.eclipse</groupId>
<artifactId>kotlin.eclipse.plugin</artifactId>
<version>0.8.7-SNAPSHOT</version>
<version>0.8.8-SNAPSHOT</version>
</parent>

<artifactId>org.jetbrains.kotlin.aspects</artifactId>
Expand Down
3 changes: 2 additions & 1 deletion kotlin-eclipse-core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: kotlin-eclipse-core
Bundle-SymbolicName: org.jetbrains.kotlin.core;singleton:=true
Bundle-Version: 0.8.7.qualifier
Bundle-Version: 0.8.8.qualifier
Bundle-Activator: org.jetbrains.kotlin.core.Activator
Bundle-Vendor: JetBrains
Require-Bundle: org.jetbrains.kotlin.bundled-compiler,
Expand Down Expand Up @@ -32,6 +32,7 @@ Export-Package: org.jetbrains.kotlin.core,
org.jetbrains.kotlin.core.compiler,
org.jetbrains.kotlin.core.debug,
org.jetbrains.kotlin.core.filesystem,
org.jetbrains.kotlin.core.formatting,
org.jetbrains.kotlin.core.launch,
org.jetbrains.kotlin.core.log,
org.jetbrains.kotlin.core.model,
Expand Down
10 changes: 10 additions & 0 deletions kotlin-eclipse-core/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<plugin>
<extension-point id="org.jetbrains.kotlin.core.scriptTemplateProvider" name="Kotlin Script Template Provider" schema="schema/org.jetbrains.kotlin.core.scriptTemplateProvider.exsd"/>
<extension-point id="org.jetbrains.kotlin.core.scriptTemplateProviderEx" name="Kotlin Script Template Provider" schema="schema/org.jetbrains.kotlin.core.scriptTemplateProviderEx.exsd"/>
<extension-point id="org.jetbrains.kotlin.core.predefinedKotlinCodeStyle" name="Predefined Kotlin Code Style" schema="schema/org.jetbrains.kotlin.core.predefinedKotlinCodeStyle.exsd"/>
<extension
id="org.jetbrains.kotlin.core.kotlinNature"
name="KotlinNature"
Expand Down Expand Up @@ -52,4 +53,13 @@
id="org.jetbrains.kotlin.core.kotlinClasspathProvider">
</classpathProvider>
</extension>
<extension
point="org.jetbrains.kotlin.core.predefinedKotlinCodeStyle">
<codeStyle
class="org.jetbrains.kotlin.idea.formatter.KotlinObsoleteCodeStyle">
</codeStyle>
<codeStyle
class="org.jetbrains.kotlin.idea.formatter.KotlinStyleGuideCodeStyle">
</codeStyle>
</extension>
</plugin>
2 changes: 1 addition & 1 deletion kotlin-eclipse-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<relativePath>../pom.xml</relativePath>
<groupId>kotlin.eclipse</groupId>
<artifactId>kotlin.eclipse.plugin</artifactId>
<version>0.8.7-SNAPSHOT</version>
<version>0.8.8-SNAPSHOT</version>
</parent>

<artifactId>org.jetbrains.kotlin.core</artifactId>
Expand Down
1 change: 1 addition & 0 deletions kotlin-eclipse-core/preferences.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ compilerPlugins/jpa/jarPath=$KOTLIN_HOME/lib/noarg-compiler-plugin.jar
compilerPlugins/jpa/args=org.jetbrains.kotlin.noarg:preset=jpa
compilerPlugins/sam-with-receiver/active=false
compilerPlugins/sam-with-receiver/jarPath=$KOTLIN_HOME/lib/sam-with-receiver-compiler-plugin.jar
codeStyle/codeStyleId=KOTLIN_OLD_DEFAULTS
Loading