Skip to content

Commit

Permalink
Documentation in the Suggestions Database (#1791)
Browse files Browse the repository at this point in the history
  • Loading branch information
BinarySoftware authored and iamrecursion committed Jun 24, 2021
1 parent 34702b6 commit 3e4823d
Show file tree
Hide file tree
Showing 29 changed files with 615 additions and 445 deletions.
2 changes: 2 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
Launcher and the Project Manager.
- Added documentation and a minimal tool for hosting custom library repositories
([#1804](https://github.com/enso-org/enso/pull/1804)).
- Added `documentationHtml` field to Suggestions database entry
([#1791](https://github.com/enso-org/enso/pull/1791))

## Libraries

Expand Down
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,7 @@ lazy val runtime = (project in file("engine/runtime"))
.dependsOn(searcher)
.dependsOn(testkit % Test)
.dependsOn(`logging-utils`)
.dependsOn(`docs-generator`)

/* Note [Unmanaged Classpath]
* ~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
/*
* Copyright 2013 Google LLC
*
* 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.
*/

/*
* Copyright 2008 Google LLC
*
Expand All @@ -28,6 +14,20 @@
* limitations under the License.
*/

/*
* Copyright 2013 Google LLC
*
* 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.
*/

/*
* Copyright 2008 Google LLC
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 The Error Prone Authors.
* Copyright 2014 The Error Prone Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,7 @@
*/

/*
* Copyright 2015 The Error Prone Authors.
* Copyright 2016 The Error Prone Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -47,7 +47,7 @@
*/

/*
* Copyright 2014 The Error Prone Authors.
* Copyright 2015 The Error Prone Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2017-2020 Lightbend Inc. <https://www.lightbend.com>
* Copyright (C) 2009-2020 Lightbend Inc. <https://www.lightbend.com>
*/

/*
* Copyright (C) 2009-2020 Lightbend Inc. <https://www.lightbend.com>
* Copyright (C) 2017-2020 Lightbend Inc. <https://www.lightbend.com>
*/
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* limitations under the License.
*/

Copyright 2017-2019 John A. De Goes and the ZIO Contributors

/*
* Copyright 2017-2020 John A. De Goes and the ZIO Contributors
* Copyright 2017-2018 Łukasz Biały, Paul Chiusano, Michael Pilquist,
Expand All @@ -34,5 +36,3 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

Copyright 2017-2019 John A. De Goes and the ZIO Contributors
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2011 Mathias Doenitz
* Copyright (C) 2011,2012 Mathias Doenitz, Johannes Rudolph
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,7 @@
*/

/*
* Copyright (C) 2011,2012 Mathias Doenitz, Johannes Rudolph
* Copyright (C) 2011 Mathias Doenitz
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2017-2020 Lightbend Inc. <https://www.lightbend.com>
* Copyright (C) 2009-2020 Lightbend Inc. <https://www.lightbend.com>
*/

/*
* Copyright (C) 2009-2020 Lightbend Inc. <https://www.lightbend.com>
* Copyright (C) 2017-2020 Lightbend Inc. <https://www.lightbend.com>
*/
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* limitations under the License.
*/

Copyright 2017-2019 John A. De Goes and the ZIO Contributors

/*
* Copyright 2017-2020 John A. De Goes and the ZIO Contributors
* Copyright 2017-2018 Łukasz Biały, Paul Chiusano, Michael Pilquist,
Expand All @@ -34,5 +36,3 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

Copyright 2017-2019 John A. De Goes and the ZIO Contributors
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2011 Mathias Doenitz
* Copyright (C) 2011,2012 Mathias Doenitz, Johannes Rudolph
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,7 @@
*/

/*
* Copyright (C) 2011,2012 Mathias Doenitz, Johannes Rudolph
* Copyright (C) 2011 Mathias Doenitz
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 2 additions & 0 deletions docs/language-server/protocol-language-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ interface SuggestionEntryAtom {
arguments: SuggestionEntryArgument[];
returnType: string;
documentation?: string;
documentationHtml?: string;
}

interface SuggestionEntryMethod {
Expand All @@ -426,6 +427,7 @@ interface SuggestionEntryMethod {
selfType: string;
returnType: string;
documentation?: string;
documentationHtml?: string;
}

interface SuggestionEntryFunction {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ object SearchProtocol {
* @param selfType the self type to update
* @param returnType the return type to update
* @param documentation the documentation string to update
* @param documentationHtml the HTML documentation to update
* @param scope the scope to update
*/
case class Modify(
Expand All @@ -214,6 +215,7 @@ object SearchProtocol {
selfType: Option[FieldUpdate[String]] = None,
returnType: Option[FieldUpdate[String]] = None,
documentation: Option[FieldUpdate[String]] = None,
documentationHtml: Option[FieldUpdate[String]] = None,
scope: Option[FieldUpdate[Suggestion.Scope]] = None
) extends SuggestionsDatabaseUpdate

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,9 @@ final class SuggestionsHandler(
arguments = m.arguments.map(_.map(toApiArgumentAction)),
returnType = m.returnType.map(fieldUpdate),
documentation = m.documentation.map(fieldUpdateOption),
scope = m.scope.map(fieldUpdate)
documentationHtml =
m.documentationHtml.map(fieldUpdateOption),
scope = m.scope.map(fieldUpdate)
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ import org.enso.polyglot.Suggestion
object Suggestions {

val atom: Suggestion.Atom = Suggestion.Atom(
externalId = None,
module = "Test.Main",
name = "MyType",
arguments = Vector(Suggestion.Argument("a", "Any", false, false, None)),
returnType = "MyAtom",
documentation = None
externalId = None,
module = "Test.Main",
name = "MyType",
arguments = Vector(Suggestion.Argument("a", "Any", false, false, None)),
returnType = "MyAtom",
documentation = None,
documentationHtml = None
)

val method: Suggestion.Method = Suggestion.Method(
Expand All @@ -24,9 +25,10 @@ object Suggestions {
Suggestion.Argument("this", "MyType", false, false, None),
Suggestion.Argument("foo", "Number", false, true, Some("42"))
),
selfType = "MyType",
returnType = "Number",
documentation = Some("Lovely")
selfType = "MyType",
returnType = "Number",
documentation = Some("Lovely"),
documentationHtml = Some("<p>Lovely</p>")
)

val function: Suggestion.Function = Suggestion.Function(
Expand Down Expand Up @@ -60,9 +62,10 @@ object Suggestions {
Suggestion.Argument("this", "Any", false, false, None),
Suggestion.Argument("that", "Any", false, false, None)
),
selfType = "Any",
returnType = "Any",
documentation = Some("Lovely")
selfType = "Any",
returnType = "Any",
documentation = Some("Lovely"),
documentationHtml = Some("<p>Lovely</p>")
)

val methodOnNumber: Suggestion.Method = Suggestion.Method(
Expand All @@ -72,9 +75,10 @@ object Suggestions {
arguments = Vector(
Suggestion.Argument("this", "Number", false, false, None)
),
selfType = "Number",
returnType = "Number",
documentation = None
selfType = "Number",
returnType = "Number",
documentation = None,
documentationHtml = None
)

val methodOnInteger: Suggestion.Method = Suggestion.Method(
Expand All @@ -84,9 +88,10 @@ object Suggestions {
arguments = Vector(
Suggestion.Argument("that", "Number", false, false, None)
),
selfType = "Integer",
returnType = "Number",
documentation = Some("Blah, blah")
selfType = "Integer",
returnType = "Number",
documentation = Some("Blah, blah"),
documentationHtml = Some("<p>Blah, blah</p>")
)

val all = Seq(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,12 +353,13 @@ class SuggestionsHandlerSpec

val moduleName = "Test.Foo"
val moduleAtom = Suggestion.Atom(
externalId = None,
module = moduleName,
name = "Foo",
arguments = Vector(),
returnType = moduleName,
documentation = None
externalId = None,
module = moduleName,
name = "Foo",
arguments = Vector(),
returnType = moduleName,
documentation = None,
documentationHtml = None
)
val fooAtom = moduleAtom.copy(returnType = "Test.Foo.Foo")

Expand Down
Loading

0 comments on commit 3e4823d

Please sign in to comment.