Skip to content
Closed
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
8 changes: 7 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ lazy val scalaCommunity: sbt.Project =
scalaImpl % "test->test;compile->compile",
structureView % "test->test;compile->compile",
sbtImpl % "test->test;compile->compile",
mill % "test->test;compile->compile",
compilerIntegration % "test->test;compile->compile",
debugger % "test->test;compile->compile",
testingSupport % "test->test;compile->compile",
Expand Down Expand Up @@ -134,6 +135,11 @@ lazy val sbtApi =
)
.withCompilerPluginIn(scalacPatches)

lazy val mill =
newProject("mill", file("mill"))
.dependsOn(scalaApi, compilerShared, workspaceEntities, scalaImpl % "test->test;compile->compile")
.withCompilerPluginIn(scalacPatches)

lazy val codeInsight = newProject(
"codeInsight",
file("scala/codeInsight")
Expand Down Expand Up @@ -422,7 +428,7 @@ lazy val scalaLanguageUtilsRt: sbt.Project =

lazy val sbtImpl =
newProject("sbt-impl", file("sbt/sbt-impl"))
.dependsOn(sbtApi, scalaImpl % "test->test;compile->compile")
.dependsOn(sbtApi, mill, scalaImpl % "test->test;compile->compile")
.settings(
intellijPlugins += "org.jetbrains.idea.maven".toPlugin
)
Expand Down
10 changes: 10 additions & 0 deletions mill/resources/META-INF/mill.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<idea-plugin>

<extensions defaultExtensionNs="com.intellij">
<fileType name="mill" language="mill" extensions="mill"
implementationClass="org.jetbrains.mill.language.MillFileType$" fieldName="MODULE$"/>
<lang.parserDefinition language="mill" implementationClass="org.jetbrains.mill.language.MillParserDefinition"/>
<!-- <lang.fileViewProviderFactory language="mill"-->
<!-- implementationClass="org.jetbrains.mill.language.MillFileViewProviderFactory"/>-->
</extensions>
</idea-plugin>
8 changes: 8 additions & 0 deletions mill/resources/org/jetbrains/mill/images/millFile.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions mill/resources/org/jetbrains/mill/images/millFile_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions mill/src/org/jetbrains/mill/icons/Icons.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.jetbrains.mill.icons;

import javax.swing.*;

import static com.intellij.openapi.util.IconLoader.findIcon;
import static com.intellij.openapi.util.IconLoader.getIcon;

public interface Icons {
Icon MILL_FILE = getIcon("/org/jetbrains/mill/images/millFile.svg", Icons.class);

}
6 changes: 6 additions & 0 deletions mill/src/org/jetbrains/mill/language/MillFile.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.jetbrains.mill.language

import com.intellij.psi.impl.source.PsiFileWithStubSupport

trait MillFile extends PsiFileWithStubSupport {
}
28 changes: 28 additions & 0 deletions mill/src/org/jetbrains/mill/language/MillFileImpl.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.jetbrains.mill
package language


import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.module.{Module, ModuleManager, ModuleUtilCore}
import com.intellij.openapi.roots.ProjectRootManager
import com.intellij.psi._
import com.intellij.psi.search.{GlobalSearchScope, searches}
import org.jetbrains.annotations.NonNls
import org.jetbrains.plugins.scala.caches.{ModTracker, cached, cachedInUserData}
import org.jetbrains.plugins.scala.extensions.PsiClassExt
import org.jetbrains.plugins.scala.lang.psi.ScDeclarationSequenceHolder
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.ScTypeDefinition
import org.jetbrains.plugins.scala.lang.psi.impl._
import org.jetbrains.plugins.scala.project.{ModuleExt, ScalaFeatures}
import org.jetbrains.sbt.project.SbtBuildModuleUriProvider
import org.jetbrains.sbt.project.module.SbtModule.{Build, Imports}

import scala.jdk.CollectionConverters._

final class MillFileImpl private[language](provider: FileViewProvider)
extends ScalaFileImpl(provider, MillFileType)
with MillFile {



}
10 changes: 10 additions & 0 deletions mill/src/org/jetbrains/mill/language/MillFileType.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.jetbrains.mill.language

import org.jetbrains.plugins.scala.{LanguageFileTypeBase, ScalaLanguage}
import org.jetbrains.mill.icons.Icons

import javax.swing.Icon

object MillFileType extends LanguageFileTypeBase(MillLanguage.INSTANCE) {
override def getIcon: Icon = Icons.MILL_FILE
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.jetbrains.mill
package language

import com.intellij.lang.Language
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.{FileViewProviderFactory, PsiManager, SingleRootFileViewProvider}

final class MillFileViewProviderFactory extends FileViewProviderFactory {

override def createFileViewProvider(file: VirtualFile,
language: Language,
manager: PsiManager,
eventSystemEnabled: Boolean): SingleRootFileViewProvider =
new SingleRootFileViewProvider(manager, file, eventSystemEnabled, language) {}
}
13 changes: 13 additions & 0 deletions mill/src/org/jetbrains/mill/language/MillLanguage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.jetbrains.mill.language;

import com.intellij.lang.Language;
import org.jetbrains.plugins.scala.ScalaLanguage;

public final class MillLanguage extends Language {

public static final MillLanguage INSTANCE = new MillLanguage();

private MillLanguage() {
super(ScalaLanguage.INSTANCE, "mill");
}
}
19 changes: 19 additions & 0 deletions mill/src/org/jetbrains/mill/language/MillParserDefinition.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.jetbrains.mill
package language

import com.intellij.openapi.project.Project
import com.intellij.psi.FileViewProvider
import com.intellij.psi.tree.IFileElementType
import org.jetbrains.plugins.scala.lang.lexer.ScalaLexer
import org.jetbrains.plugins.scala.lang.parser.{ScalaParser, ScalaParserDefinitionBase}

final class MillParserDefinition extends ScalaParserDefinitionBase {

override def createLexer(project: Project) = new ScalaLexer(false, project)

override def createParser(project: Project) = new ScalaParser(isScala3 = false)

override val getFileNodeType = new IFileElementType("mill.FILE", MillLanguage.INSTANCE)

override def createFile(viewProvider: FileViewProvider) = new MillFileImpl(viewProvider)
}
1 change: 1 addition & 0 deletions pluginXml/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<xi:include href="/META-INF/sbt-api.xml" xpointer="xpointer(/idea-plugin/*)"/>
<xi:include href="/META-INF/scala-plugin-common.xml" xpointer="xpointer(/idea-plugin/*)"/>
<xi:include href="/META-INF/sbt.xml" xpointer="xpointer(/idea-plugin/*)"/>
<xi:include href="/META-INF/mill.xml" xpointer="xpointer(/idea-plugin/*)"/>
<xi:include href="/META-INF/BSP.xml" xpointer="xpointer(/idea-plugin/*)"/>
<xi:include href="/META-INF/codeInsight.xml" xpointer="xpointer(/idea-plugin/*)"/>
<xi:include href="/META-INF/conversion.xml" xpointer="xpointer(/idea-plugin/*)"/>
Expand Down