-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor the LS to support multiple content roots (#1800)
- Loading branch information
1 parent
3905f22
commit ed84cde
Showing
26 changed files
with
474 additions
and
377 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...rver/src/main/scala/org/enso/languageserver/boot/resource/DirectoriesInitialization.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
engine/language-server/src/main/scala/org/enso/languageserver/filemanager/ContentRoot.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package org.enso.languageserver.filemanager | ||
|
||
import enumeratum._ | ||
|
||
import java.io.File | ||
import java.util.UUID | ||
|
||
/** A representation of a content root. | ||
* | ||
* @param id the unique identifier of the content root | ||
* @param type the type of the content root | ||
* @param name The name of the content root | ||
*/ | ||
case class ContentRoot(id: UUID, `type`: ContentRootType, name: String) | ||
|
||
/** The type of entity that the content root represents. | ||
*/ | ||
sealed trait ContentRootType extends EnumEntry | ||
object ContentRootType extends Enum[ContentRootType] with CirceEnum[ContentRootType] { | ||
|
||
/** The content root represents the root of the current Enso project. | ||
*/ | ||
case object Project extends ContentRootType | ||
|
||
/** The content root represents a system root (`/` on unix, drives on | ||
* windows). | ||
* | ||
* There may be multiple of this type of root sent by default. | ||
*/ | ||
case object Root extends ContentRootType | ||
|
||
/** The content root represents the user's home directory. | ||
*/ | ||
case object Home extends ContentRootType | ||
|
||
/** The content root represents an Enso library. | ||
*/ | ||
case object Library extends ContentRootType | ||
|
||
/** The content root was a custom location added by the IDE. | ||
*/ | ||
case object Custom extends ContentRootType | ||
|
||
/** Necessary for Enumeratum and Circe. */ | ||
override val values = findValues | ||
} | ||
|
||
/** A representation of a content root. | ||
* | ||
* @param id the unique identifier of the content root | ||
* @param `type` the type of the content root | ||
* @param name The name of the content root | ||
* @param file the file on the filesystem that is the content root | ||
*/ | ||
case class ContentRootWithFile( | ||
id: UUID, | ||
`type`: ContentRootType, | ||
name: String, | ||
file: File | ||
) { | ||
|
||
/** Convert this to a content root for use in the protocol. | ||
* | ||
* @return a protocol content root | ||
*/ | ||
def toContentRoot: ContentRoot = { | ||
ContentRoot(id, `type`, name) | ||
} | ||
} |
Oops, something went wrong.