Add isStatic method field (#3829)

PR adds `isStatic` field to suggestion. The field is required for Component Browser.
This commit is contained in:
Dmitry Bushev 2022-10-26 12:12:45 +03:00 committed by GitHub
parent 55b9bea352
commit 46441ca7a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 175 additions and 79 deletions

View File

@ -528,6 +528,9 @@ interface SuggestionEntryMethod {
/** The return type of this method. */
returnType: string;
/** The flag indicating whether this method is static or instance. */
isStatic: boolean;
/** The documentation string. */
documentation?: string;

View File

@ -181,6 +181,7 @@ object SearchProtocol {
arg +: conversion.arguments,
conversion.returnType,
conversion.returnType,
isStatic = false,
conversion.documentation,
conversion.documentationHtml,
None,
@ -587,18 +588,6 @@ object SearchProtocol {
}
}
/** The result of the import request.
*
* @param module the definition module of the symbol
* @param symbol the resolved symbol
* @param exports the list of re-exports
*/
case class ImportResult(
module: String,
symbol: String,
exports: Seq[Export]
)
/** The request to invalidate the modules index. */
case object InvalidateModulesIndex

View File

@ -58,6 +58,7 @@ object Suggestions {
),
selfType = "MyType",
returnType = "Number",
isStatic = false,
documentation = Some("Lovely"),
documentationHtml = None,
documentationSections = Some(docSectionsBuilder.build("Lovely"))
@ -96,6 +97,7 @@ object Suggestions {
),
selfType = "Any",
returnType = "Any",
isStatic = false,
documentation = Some("Lovely"),
documentationHtml = None,
documentationSections = Some(docSectionsBuilder.build("Lovely"))
@ -110,6 +112,7 @@ object Suggestions {
),
selfType = "Number",
returnType = "Number",
isStatic = false,
documentation = None,
documentationHtml = None,
documentationSections = None
@ -124,6 +127,7 @@ object Suggestions {
),
selfType = "Integer",
returnType = "Number",
isStatic = false,
documentation = Some("Blah, blah"),
documentationHtml = None,
documentationSections = Some(docSectionsBuilder.build("Blah, blah"))

View File

@ -1251,6 +1251,7 @@ class SuggestionsHandlerSpec
arguments = Seq(),
selfType = "Test.Main",
returnType = "IO",
isStatic = true,
documentation = None,
documentationHtml = None,
documentationSections = None

View File

@ -155,6 +155,7 @@ class SuggestionsHandlerEventsTest extends BaseServerTest with FlakySpec {
],
"selfType" : "MyType",
"returnType" : "Number",
"isStatic" : false,
"documentation" : "Lovely",
"documentationSections" : [
{
@ -347,6 +348,48 @@ class SuggestionsHandlerEventsTest extends BaseServerTest with FlakySpec {
"id" : 3,
"result" : {
"entries" : [
{
"id" : 1,
"suggestion" : {
"type" : "atom",
"module" : "local.Test.Main",
"name" : "MyType",
"arguments" : [
{
"name" : "a",
"reprType" : "Any",
"isSuspended" : false,
"hasDefault" : false,
"defaultValue" : null,
"tagValues" : null
}
],
"returnType" : "MyAtom",
"documentation" : " PRIVATE\n\n A key-value store. This type assumes all keys are pairwise comparable,\n using the `<`, `>` and `==` operators.\n\n Arguments:\n - one: The first.\n - two_three: The *second*.\n\n ? Info\n Here is a thing.",
"documentationSections" : [
{
"type" : "tag",
"name" : "PRIVATE",
"body" : ""
},
{
"type" : "paragraph",
"body" : "A key-value store. This type assumes all keys are pairwise comparable, using the <code>&lt;</code>, <code>&gt;</code> and <code>==</code> operators. "
},
{
"type" : "keyed",
"key" : "Arguments",
"body" : " <ul><li>one: The first.</li><li>two_three: The <b>second</b>.</li></ul> "
},
{
"type" : "marked",
"mark" : "Info",
"header" : "Info",
"body" : " Here is a thing."
}
]
}
},
{
"id" : 3,
"suggestion" : {
@ -393,68 +436,6 @@ class SuggestionsHandlerEventsTest extends BaseServerTest with FlakySpec {
}
}
},
{
"id" : 1,
"suggestion" : {
"type" : "atom",
"module" : "local.Test.Main",
"name" : "MyType",
"arguments" : [
{
"name" : "a",
"reprType" : "Any",
"isSuspended" : false,
"hasDefault" : false,
"defaultValue" : null,
"tagValues" : null
}
],
"returnType" : "MyAtom",
"documentation" : " PRIVATE\n\n A key-value store. This type assumes all keys are pairwise comparable,\n using the `<`, `>` and `==` operators.\n\n Arguments:\n - one: The first.\n - two_three: The *second*.\n\n ? Info\n Here is a thing.",
"documentationSections" : [
{
"type" : "tag",
"name" : "PRIVATE",
"body" : ""
},
{
"type" : "paragraph",
"body" : "A key-value store. This type assumes all keys are pairwise comparable, using the <code>&lt;</code>, <code>&gt;</code> and <code>==</code> operators. "
},
{
"type" : "keyed",
"key" : "Arguments",
"body" : " <ul><li>one: The first.</li><li>two_three: The <b>second</b>.</li></ul> "
},
{
"type" : "marked",
"mark" : "Info",
"header" : "Info",
"body" : " Here is a thing."
}
]
}
},
{
"id" : 4,
"suggestion" : {
"type" : "local",
"externalId" : ${Suggestions.local.externalId.get},
"module" : "local.Test.Main",
"name" : "x",
"returnType" : "Number",
"scope" : {
"start" : {
"line" : 21,
"character" : 0
},
"end" : {
"line" : 89,
"character" : 0
}
}
}
},
{
"id" : 2,
"suggestion" : {
@ -482,6 +463,7 @@ class SuggestionsHandlerEventsTest extends BaseServerTest with FlakySpec {
],
"selfType" : "MyType",
"returnType" : "Number",
"isStatic" : false,
"documentation" : "Lovely",
"documentationSections" : [
{
@ -490,6 +472,26 @@ class SuggestionsHandlerEventsTest extends BaseServerTest with FlakySpec {
}
]
}
},
{
"id" : 4,
"suggestion" : {
"type" : "local",
"externalId" : ${Suggestions.local.externalId.get},
"module" : "local.Test.Main",
"name" : "x",
"returnType" : "Number",
"scope" : {
"start" : {
"line" : 21,
"character" : 0
},
"end" : {
"line" : 89,
"character" : 0
}
}
}
}
],
"currentVersion" : 4

View File

@ -229,6 +229,7 @@ object Suggestion {
* @param arguments the list of arguments
* @param selfType the self type of a method
* @param returnType the return type of a method
* @param isStatic the flag indicating whether a method is static or instance
* @param documentation the documentation string
* @param documentationHtml the documentation rendered as HTML
* @param reexport the module re-exporting this method
@ -240,6 +241,7 @@ object Suggestion {
arguments: Seq[Argument],
selfType: String,
returnType: String,
isStatic: Boolean,
documentation: Option[String],
documentationHtml: Option[String] = None,
documentationSections: Option[List[DocSection]] = None,
@ -255,6 +257,7 @@ object Suggestion {
s"arguments=${arguments.map(_.toLogString(shouldMask))}," +
s"selfType=$selfType," +
s"returnType=$returnType," +
s"isStatic=$isStatic," +
s"documentation=" + (if (shouldMask) documentation.map(_ => STUB)
else documentation) +
s",reexport=$reexport)"

View File

@ -170,6 +170,7 @@ class RuntimeSuggestionUpdatesTest
List(),
"Enso_Test.Test.Main",
ConstantsGen.ANY,
true,
None,
None,
None
@ -228,6 +229,7 @@ class RuntimeSuggestionUpdatesTest
List(),
"Enso_Test.Test.Main",
ConstantsGen.ANY,
true,
None,
None,
None
@ -308,6 +310,7 @@ class RuntimeSuggestionUpdatesTest
List(),
"Enso_Test.Test.Main",
ConstantsGen.ANY,
true,
None,
None,
None
@ -408,6 +411,7 @@ class RuntimeSuggestionUpdatesTest
List(),
"Enso_Test.Test.Main",
ConstantsGen.ANY,
true,
None,
None,
None
@ -518,6 +522,7 @@ class RuntimeSuggestionUpdatesTest
List(),
"Enso_Test.Test.Main",
ConstantsGen.ANY,
true,
None,
None,
None
@ -593,6 +598,7 @@ class RuntimeSuggestionUpdatesTest
),
"Enso_Test.Test.Main",
ConstantsGen.ANY,
true,
None,
None,
None
@ -666,6 +672,7 @@ class RuntimeSuggestionUpdatesTest
),
"Enso_Test.Test.Main",
ConstantsGen.ANY,
true,
None,
None,
None
@ -783,6 +790,7 @@ class RuntimeSuggestionUpdatesTest
Seq(),
"Enso_Test.Test.Main",
ConstantsGen.ANY,
true,
None,
None,
None
@ -827,6 +835,7 @@ class RuntimeSuggestionUpdatesTest
),
ConstantsGen.TEXT,
ConstantsGen.ANY,
false,
None,
None,
None
@ -854,6 +863,7 @@ class RuntimeSuggestionUpdatesTest
),
ConstantsGen.NUMBER,
ConstantsGen.ANY,
false,
None,
None,
None
@ -988,6 +998,7 @@ class RuntimeSuggestionUpdatesTest
),
"Enso_Test.Test.A.MyType",
ConstantsGen.ANY,
false,
None,
None,
None
@ -1013,6 +1024,7 @@ class RuntimeSuggestionUpdatesTest
),
ConstantsGen.INTEGER,
ConstantsGen.ANY,
false,
None,
None,
None
@ -1038,6 +1050,7 @@ class RuntimeSuggestionUpdatesTest
),
"Enso_Test.Test.A",
ConstantsGen.ANY,
true,
None,
None,
None
@ -1090,6 +1103,7 @@ class RuntimeSuggestionUpdatesTest
List(),
"Enso_Test.Test.Main",
ConstantsGen.ANY,
true,
None,
None,
None

View File

@ -83,13 +83,14 @@ final class SuggestionBuilder[A: IndexedSource](val source: A) {
_
) if !m.isStaticWrapperForInstanceMethod =>
val typeSignature = ir.getMetadata(TypeSignatures)
val selfTypeOpt = typePtr match {
val (selfTypeOpt, isStatic) = typePtr match {
case Some(typePtr) =>
typePtr
val selfType = typePtr
.getMetadata(MethodDefinitions)
.map(_.target.qualifiedName)
selfType -> m.isStatic
case None =>
Some(module)
Some(module) -> true
}
val methodOpt = selfTypeOpt.map { selfType =>
buildMethod(
@ -97,6 +98,7 @@ final class SuggestionBuilder[A: IndexedSource](val source: A) {
module,
methodName.name,
selfType,
isStatic,
args,
doc,
typeSignature
@ -192,6 +194,7 @@ final class SuggestionBuilder[A: IndexedSource](val source: A) {
module: QualifiedName,
name: String,
selfType: QualifiedName,
isStatic: Boolean,
args: Seq[IR.DefinitionArgument],
doc: Option[String],
typeSignature: Option[TypeSignatures.Metadata]
@ -206,6 +209,7 @@ final class SuggestionBuilder[A: IndexedSource](val source: A) {
arguments = methodArgs,
selfType = selfType.toString,
returnType = buildReturnType(returnTypeDef),
isStatic = isStatic,
documentation = doc
)
}
@ -318,6 +322,7 @@ final class SuggestionBuilder[A: IndexedSource](val source: A) {
module = module,
name = getterName,
selfType = module.createChild(typeName),
isStatic = false,
args = Seq(thisArg),
doc = None,
typeSignature = None

View File

@ -65,6 +65,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None
),
Vector()
@ -95,6 +96,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = Some(" The foo")
),
Vector()
@ -126,6 +128,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test",
returnType = "Number",
isStatic = true,
documentation = Some(" The foo")
),
Vector()
@ -155,6 +158,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test",
returnType = "Foo.Bar",
isStatic = true,
documentation = None
),
Vector()
@ -185,6 +189,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test",
returnType = "Number",
isStatic = true,
documentation = None
),
Vector()
@ -221,6 +226,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test",
returnType = "Number",
isStatic = true,
documentation = None
),
Vector()
@ -251,6 +257,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test",
returnType = "Foo.Bar Baz",
isStatic = true,
documentation = None
),
Vector()
@ -286,6 +293,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None
),
Vector(
@ -337,6 +345,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None
),
Vector()
@ -383,6 +392,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test.MyType",
returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None
),
Vector()
@ -438,6 +448,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test.MyAtom",
returnType = "Number",
isStatic = false,
documentation = Some(" My bar")
),
Vector()
@ -482,6 +493,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test.MyAtom",
returnType = "Number",
isStatic = false,
documentation = None
),
Vector()
@ -572,6 +584,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test.Other_Atom",
returnType = "Number",
isStatic = false,
documentation = None
),
Vector()
@ -601,6 +614,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None
),
Vector()
@ -650,6 +664,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test",
returnType = "Unnamed.Test.A",
isStatic = true,
documentation = None
),
Vector()
@ -698,6 +713,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test.MyType",
returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None
),
Vector()
@ -719,7 +735,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
)
}
"build conersion method for complex type" in {
"build conversion method for complex type" in {
pending
val code =
"""type MyMaybe
@ -765,6 +781,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test.MyMaybe",
returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None
),
Vector()
@ -805,6 +822,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test.New",
returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None
),
Vector()
@ -846,6 +864,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(),
selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None
),
Vector(
@ -893,6 +912,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(),
selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None
),
Vector(
@ -953,6 +973,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(),
selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None
),
Vector(
@ -1011,6 +1032,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(),
selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None
),
Vector(
@ -1063,6 +1085,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(),
selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None
),
Vector(
@ -1106,6 +1129,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(),
selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None
),
Vector(
@ -1162,6 +1186,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(),
selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None
),
Vector(
@ -1217,6 +1242,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(),
selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None
),
Vector(
@ -1276,6 +1302,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test.MyType",
returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None
),
Vector()
@ -1291,6 +1318,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test.MyType",
returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None
),
Vector()
@ -1340,6 +1368,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test.Mtp",
returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None
),
Vector()
@ -1355,6 +1384,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test.Mtp",
returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None
),
Vector()
@ -1410,6 +1440,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test.Maybe",
returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None
),
Vector()
@ -1470,6 +1501,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test.Maybe",
returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None
),
Vector()
@ -1528,6 +1560,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test.List",
returnType = "Unnamed.Test.List",
isStatic = true,
documentation = Some(" a method")
),
Vector()
@ -1586,6 +1619,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test.Maybe",
returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None
),
Vector()
@ -1603,6 +1637,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test.Maybe",
returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None
),
Vector()
@ -1649,6 +1684,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test.MyType",
returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None
),
Vector()
@ -1664,6 +1700,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test.MyType",
returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None
),
Vector()
@ -1676,6 +1713,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(),
selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None
),
Vector()
@ -1720,6 +1758,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test.Test",
returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None
),
Vector()
@ -1732,6 +1771,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(),
selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None
),
Vector()
@ -1789,6 +1829,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test.A",
returnType = "Unnamed.Test.A",
isStatic = false,
documentation = None
),
Vector()
@ -1811,6 +1852,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test",
returnType = "Unnamed.Test.A",
isStatic = true,
documentation = None
),
Vector()
@ -1823,6 +1865,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = List(),
selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None
),
Vector()
@ -1854,6 +1897,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(),
selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None
),
Vector()
@ -1886,6 +1930,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(),
selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None
),
Vector(
@ -1938,6 +1983,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(),
selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None
),
Vector(
@ -1990,6 +2036,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
),
selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = Some(" The foo")
),
Vector()

View File

@ -57,6 +57,7 @@ object SuggestionRandom {
arguments = Seq(),
selfType = nextString(),
returnType = nextString(),
isStatic = Random.nextBoolean(),
documentation = optional(nextString()),
documentationHtml = optional(nextString())
)

View File

@ -989,6 +989,7 @@ final class SqlSuggestionsRepo(val db: SqlDatabase)(implicit
name = module,
selfType = SelfTypeColumn.EMPTY,
returnType = "",
isStatic = false,
scopeStartLine = ScopeColumn.EMPTY,
scopeStartOffset = ScopeColumn.EMPTY,
scopeEndLine = ScopeColumn.EMPTY,
@ -1017,6 +1018,7 @@ final class SqlSuggestionsRepo(val db: SqlDatabase)(implicit
name = name,
selfType = SelfTypeColumn.EMPTY,
returnType = returnType,
isStatic = false,
documentation = doc,
scopeStartLine = ScopeColumn.EMPTY,
scopeStartOffset = ScopeColumn.EMPTY,
@ -1032,6 +1034,7 @@ final class SqlSuggestionsRepo(val db: SqlDatabase)(implicit
args,
selfType,
returnType,
isStatic,
doc,
_,
_,
@ -1046,6 +1049,7 @@ final class SqlSuggestionsRepo(val db: SqlDatabase)(implicit
name = name,
selfType = selfType,
returnType = returnType,
isStatic = isStatic,
documentation = doc,
scopeStartLine = ScopeColumn.EMPTY,
scopeStartOffset = ScopeColumn.EMPTY,
@ -1081,6 +1085,7 @@ final class SqlSuggestionsRepo(val db: SqlDatabase)(implicit
name = toConversionMethodName(sourceType, returnType),
selfType = SelfTypeColumn.EMPTY,
returnType = returnType,
isStatic = false,
documentation = doc,
scopeStartLine = ScopeColumn.EMPTY,
scopeStartOffset = ScopeColumn.EMPTY,
@ -1099,6 +1104,7 @@ final class SqlSuggestionsRepo(val db: SqlDatabase)(implicit
name = name,
selfType = SelfTypeColumn.EMPTY,
returnType = returnType,
isStatic = false,
documentation = None,
scopeStartLine = scope.start.line,
scopeStartOffset = scope.start.character,
@ -1117,6 +1123,7 @@ final class SqlSuggestionsRepo(val db: SqlDatabase)(implicit
name = name,
selfType = SelfTypeColumn.EMPTY,
returnType = returnType,
isStatic = false,
documentation = None,
scopeStartLine = scope.start.line,
scopeStartOffset = scope.start.character,
@ -1194,6 +1201,7 @@ final class SqlSuggestionsRepo(val db: SqlDatabase)(implicit
arguments = arguments.sortBy(_.index).map(toArgument),
selfType = suggestion.selfType,
returnType = suggestion.returnType,
isStatic = suggestion.isStatic,
documentation = suggestion.documentation,
documentationHtml = None,
documentationSections = None,

View File

@ -37,6 +37,7 @@ case class ArgumentRow(
* @param name the suggestion name
* @param selfType the self type of a suggestion
* @param returnType the return type of a suggestion
* @param isStatic the flag indicating whether a method is static or instance
* @param scopeStartLine the line of the start position of the scope
* @param scopeStartOffset the offset of the start position of the scope
* @param scopeEndLine the line of the end position of the scope
@ -52,6 +53,7 @@ case class SuggestionRow(
name: String,
selfType: String,
returnType: String,
isStatic: Boolean,
scopeStartLine: Int,
scopeStartOffset: Int,
scopeEndLine: Int,
@ -164,6 +166,7 @@ final class SuggestionsTable(tag: Tag)
def name = column[String]("name")
def selfType = column[String]("self_type")
def returnType = column[String]("return_type")
def isStatic = column[Boolean]("is_static")
def scopeStartLine =
column[Int]("scope_start_line", O.Default(ScopeColumn.EMPTY))
def scopeStartOffset =
@ -185,6 +188,7 @@ final class SuggestionsTable(tag: Tag)
name,
selfType,
returnType,
isStatic,
scopeStartLine,
scopeStartOffset,
scopeEndLine,
@ -263,5 +267,5 @@ object SuggestionsVersion extends TableQuery(new SuggestionsVersionTable(_))
object SchemaVersion extends TableQuery(new SchemaVersionTable(_)) {
/** The current schema version. */
val CurrentVersion: Long = 7
val CurrentVersion: Long = 8
}

View File

@ -67,6 +67,7 @@ class SuggestionsRepoTest extends AnyWordSpec with Matchers with RetrySpec {
suggestion.module,
suggestion.atom,
suggestion.method,
suggestion.instanceMethod,
suggestion.conversion,
suggestion.function,
suggestion.local
@ -80,6 +81,7 @@ class SuggestionsRepoTest extends AnyWordSpec with Matchers with RetrySpec {
suggestion.module,
suggestion.atom,
suggestion.method,
suggestion.instanceMethod,
suggestion.conversion,
suggestion.function,
suggestion.local
@ -1727,6 +1729,19 @@ class SuggestionsRepoTest extends AnyWordSpec with Matchers with RetrySpec {
arguments = Seq(),
selfType = "local.Test.Main",
returnType = "Standard.Builtins.IO",
isStatic = true,
documentation = None
)
val instanceMethod: Suggestion.Method =
Suggestion.Method(
externalId = Some(UUID.randomUUID()),
module = "local.Test.Main",
name = "foo",
arguments = Seq(),
selfType = "local.Test.Main.A",
returnType = "Standard.Builtins.Nothing",
isStatic = false,
documentation = None
)