diff --git a/.classpath b/.classpath
index d72aef13d..7f3f174fb 100644
--- a/.classpath
+++ b/.classpath
@@ -36,6 +36,7 @@
-
+
+
diff --git a/ant/build.gant b/ant/build.gant
index 5ded893ea..cac3edc67 100644
--- a/ant/build.gant
+++ b/ant/build.gant
@@ -991,6 +991,7 @@ def compile(srcdir, destdir, failonerror=true, errorproperty=null, nested){
destdir: destdir,
srcdir: srcdir,
classpathref: 'classpath',
+ encoding: 'UTF-8',
debug: 'on', optimize: false, deprecation: '${javac.deprecation}',
target: '${javac.target}', source: '${javac.target}',
failonerror: failonerror,
diff --git a/org.eclim.installer/build/resources/dependencies.xml b/org.eclim.installer/build/resources/dependencies.xml
index f18ff4fff..ff1305852 100644
--- a/org.eclim.installer/build/resources/dependencies.xml
+++ b/org.eclim.installer/build/resources/dependencies.xml
@@ -60,4 +60,11 @@
+
+
+
+
+
+
+
diff --git a/org.eclim.installer/build/resources/install.properties b/org.eclim.installer/build/resources/install.properties
index 9b4dc7284..64565995e 100644
--- a/org.eclim.installer/build/resources/install.properties
+++ b/org.eclim.installer/build/resources/install.properties
@@ -161,6 +161,11 @@
Provides groovy development functionality.
\
Requires the Groovy Eclipse Plugin which will be installed if necessary.
+ featureList.kotlin=Kotlin Development
+ featureList.kotlin.html=\
+ Provides kotlin development functionality.
\
+ Requires the Kotlin Eclipse Plugin which will be installed if necessary.
+
requirements.jdt=Eclipse Java Development Tools (JDT)
requirements.jdt.html=\
Validates that the Eclipse java development tools are installed.
diff --git a/org.eclim.installer/java/org/eclim/installer/step/EclipsePluginsStep.java b/org.eclim.installer/java/org/eclim/installer/step/EclipsePluginsStep.java
index f54be6564..e109e1741 100644
--- a/org.eclim.installer/java/org/eclim/installer/step/EclipsePluginsStep.java
+++ b/org.eclim.installer/java/org/eclim/installer/step/EclipsePluginsStep.java
@@ -548,6 +548,7 @@ private static class FeatureNameComparator
NAMES.add("featureList.pydev");
NAMES.add("featureList.sdt210");
NAMES.add("featureList.groovy");
+ NAMES.add("featureList.kotlin");
}
public int compare(String ob1, String ob2)
diff --git a/org.eclim.installer/java/org/eclim/installer/step/FeatureProvider.java b/org.eclim.installer/java/org/eclim/installer/step/FeatureProvider.java
index 9ead8ef52..636e473d4 100644
--- a/org.eclim.installer/java/org/eclim/installer/step/FeatureProvider.java
+++ b/org.eclim.installer/java/org/eclim/installer/step/FeatureProvider.java
@@ -40,19 +40,22 @@ public class FeatureProvider
public static final String[] FEATURES = {
"jdt", "adt", "wst", "cdt",
"dltk", "dltkruby", "pdt",
- "pydev", "sdt", "groovy"
+ "pydev", "sdt", "groovy",
+ "kotlin"
};
private static final String[][] FEATURES_DEPENDS = {
null, {"jdt", "wst"}, null, null,
null, {"dltk"}, {"dltk", "wst"},
- null, {"jdt"}, {"jdt"}
+ null, {"jdt"}, {"jdt"},
+ {"jdt"}
};
private static final String[][] FEATURES_EXCLUSIVE = {
null, null, null, null,
null, null, null,
- null, null, null
+ null, null, null,
+ null
};
@Override
diff --git a/org.eclim.kotlin/META-INF/MANIFEST.MF b/org.eclim.kotlin/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..9bb65e8d4
--- /dev/null
+++ b/org.eclim.kotlin/META-INF/MANIFEST.MF
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Vendor: eclim.org
+Bundle-SymbolicName: org.eclim.kotlin;singleton:=true
+Bundle-Version: ${eclim.version}
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Localization: plugin
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.eclim.plugin.Plugin
+Bundle-ClassPath: .,
+ eclim.kotlin.jar
+Require-Bundle: org.eclim,
+ org.eclim.core,
+ org.eclim.jdt,
+ org.eclipse.core.resources,
+ org.eclipse.core.runtime,
+ org.eclipse.jface.text,
+ org.eclipse.jdt,
+ org.eclipse.jdt.core,
+ org.jetbrains.kotlin.ui,
+ org.eclipse.ui,
+ org.eclipse.ui.ide
diff --git a/org.eclim.kotlin/about.html b/org.eclim.kotlin/about.html
new file mode 100644
index 000000000..e9373ea46
--- /dev/null
+++ b/org.eclim.kotlin/about.html
@@ -0,0 +1,7 @@
+
+
+
+ See org.eclim_${eclim.version}.
+
+
diff --git a/org.eclim.kotlin/build_kotlin.gant b/org.eclim.kotlin/build_kotlin.gant
new file mode 100644
index 000000000..5455c6818
--- /dev/null
+++ b/org.eclim.kotlin/build_kotlin.gant
@@ -0,0 +1,29 @@
+feature_kotlin = 'org.jetbrains.kotlin.feature'
+
+target(name: 'org.eclim.kotlin.classpath') {
+ pluginClasspath {
+ include(name: 'dropins/**/plugins/*kotlin*.jar')
+ include(name: 'plugins/*kotlin*.jar')
+ }
+}
+
+target(name: 'org.eclim.kotlin.plugin.compile') {
+
+ mkdir(dir: '${build.classes}/org.eclim.kotlin')
+ javac(
+ srcdir: 'org.eclim.kotlin/java',
+ destdir: '${build.classes}/org.eclim.kotlin',
+ classpathref: 'classpath',
+ deprecation: true)
+ {
+ include(name: '**/*.java')
+ classpath{fileset(dir: '${build.classes}/org.eclim.kotlin', includes: 'org.eclim/**')}
+ classpath {
+ pathelement(path: '${build.classes}/org.eclim.kotlin')
+ fileset(dir: '${build.plugins}', includes: 'org.eclim*/eclim*.jar')
+ }
+ }
+ copy(todir: '${build.classes}/org.eclim.kotlin'){
+ fileset(dir: "org.eclim.kotlin/java", includes: "eclim/**", excludes: '**/*.java')
+ }
+}
diff --git a/org.eclim.kotlin/java/org/eclim/plugin/kotlin/PluginResources.java b/org.eclim.kotlin/java/org/eclim/plugin/kotlin/PluginResources.java
new file mode 100644
index 000000000..87f2b4997
--- /dev/null
+++ b/org.eclim.kotlin/java/org/eclim/plugin/kotlin/PluginResources.java
@@ -0,0 +1,33 @@
+package org.eclim.plugin.kotlin;
+
+import org.eclim.plugin.AbstractPluginResources;
+import org.eclim.plugin.core.project.ProjectManagement;
+import org.eclim.plugin.core.project.ProjectNatureFactory;
+import org.eclipse.jdt.core.JavaCore;
+import org.jetbrains.kotlin.core.model.KotlinNature;
+import org.eclim.plugin.kotlin.project.KotlinProjectManager;
+
+public final class PluginResources extends AbstractPluginResources
+{
+ public static final String BUNDLE_BASENAME = "org/eclim/plugin/kotlin/messages";
+ public static final String NATURE = KotlinNature.KOTLIN_NATURE;
+
+ @Override
+ public void initialize(final String name)
+ {
+ super.initialize(name);
+
+ ProjectNatureFactory.addNature("kotlin", new String[] {
+ NATURE,
+ JavaCore.NATURE_ID
+ });
+ ProjectManagement.addProjectManager(NATURE, new KotlinProjectManager());
+ }
+
+ @Override
+ protected String getBundleBaseName()
+ {
+ return BUNDLE_BASENAME;
+ }
+
+}
diff --git a/org.eclim.kotlin/java/org/eclim/plugin/kotlin/command/complete/CodeCompleteCommand.java b/org.eclim.kotlin/java/org/eclim/plugin/kotlin/command/complete/CodeCompleteCommand.java
new file mode 100644
index 000000000..be2220fd9
--- /dev/null
+++ b/org.eclim.kotlin/java/org/eclim/plugin/kotlin/command/complete/CodeCompleteCommand.java
@@ -0,0 +1,84 @@
+package org.eclim.plugin.kotlin.command.complete;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclim.annotation.Command;
+import org.eclim.command.CommandLine;
+import org.eclim.plugin.core.command.complete.CodeCompleteResult;
+import org.eclim.plugin.core.util.ProjectUtils;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.jetbrains.kotlin.ui.builder.AspectsUtils;
+import org.jetbrains.kotlin.ui.editors.KotlinFileEditor;
+import org.jetbrains.kotlin.ui.editors.codeassist.KotlinCompletionProcessor;
+
+
+@Command(name = "kotlin_complete",
+ options = "REQUIRED p project ARG,"
+ + "REQUIRED f file ARG,"
+ + "REQUIRED o offset ARG,"
+ + "REQUIRED e encoding ARG,"
+ + "REQUIRED l layout ARG,"
+ + "OPTIONAL j javaDoc NOARG")
+public final class CodeCompleteCommand
+ extends org.eclim.plugin.jdt.command.complete.CodeCompleteCommand
+{
+
+ @Override
+ protected Object getResponse(final List results)
+ {
+ return results;
+ }
+
+ @Override
+ protected List getCompletionResults(
+ final CommandLine commandLine, final String project, final String file,
+ final int offset) throws Exception
+ {
+ final IFile ifile = ProjectUtils
+ .getFile(ProjectUtils.getProject(project, true), file);
+
+ if (!AspectsUtils.isKotlinFile(ifile))
+ return Collections.emptyList();
+
+ final IWorkbenchPage page = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage();
+ final IEditorPart editorPart = IDE.openEditor(page, ifile, false);
+ final KotlinFileEditor ktEditor = (KotlinFileEditor) editorPart;
+ final ISourceViewer viewer = ktEditor.getViewer();
+
+ final KotlinCompletionProcessor completer = new KotlinCompletionProcessor(
+ ktEditor, null, true);
+ final ICompletionProposal[] proposals = completer
+ .computeCompletionProposals(viewer, offset);
+
+ ((ITextEditor) ktEditor).close(false);
+
+ if (proposals == null)
+ return Collections.emptyList();
+
+ final List results = new ArrayList(
+ proposals.length);
+
+ for(ICompletionProposal proposal : proposals){
+ final String moreInfo = proposal.getAdditionalProposalInfo();
+ final String shortDesc = proposal.getDisplayString();
+ final String desc = proposal.getDisplayString();
+ final String completion = proposal.getDisplayString();
+ final String completionText = (moreInfo != null) ? moreInfo : completion;
+
+ results.add(new CodeCompleteResult(completionText, shortDesc, desc));
+ }
+
+ return results;
+ }
+
+}
diff --git a/org.eclim.kotlin/java/org/eclim/plugin/kotlin/command/src/SrcUpdateCommand.java b/org.eclim.kotlin/java/org/eclim/plugin/kotlin/command/src/SrcUpdateCommand.java
new file mode 100644
index 000000000..bca28917a
--- /dev/null
+++ b/org.eclim.kotlin/java/org/eclim/plugin/kotlin/command/src/SrcUpdateCommand.java
@@ -0,0 +1,72 @@
+package org.eclim.plugin.kotlin.command.src;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclim.annotation.Command;
+import org.eclim.command.CommandLine;
+import org.eclim.command.Error;
+import org.eclim.command.Options;
+import org.eclim.plugin.core.command.AbstractCommand;
+import org.eclim.plugin.core.util.ProjectUtils;
+import org.eclim.plugin.jdt.util.JavaUtils;
+import org.eclim.util.file.FileOffsets;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.compiler.IProblem;
+
+@Command(
+ name = "kotlin_src_update",
+ options = "REQUIRED p project ARG,"
+ + "REQUIRED f file ARG,"
+ + "OPTIONAL v validate NOARG,"
+ + "OPTIONAL b build NOARG"
+ )
+public final class SrcUpdateCommand extends AbstractCommand
+{
+
+ @Override
+ public Object execute(final CommandLine commandLine) throws Exception
+ {
+ final String file = commandLine.getValue(Options.FILE_OPTION);
+ final String projectName = commandLine.getValue(Options.PROJECT_OPTION);
+ final IProject project = ProjectUtils.getProject(projectName, true);
+ final IFile ifile = ProjectUtils.getFile(project, file);
+
+ // validate the src file.
+ if(commandLine.hasOption(Options.VALIDATE_OPTION)){
+ final ICompilationUnit src = JavaCore.createCompilationUnitFrom(ifile);
+ final IProblem[] problems = JavaUtils.getProblems(src);
+ final List errors = new ArrayList(problems.length);
+ final String filename = src.getResource().getLocation().toOSString()
+ .replace('\\', '/');
+ final FileOffsets offsets = FileOffsets.compile(filename);
+
+ for(IProblem problem : problems){
+ if(problem.getID() == IProblem.Task){
+ continue;
+ }
+
+ final int[] lineColumn = offsets
+ .offsetToLineColumn(problem.getSourceStart());
+ errors.add(new Error(problem.getMessage(), filename, lineColumn[0],
+ lineColumn[1], problem.isWarning()));
+ }
+
+ if(commandLine.hasOption(Options.BUILD_OPTION)){
+ project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD,
+ new NullProgressMonitor());
+ }
+
+ return errors;
+ }
+
+ return StringUtils.EMPTY;
+ }
+
+}
diff --git a/org.eclim.kotlin/java/org/eclim/plugin/kotlin/messages.properties b/org.eclim.kotlin/java/org/eclim/plugin/kotlin/messages.properties
new file mode 100644
index 000000000..e69de29bb
diff --git a/org.eclim.kotlin/java/org/eclim/plugin/kotlin/project/KotlinProjectManager.java b/org.eclim.kotlin/java/org/eclim/plugin/kotlin/project/KotlinProjectManager.java
new file mode 100644
index 000000000..3e84d56cb
--- /dev/null
+++ b/org.eclim.kotlin/java/org/eclim/plugin/kotlin/project/KotlinProjectManager.java
@@ -0,0 +1,19 @@
+package org.eclim.plugin.kotlin.project;
+
+import org.eclim.command.CommandLine;
+import org.eclim.plugin.jdt.project.JavaProjectManager;
+import org.eclipse.core.resources.IProject;
+import org.jetbrains.kotlin.core.model.KotlinNature;
+
+public final class KotlinProjectManager extends JavaProjectManager
+{
+
+ @Override
+ protected void create(final IProject project, final String depends)
+ throws Exception
+ {
+ super.create(project, depends);
+ KotlinNature.addNature(project);
+ }
+
+}
diff --git a/org.eclim.kotlin/plugin.properties b/org.eclim.kotlin/plugin.properties
new file mode 100644
index 000000000..08dafff94
--- /dev/null
+++ b/org.eclim.kotlin/plugin.properties
@@ -0,0 +1 @@
+eclim.plugin.resources=org.eclim.plugin.kotlin.PluginResources
\ No newline at end of file
diff --git a/org.eclim.kotlin/vim/eclim/autoload/eclim/kotlin/complete.vim b/org.eclim.kotlin/vim/eclim/autoload/eclim/kotlin/complete.vim
new file mode 100644
index 000000000..888b57d41
--- /dev/null
+++ b/org.eclim.kotlin/vim/eclim/autoload/eclim/kotlin/complete.vim
@@ -0,0 +1,34 @@
+" Author: Eric Van Dewoestine
+"
+" License: {{{
+"
+" Copyright (C) 2014 Eric Van Dewoestine
+"
+" This program is free software: you can redistribute it and/or modify
+" it under the terms of the GNU General Public License as published by
+" the Free Software Foundation, either version 3 of the License, or
+" (at your option) any later version.
+"
+" This program is distributed in the hope that it will be useful,
+" but WITHOUT ANY WARRANTY; without even the implied warranty of
+" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+" GNU General Public License for more details.
+"
+" You should have received a copy of the GNU General Public License
+" along with this program. If not, see .
+"
+" }}}
+
+" Script Varables {{{
+ let s:complete_command =
+ \ '-command kotlin_complete -p "" -f "" ' .
+ \ '-o -e -l '
+" }}}
+
+function! eclim#kotlin#complete#CodeComplete(findstart, base) " {{{
+ return eclim#lang#CodeComplete(
+ \ s:complete_command, a:findstart, a:base,
+ \ {'temp': 0, 'layout': g:EclimKotlinCompleteLayout})
+endfunction " }}}
+
+" vim:ft=vim:fdm=marker
diff --git a/org.eclim.kotlin/vim/eclim/ftplugin/kotlin.vim b/org.eclim.kotlin/vim/eclim/ftplugin/kotlin.vim
new file mode 100644
index 000000000..061ea8d50
--- /dev/null
+++ b/org.eclim.kotlin/vim/eclim/ftplugin/kotlin.vim
@@ -0,0 +1,45 @@
+" Author: Eric Van Dewoestine
+"
+" License: {{{
+"
+" Copyright (C) 2014 Eric Van Dewoestine
+"
+" This program is free software: you can redistribute it and/or modify
+" it under the terms of the GNU General Public License as published by
+" the Free Software Foundation, either version 3 of the License, or
+" (at your option) any later version.
+"
+" This program is distributed in the hope that it will be useful,
+" but WITHOUT ANY WARRANTY; without even the implied warranty of
+" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+" GNU General Public License for more details.
+"
+" You should have received a copy of the GNU General Public License
+" along with this program. If not, see .
+"
+" }}}
+
+" Options {{{
+
+exec 'setlocal ' . g:EclimCompletionMethod . '=eclim#kotlin#complete#CodeComplete'
+
+" }}}
+
+" Autocmds {{{
+
+augroup eclim_kotlin
+ autocmd! BufWritePost
+ autocmd BufWritePost call eclim#lang#UpdateSrcFile('kotlin')
+augroup END
+
+" }}}
+
+" Command Declarations {{{
+
+if !exists(":Validate")
+ command! -nargs=0 -buffer Validate :call eclim#lang#UpdateSrcFile('kotlin', 1)
+endif
+
+" }}}
+
+" vim:ft=vim:fdm=marker
diff --git a/org.eclim.kotlin/vim/eclim/plugin/settings_kotlin.vim b/org.eclim.kotlin/vim/eclim/plugin/settings_kotlin.vim
new file mode 100644
index 000000000..f02df176b
--- /dev/null
+++ b/org.eclim.kotlin/vim/eclim/plugin/settings_kotlin.vim
@@ -0,0 +1,38 @@
+" Author: Eric Van Dewoestine
+"
+" License: {{{
+"
+" Copyright (C) 2014 Eric Van Dewoestine
+"
+" This program is free software: you can redistribute it and/or modify
+" it under the terms of the GNU General Public License as published by
+" the Free Software Foundation, either version 3 of the License, or
+" (at your option) any later version.
+"
+" This program is distributed in the hope that it will be useful,
+" but WITHOUT ANY WARRANTY; without even the implied warranty of
+" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+" GNU General Public License for more details.
+"
+" You should have received a copy of the GNU General Public License
+" along with this program. If not, see .
+"
+" }}}
+
+" Global Varables {{{
+ call eclim#AddVimSetting(
+ \ 'Lang/Kotlin', 'g:EclimKotlinCompleteLayout',
+ \ &completeopt !~ 'preview' && &completeopt =~ 'menu' ? 'standard' : 'compact',
+ \ "Determines how overloaded methods are displayed in the completion popup.\n" .
+ \ "The default is based on your current completion settings. If set to 'compact',\n" .
+ \ "you can set it to 'standard' to force eclim to display all overridden members\n" .
+ \ "in the popup rather than relying on the preview menu for that info.",
+ \ '\(standard\|compact\)')
+
+ call eclim#AddVimSetting(
+ \ 'Lang/Kotlin', 'g:EclimKotlinValidate', 1,
+ \ 'Sets whether or not to validate kotlin files on save.',
+ \ '\(0\|1\)')
+" }}}
+
+" vim:ft=vim:fdm=marker